@ -6,6 +6,9 @@
LANG=en_US.utf8\
./Setup
# compiler version
%ghc_version %{!?ghc_version_override:%(ghc --numeric-version)}%{?ghc_version_override}
# check ghc version was rebuilt against self
%ghc_check_bootstrap\
if [ ! "$(ghc --info | grep \\"Booter\\ version\\",\\"%{ghc_version}\\")" ]; then\
@ -28,15 +31,15 @@ fi
CFLAGS="${CFLAGS:-%optflags}"; export CFLAGS\
%endif\
LDFLAGS="${LDFLAGS:-%{?__global_ldflags}}"; export LDFLAGS\
%cabal configure %{?cabal_verbose} --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{?_defaultlicensedir}%{!?_defaultlicensedir:%_docdir}/%{name } --libsubdir='$compiler/$pkgkey' --datasubdir='$pkgid' --ghc %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?with_tests:--enable-tests} --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 %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?with_tests:--enable-tests} --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 %{?cabal_verbose} %{!?cabal_verbose:-v} --destdir=%{buildroot }
%cabal_install %cabal copy --destdir=%{buildroot} %{?cabal_install_options }
# tests
%cabal_test\
%if %{with tests}\
%cabal test %{?cabal_verbose }\
%cabal test %{?cabal_test_options }\
%endif
# no _pkgdocdir in EPEL <= 7
@ -67,7 +70,7 @@ LDFLAGS="${LDFLAGS:-%{?__global_ldflags}}"; export LDFLAGS\
%define pkgnamever %{pkgname}-%{pkgver}\
%define basepkg %{?ghc_name}%{!?ghc_name:ghc}-%{pkgname}\
%define docdir %{ghclibdocdir}/%{pkgnamever}\
keyname=$(%{_rpmconfigdir}/ghc-pkg-wrapper %{buildroot}%{ghclibdir} field %{pkgnamever} key | uniq )\
keyname=$(%{_rpmconfigdir}/ghc-pkg-wrapper %{buildroot}%{ghclibdir} field %{pkgnamever} key)\
pkgdir="%{ghclibdir}/${keyname}"\
rm -f %{basepkg}.files %{basepkg}-devel.files\
touch %{basepkg}.files %{basepkg}-devel.files\
@ -83,9 +86,11 @@ fi\
if [ -d "%{buildroot}%{docdir}" ]; then\
echo "%{docdir}" >> %{basepkg}-devel.files\
fi\
%if 0%{?1:1}\
for i in $(ls %{buildroot}%{?_defaultlicensedir}%{!?_defaultlicensedir:%_docdir}/%{!?1:%{name}}%{?1:%{basepkg}}); do\
echo "%%license %{?1:%{pkgnamever}/}$i" >> %{basepkg}.files\
echo "%%license %{?1:../ %{pkgnamever}/}$i" >> %{basepkg}.files\
done\
%endif\
for i in %{basepkg}.files %{basepkg}-devel.files; do\
if [ -f "$i" ]; then\
sed -i -e "s!%{buildroot}!!g" $i\
@ -93,9 +98,6 @@ fi\
done\
%{nil}
# compiler version
%ghc_version %{!?ghc_version_override:%(ghc --numeric-version)}%{?ghc_version_override}
# create and install package.conf file
# cabal_pkg_conf [name] [version]
%cabal_pkg_conf()\
@ -110,13 +112,13 @@ install -D --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.
%ghc_bin_build\
%global debug_package %{nil}\
%cabal_configure\
%cabal build %{?cabal_ver bose }
%cabal build %{?cabal_build_ option s}
# ghc_lib_build_without_haddock [name] [version]
%ghc_lib_build_without_haddock()\
%global debug_package %{nil}\
%cabal_configure %{!?without_prof:-p} %{!?ghc_without_shared:--enable-shared} %{?ghc_without_shared:--disable-shared} %{?pkg_name:--htmldir=%{ghclibdocdir}/%{pkg_name}-%{version}} %{?1:--docdir=%{?_defaultlicensedir}%{!?_defaultlicensedir:%_docdir}/ghc-%1%{!?fedora:-%2} --htmldir=%{ghclibdocdir}/%1-%2} %{!?1:--global} %{?ghc_with_lib_for_ghci:--enable-library-for-ghci}\
%cabal build %{?cabal_ver bose }\
%cabal build %{?cabal_build_ option s}\
%{nil}
# ghc_lib_build [name] [version]
@ -126,7 +128,7 @@ install -D --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.
%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\
%cabal haddock --html %{!?without_hscolour:%(if [ -x %{_bindir}/HsColour ]; then echo --hyperlink-source; fi)} --hoogle %{?cabal_haddock_options} \
fi\
%endif\
%{nil}
@ -160,16 +162,16 @@ find %{buildroot} -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \
%ghc_fix_rpath()\
%if %{undefined ghc_without_dynamic}\
if ! type chrpath > /dev/null; then exit 1; fi\
PDIR =$(pwd)\
pdir =$(pwd)\
for lib in %*; do\
for i in $(find %{buildroot} -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \\; -print); do\
if [ -x "$i" ]; then\
RPATH =$(chrpath $i | sed -e "s@^$i: R.*PATH=@@")\
case $RPATH in\
*$PDIR /$lib/*)\
SYSPATH =$(%{_rpmconfigdir}/ghc-pkg-wrapper %{buildroot}%{ghclibdir} --package-db=%{buildroot}%{ghclibdir}/package.conf.d field $lib library-dirs | uniq )\
NEWRPATH=$(echo $RPATH | sed -e "s@$PDIR/$lib/dist/build@${SYSPATH }@g")\
chrpath -r $NEWRPATH $i\
rpath =$(chrpath $i | sed -e "s@^$i: R.*PATH=@@")\
case $rpath in\
*$pdir /$lib/*)\
syspath =$(%{_rpmconfigdir}/ghc-pkg-wrapper %{buildroot}%{ghclibdir} --package-db=%{buildroot}%{ghclibdir}/package.conf.d field $lib library-dirs)\
NEWRPATH=$(echo $rpath | sed -e "s@$pdir/$lib/dist/build@${syspath }@g")\
chrpath -r $newrpath $i\
;;\
esac\
else\
@ -186,22 +188,22 @@ done\
%ghc_fix_dynamic_rpath()\
%if %{undefined ghc_without_dynamic}\
if ! type chrpath > /dev/null; then exit 1; fi\
PDIR =$(pwd)\
pdir =$(pwd)\
for i in %*; do\
case $i in\
/*) PROG =%{buildroot}$i ;;\
*) PROG =%{buildroot}%{_bindir}/$i ;;\
/*) prog =%{buildroot}$i ;;\
*) prog =%{buildroot}%{_bindir}/$i ;;\
esac\
if [ -x "$PROG " ]; then\
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")\
chrpath -r $NEWRPATH $PROG \
if [ -x "$prog " ]; then\
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")\
chrpath -r $newrpath $prog \
;;\
esac\
else\
echo "%%ghc_fix_dynamic_rpath: no such file $PROG "\
echo "%%ghc_fix_dynamic_rpath: no such file $prog "\
exit 1\
fi\
done\