backport some improvements from f22

- cabal macro now sets utf8 locale
- introduce ghc_pkgdocdir since no _pkgdocdir in RHEL 7 and earlier
- add cabal_test macro which uses it
- only run cabal haddock for real libraries with modules
- make sure basepkg.files is also created for meta packages
- ghc_fix_dynamic_rpath: on ARMv7 RPATH is RUNPATH
This commit is contained in:
Jens Petersen 2015-10-08 17:08:46 +09:00
parent 28cbb65983
commit 72434b09df
3 changed files with 32 additions and 6 deletions

View File

@ -74,7 +74,7 @@ for i in $files; do
fi
elif [ "$MODE" = "--requires" ]; then
if file $i | grep -q 'executable, .* dynamically linked'; then
BIN_DEPS=$(objdump -p $i | grep NEEDED | grep libHS | grep -v libHSrts | sed -e "s%^ *NEEDED *libHS\(.*\)-ghc${GHC_VER}.so%\1%")
BIN_DEPS=$(objdump -p $i | grep NEEDED | grep libHS | grep -v libHSrts | sed -e "s%^ *NEEDED *libHS\(.*\)-ghc${GHC_VER}\.so%\1%")
if [ -d "$PKGCONFDIR" ]; then
PACKAGE_CONF_OPT="--package-conf=$PKGCONFDIR"
fi

View File

@ -6,7 +6,7 @@
#%%global without_hscolour 1
Name: ghc-rpm-macros
Version: 1.2.19
Version: 1.2.20
Release: 1%{?dist}
Summary: RPM macros for building packages for GHC
@ -102,6 +102,14 @@ EOF
%changelog
* Thu Oct 8 2015 Jens Petersen <petersen@redhat.com> - 1.2.20-1
- cabal macro now sets utf8 locale
- introduce ghc_pkgdocdir since no _pkgdocdir in RHEL 7 and earlier
- add cabal_test macro which uses it
- only run cabal haddock for real libraries with modules
- make sure basepkg.files is also created for meta packages
- ghc_fix_dynamic_rpath: on ARMv7 RPATH is RUNPATH
* Thu Jan 22 2015 Jens Petersen <petersen@redhat.com> - 1.2.19-1
- version ghcpkgdocdir
- add new names ghc_html_dir, ghc_html_libraries_dir, and ghc_html_pkg_dir

View File

@ -3,6 +3,7 @@
# "cabal"
%cabal [ -x Setup ] || ghc --make %{!?ghc_user_conf:-no-user-package-db} %{!?ghc_without_dynamic:-dynamic} Setup\
LANG=en_US.utf8\
./Setup
# check ghc version was rebuilt against self
@ -23,11 +24,20 @@ fi
%ghc_check_bootstrap\
CFLAGS="${CFLAGS:-%optflags}"; export CFLAGS\
LDFLAGS="${LDFLAGS:-%__global_ldflags}"; export LDFLAGS\
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}} --libsubdir='$compiler/$pkgid' --datasubdir='$pkgid' --ghc %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?with_tests:--enable-tests} --ghc-options="$(echo ' '$CFLAGS | sed -e 's/-Wall -Werror=format-security //' -e 's/ / -optc/g') $(echo ' '$LDFLAGS | sed -e 's/ / -optl/g')" %{?cabal_configure_options} $cabal_configure_extra_options
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{ghc_pkgdocdir} --libsubdir='$compiler/$pkgid' --datasubdir='$pkgid' --ghc %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?with_tests:--enable-tests} --ghc-options="$(echo ' '$CFLAGS | sed -e 's/-Wall -Werror=format-security //' -e 's/ / -optc/g') $(echo ' '$LDFLAGS | sed -e 's/ / -optl/g')" %{?cabal_configure_options} $cabal_configure_extra_options
# install
%cabal_install %cabal copy --destdir=%{buildroot} -v
tests
%cabal_test\
%if %{with tests}\
%cabal test\
%endif
# no _pkgdocdir in EPEL <= 7
%ghc_pkgdocdir %{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}}
# root dir for ghc docs (used by ghc.spec)
%ghc_html_dir %{_docdir}/ghc/html
# deprecates
@ -55,6 +65,7 @@ LDFLAGS="${LDFLAGS:-%__global_ldflags}"; export LDFLAGS\
%define pkgdir %{ghclibdir}/%{pkgnamever}\
%define docdir %{ghclibdocdir}/%{pkgnamever}\
rm -f %{basepkg}.files %{basepkg}-devel.files\
touch %{basepkg}.files %{basepkg}-devel.files\
if [ -d "%{buildroot}%{pkgdir}" ]; then\
echo "%dir %{pkgdir}" >> %{basepkg}.files\
%if %{undefined ghc_without_shared}\
@ -106,7 +117,11 @@ install -D --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.
%ghc_lib_build()\
%ghc_lib_build_without_haddock\
%if %{undefined without_haddock}\
%define pkgname %{?1}%{!?1:%{pkg_name}}\
%define pkgver %{?2}%{!?2:%{version}}\
if [ -f dist/build/libHS%{pkgname}-%{pkgver}.a ]; then\
%cabal haddock --html %{!?without_hscolour:%(if [ -x %{_bindir}/HsColour ]; then echo --hyperlink-source; fi)} --hoogle\
fi\
%endif\
%{nil}
@ -144,9 +159,12 @@ fi
if ! type chrpath > /dev/null; then exit 1; fi\
PDIR=$(pwd)\
for i in %*; do\
PROG=%{buildroot}%{_bindir}/$i\
case $i in\
/*) PROG=%{buildroot}$i ;;\
*) PROG=%{buildroot}%{_bindir}/$i ;;\
esac\
if [ -x "$PROG" ]; then\
RPATH=$(chrpath $PROG | sed -e "s@^$PROG: RPATH=@@")\
RPATH=$(chrpath $PROG | sed -e "s@^$PROG: R.*PATH=@@")\
case $RPATH in\
*$PDIR*)\
NEWRPATH=$(echo $RPATH | sed -e "s@$PDIR/dist/build@%{ghclibdir}/%{pkg_name}-%{version}@g")\
@ -161,7 +179,7 @@ done\
%endif\
%{nil}
%ghc_pkg_recache %{_bindir}/ghc-pkg recache --no-user-package-db || :
%ghc_pkg_recache %{_bindir}/ghc-pkg-%{ghc_version} recache --no-user-package-db || :
# - without_hscolour, without_testsuite, and ghc_bootstrapping
# need to be set locally in the spec file