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