changes for ghc-8.2: _ghcdynlibdir, drop ghc_without_shared, chrpath

- add _ghcdynlibdir for Cabal --dynlibdir
- dynlibs in _libdir except ghc's libs
- drop ghc_without_shared
- ghc_fix_rpath removes RPATHs for 8.2+
This commit is contained in:
Jens Petersen 2018-01-22 09:03:51 +01:00
parent f2e3e0f014
commit bc93aaa088
3 changed files with 20 additions and 7 deletions

View File

@ -10,7 +10,7 @@
#%%global without_hscolour 1
Name: ghc-rpm-macros
Version: 1.6.51
Version: 1.8.0
Release: 1%{?dist}
Summary: RPM macros for building Haskell packages for GHC
@ -162,6 +162,12 @@ EOF
%changelog
* Mon Jan 22 2018 Jens Petersen <petersen@redhat.com> - 1.8.0-1
- add _ghcdynlibdir for Cabal --dynlibdir
- dynlibs in _libdir except ghc's libs
- drop ghc_without_shared
- ghc_fix_rpath removes RPATHs for 8.2+
* Mon Dec 4 2017 Jens Petersen <petersen@fedoraproject.org> - 1.6.51-1
- add ghc_set_cflags macro

View File

@ -39,7 +39,7 @@ export CFLAGS\
%global _hardened_ldflags %{nil}\
LDFLAGS="${LDFLAGS:-%{?__global_ldflags}}"; export LDFLAGS\
%cabal --version\
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_ghcdocdir} --libsubdir='$compiler/$pkgkey' --datasubdir='$pkgid' --ghc %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?with_tests:--enable-tests} %{?ghc_subpackaging:--user}%{!?ghc_subpackaging:--global} --ghc-options="${CFLAGS:+$(echo ' '$CFLAGS | sed -e 's/ / -optc/g')} ${LDFLAGS:+$(echo ' '$LDFLAGS | sed -e 's/ / -optl/g')}" %{?cabal_configure_options} $cabal_configure_extra_options
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{_ghcdocdir} --libsubdir='$compiler/$pkgkey' --datasubdir='$pkgid' --ghc --dynlibdir=%{_ghcdynlibdir} %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?with_tests:--enable-tests} %{?ghc_subpackaging:--user}%{!?ghc_subpackaging:--global} --ghc-options="${CFLAGS:+$(echo ' '$CFLAGS | sed -e 's/ / -optc/g')} ${LDFLAGS:+$(echo ' '$LDFLAGS | sed -e 's/ / -optl/g')}" %{?cabal_configure_options} $cabal_configure_extra_options
# install
%cabal_install %cabal copy --destdir=%{buildroot} %{?cabal_install_options}
@ -91,12 +91,15 @@ rm -f %{basepkg}.files %{basepkg}-devel.files\
touch %{basepkg}.files %{basepkg}-devel.files\
echo ${pkgconf} >> %{basepkg}-devel.files\
if [ -d "%{buildroot}${pkgdir}" ]; then\
%if %{defined ghc_version_override}\
echo "%%dir ${pkgdir}" >> %{basepkg}.files\
%if %{undefined ghc_without_shared}\
echo "%%attr(755,root,root) ${pkgdir}/libHS*-ghc%{ghc_version}.so" >> %{basepkg}.files\
%endif\
find %{buildroot}${pkgdir} -mindepth 1 -type d | sed "s/^/%dir /" >> %{basepkg}-devel.files\
find %{buildroot}${pkgdir} ! \\( -type d -o -name "libHS*.so" \\) >> %{basepkg}-devel.files\
%else\
echo "%%attr(755,root,root) %{_ghcdynlibdir}/libHS%{pkgnamever}-*ghc%{ghc_version}.so" >> %{basepkg}.files\
echo "${pkgdir}" >> %{basepkg}-devel.files\
%endif\
fi\
if [ -d "%{buildroot}%{docdir}" ]; then\
echo "%{docdir}" >> %{basepkg}-devel.files\
@ -135,7 +138,7 @@ install -D --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.
%if 0%{?rhel} && 0%{?rhel} < 8\
licensedirversion=%{?2:-%2}\
%endif\
%cabal_configure %{!?without_prof:-p} %{!?ghc_without_shared:--enable-shared} %{?ghc_without_shared:--disable-shared} %{?pkg_name:--htmldir=%{ghclibdocdir}/%{pkg_name}-%{version}} %{?1:--docdir=%{_ghclicensedir}/ghc-%1${licensedirversion} --htmldir=%{ghclibdocdir}/%1-%2} %{?ghc_subpackaging:--user}%{!?ghc_subpackaging:--global} %{?ghc_with_lib_for_ghci:--enable-library-for-ghci}\
%cabal_configure %{!?without_prof:-p} --enable-shared %{?pkg_name:--htmldir=%{ghclibdocdir}/%{pkg_name}-%{version}} %{?1:--docdir=%{_ghclicensedir}/ghc-%1${licensedirversion} --htmldir=%{ghclibdocdir}/%1-%2} %{?ghc_subpackaging:--user}%{!?ghc_subpackaging:--global} %{?ghc_with_lib_for_ghci:--enable-library-for-ghci}\
%cabal build %{?ghc_smp_mflags} %{?cabal_build_options}\
%{nil}
@ -192,11 +195,13 @@ for lib in %*; do\
7.10.*)\
pkgid=$(cd %{buildroot}%{ghclibdir}/package.conf.d; ls ${lib}* | sed -e "s/.conf$//")\
syspath=$(%{_rpmconfigdir}/ghc-pkg-wrapper %{buildroot}%{ghclibdir} --package-db=%{buildroot}%{ghclibdir}/package.conf.d field $pkgid library-dirs) ;;\
*)\
8.0)\
pkgid=$(cd %{buildroot}%{ghclibdir}; echo ${lib}*)\
syspath=$(%{_rpmconfigdir}/ghc-pkg-wrapper %{buildroot}%{ghclibdir} --package-db=%{buildroot}%{ghclibdir}/package.conf.d field $lib library-dirs | grep $pkgid) ;;\
*)\
syspath="" ;;\
esac\
newrpath=$(echo $rpath | sed -e "s@$PWD/$lib/dist/build@${syspath}@g")\
newrpath=$(echo $rpath | sed -e "s@$PWD/$lib/dist/build@${syspath}@g" -e "s/::/:/")\
chrpath -r $newrpath $i\
;;\
esac\

View File

@ -2,4 +2,6 @@
%_ghcdocdir %{_ghclicensedir}/%{name}
%_ghcdynlibdir %{_libdir}
%cabal_install_options -v