You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
2.9 KiB
101 lines
2.9 KiB
# RPM Macros for packaging Haskell packages with multiple libs -*-rpm-spec-*-
|
|
|
|
# ghc_lib_subpackage [-c cdepslist] [-d] [-l licensetag] [-x] [name-version]
|
|
# for backward compat also support: ghc_lib_subpackage name version
|
|
%ghc_lib_subpackage(c:dl:x)\
|
|
%define pkgname %{?2:%{1}}%{!?2:%{lua:\
|
|
local pv = rpm.expand("%1")\
|
|
local _, _, name = string.find(pv, "^([%a%d-]+)-")\
|
|
print(name)\
|
|
}}\
|
|
%define pkgver %{?2}%{!?2:%{lua:\
|
|
local pv = rpm.expand("%1")\
|
|
print(string.sub(pv, string.find(pv, "[%d.]+$")))\
|
|
}}\
|
|
%{!-x:%{?1:%global ghc_packages_list %{?ghc_packages_list} %{pkgname}-%{pkgver}}}\
|
|
%define ghc_prefix %{?ghc_name}%{!?ghc_name:ghc}\
|
|
%define basepkg %{ghc_prefix}-%{pkgname}\
|
|
%package -n %{basepkg}\
|
|
Summary: Haskell %{pkgname} library\
|
|
%if 0%{?rhel} && 0%{?rhel} < 6\
|
|
Group: System/Libraries\
|
|
%endif\
|
|
%{?1:Version: %{pkgver}}\
|
|
%{-l:License: %{-l*}}\
|
|
Url: http://hackage.haskell.org/package/%{pkgname}\
|
|
%{?ghc_pkg_obsoletes:Obsoletes: %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(%{ghc_prefix}-[^, ]*\\)-devel/\\1/g")}\
|
|
\
|
|
%description -n %{basepkg}\
|
|
This package provides the Haskell %{pkgname} library.\
|
|
\
|
|
%package -n %{basepkg}-devel\
|
|
Summary: Haskell %{pkgname} library development files\
|
|
%if 0%{?rhel} && 0%{?rhel} < 6\
|
|
Group: Development/Languages/Other\
|
|
%endif\
|
|
%{?1:Version: %{pkgver}}\
|
|
%{-l:License: %{-l*}}\
|
|
Requires(post): %{ghc_prefix}-compiler = %{ghc_version}\
|
|
Requires(postun): %{ghc_prefix}-compiler = %{ghc_version}\
|
|
Requires: %{ghc_prefix}-%{pkgname}%{?_isa} = %{pkgver}-%{release}\
|
|
%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}\
|
|
%{-c:Requires: %{-c*}}\
|
|
%{?ghc_pkg_obsoletes:Obsoletes: %{ghc_pkg_obsoletes}}\
|
|
\
|
|
%description -n %{basepkg}-devel\
|
|
This package provides the Haskell %{pkgname} library development files.\
|
|
\
|
|
%post -n %{basepkg}-devel\
|
|
%ghc_pkg_recache\
|
|
\
|
|
%postun -n %{basepkg}-devel\
|
|
%ghc_pkg_recache\
|
|
\
|
|
%files -n %{basepkg} -f %{!-d:%{pkgname}-%{pkgver}/}%{basepkg}.files\
|
|
%if 0%{?rhel} && 0%{?rhel} < 6\
|
|
%defattr(-,root,root,-)\
|
|
%endif\
|
|
%{?base_doc_files:%doc %base_doc_files}\
|
|
\
|
|
%files -n %{basepkg}-devel -f %{!-d:%{pkgname}-%{pkgver}/}%{basepkg}-devel.files\
|
|
%if 0%{?rhel} && 0%{?rhel} < 6\
|
|
%defattr(-,root,root,-)\
|
|
%endif\
|
|
%{?devel_doc_files:%doc %devel_doc_files}\
|
|
%{nil}
|
|
|
|
# ghc_libs_build [name-version] ...
|
|
%ghc_libs_build()\
|
|
HOME=$PWD\
|
|
%global ghc_subpackaging 1\
|
|
for i in %*; do\
|
|
name=$(echo $i | sed -e "s/\\(.*\\)-.*/\\1/")\
|
|
ver=$(echo $i | sed -e "s/.*-\\(.*\\)/\\1/")\
|
|
cd $name-$ver\
|
|
case $name in\
|
|
haskell-platform)\
|
|
%ghc_lib_build_without_haddock $name $ver\
|
|
;;\
|
|
*)\
|
|
%ghc_lib_build $name $ver\
|
|
./Setup register --inplace\
|
|
;;\
|
|
esac\
|
|
cd ..\
|
|
done\
|
|
%{nil}
|
|
|
|
# ghc_libs_install [name-version] ...
|
|
%ghc_libs_install()\
|
|
HOME=$PWD\
|
|
args="%*"\
|
|
for i in $args; do\
|
|
cd $i\
|
|
name=$(echo $i | sed -e "s/\\(.*\\)-.*/\\1/")\
|
|
ver=$(echo $i | sed -e "s/.*-\\(.*\\)/\\1/")\
|
|
%ghc_lib_install $name $ver\
|
|
cd ..\
|
|
done\
|
|
%ghc_fix_rpath $args\
|
|
%{nil}
|