Compare commits

...

8 Commits
master ... f21

Author SHA1 Message Date
Jens Petersen 72434b09df 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
2015-10-08 17:08:46 +09:00
Jens Petersen 28cbb65983 version doc htmldirs and ghcpkgdocdir again; fix cabal-tweak-flag string
version because haddock generates versioned crosslinks

new aliases: %ghc_html_dir, %ghc_html_libraries_dir, and %ghc_html_pkg_dir
2015-01-22 16:59:49 +09:00
Jens Petersen 3df2d9cc3c exclude -Wall from CFLAGS to prevent Cabal configure warning with ghc-7.6
see #1175667:

In function 'foo':
warning: control reaches end of non-void function [-Wreturn-type]
2015-01-19 14:14:29 +09:00
Jens Petersen afcae244ac backport various recent improvements from rawhide
- split ghc.attr into ghc_lib.attr and ghc_bin.attr for finer grained handling
- require ghc-compiler for ghc_version
- macros.ghc: cabal_configure now passes CFLAGS and LDFLAGS to ghc (#1138982)
  (thanks to Sergei Trofimovich and Ville Skyttä)
- ghc-deps.sh: support ghc-pkg for ghc build <= 7.4.2 as well
2014-11-14 18:27:31 +09:00
Jens Petersen b154c1ea88 ghc.attr needs to handle requires for /usr/bin files too 2014-10-16 17:06:34 +09:00
Jens Petersen 1d69007d72 backport some recent changes from f22
- improve ghc_fix_dynamic_rpath not to assume cwd = pkg_name
- drop -O2: it often uses too much build mem
- add an rpm .attr file for ghc-deps.sh rather than running it
  as an external dep generator (#1132275)
2014-09-10 17:19:16 +09:00
Jens Petersen 3e2085dbb6 fix warning in macros.ghc-extra about unused pkgnamever 2014-08-20 22:46:57 +09:00
Peter Robinson 5a6a2084b4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild 2014-08-16 15:44:17 +00:00
7 changed files with 115 additions and 36 deletions

View File

@ -29,7 +29,7 @@ if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then
fi
if ! grep -q -i "^flag *$FLAG" $CABALFILE; then
echo "$CABALFILE does have flag $FLAG"
echo "$CABALFILE does not have flag $FLAG"
exit 1
fi

View File

@ -1,11 +1,6 @@
#!/bin/sh
# find rpm provides and requires for Haskell GHC libraries
# To use add the following lines to spec file:
# %define _use_internal_dependency_generator 0
# %define __find_requires /usr/lib/rpm/ghc-deps.sh --requires %{buildroot}%{ghclibdir}
# %define __find_provides /usr/lib/rpm/ghc-deps.sh --provides %{buildroot}%{ghclibdir}
[ $# -ne 2 ] && echo "Usage: `basename $0` [--provides|--requires] %{buildroot}%{ghclibdir}" && exit 1
set +x
@ -15,11 +10,21 @@ PKGBASEDIR=$2
PKGCONFDIR=$PKGBASEDIR/package.conf.d
GHC_VER=$(basename $PKGBASEDIR | sed -e s/ghc-//)
if [ -x "$PKGBASEDIR/bin/ghc-pkg" ]; then
# ghc-7.8
GHC_PKG="$PKGBASEDIR/bin/ghc-pkg --global-package-db=$PKGCONFDIR"
elif [ -x "$PKGBASEDIR/ghc-pkg" ]; then
GHC_PKG="$PKGBASEDIR/ghc-pkg --global-package-db=$PKGCONFDIR"
# for a ghc build use the new ghc-pkg
INPLACE_GHCPKG=$PKGBASEDIR/../../bin/ghc-pkg-$GHC_VER
if [ -x "$INPLACE_GHCPKG" ]; then
case $GHC_VER in
7.8.*)
GHC_PKG="$PKGBASEDIR/bin/ghc-pkg --global-package-db=$PKGCONFDIR"
;;
7.6.*)
GHC_PKG="$PKGBASEDIR/ghc-pkg --global-package-db=$PKGCONFDIR"
;;
*)
GHC_PKG="$PKGBASEDIR/ghc-pkg --global-conf=$PKGCONFDIR"
;;
esac
else
GHC_PKG="/usr/bin/ghc-pkg-${GHC_VER}"
fi
@ -69,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
@ -80,5 +85,3 @@ for i in $files; do
fi
fi
done
echo $files | tr [:blank:] '\n' | /usr/lib/rpm/rpmdeps $MODE

View File

@ -6,8 +6,8 @@
#%%global without_hscolour 1
Name: ghc-rpm-macros
Version: 1.2.13
Release: 2%{?dist}
Version: 1.2.20
Release: 1%{?dist}
Summary: RPM macros for building packages for GHC
License: GPLv3+
@ -24,9 +24,13 @@ Source3: ghc-deps.sh
Source4: cabal-tweak-dep-ver
Source5: cabal-tweak-flag
Source6: macros.ghc-extra
Source7: ghc_bin.attr
Source8: ghc_lib.attr
Requires: ghc-srpm-macros
# macros.ghc-srpm moved out from redhat-rpm-config-21
Requires: redhat-rpm-config > 20-1.fc21
# for ghc_version
Requires: ghc-compiler
%if %{undefined without_hscolour}
%ifarch %{ix86} %{ix86} x86_64 ppc ppc64 alpha sparcv9 armv7hl armv5tel s390 s390x ppc64le aarch64
Requires: hscolour
@ -66,11 +70,12 @@ install -p -D -m 0644 %{SOURCE0} %{buildroot}/%{macros_dir}/macros.ghc
install -p -D -m 0644 %{SOURCE6} %{buildroot}/%{macros_dir}/macros.ghc-extra
install -p -D -m 0755 %{SOURCE3} %{buildroot}/%{_prefix}/lib/rpm/ghc-deps.sh
install -p -D -m 0644 %{SOURCE7} %{buildroot}/%{_prefix}/lib/rpm/fileattrs/ghc_bin.attr
install -p -D -m 0644 %{SOURCE8} %{buildroot}/%{_prefix}/lib/rpm/fileattrs/ghc_lib.attr
install -p -D -m 0755 %{SOURCE4} %{buildroot}/%{_bindir}/cabal-tweak-dep-ver
install -p -D -m 0755 %{SOURCE5} %{buildroot}/%{_bindir}/cabal-tweak-flag
# this is why this package is now arch-dependent:
# turn off shared libs and dynamic linking on secondary archs
%ifnarch %{ix86} x86_64
cat >> %{buildroot}/%{macros_dir}/macros.ghc <<EOF
@ -85,6 +90,8 @@ EOF
%files
%doc COPYING AUTHORS
%{macros_dir}/macros.ghc
%{_prefix}/lib/rpm/fileattrs/ghc_bin.attr
%{_prefix}/lib/rpm/fileattrs/ghc_lib.attr
%{_prefix}/lib/rpm/ghc-deps.sh
%{_bindir}/cabal-tweak-dep-ver
%{_bindir}/cabal-tweak-flag
@ -95,6 +102,47 @@ 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
- correct cabal-tweak-flag error message for missing flag (#1184508)
- revert to versioned doc htmldirs
* Mon Jan 19 2015 Jens Petersen <petersen@redhat.com> - 1.2.18-1
- exclude -Wall from CFLAGS to prevent Cabal configure warning with ghc-7.6
(#1175667)
* Fri Nov 14 2014 Jens Petersen <petersen@redhat.com> - 1.2.17-1
- split ghc.attr into ghc_lib.attr and ghc_bin.attr for finer grained handling
- require ghc-compiler for ghc_version
- macros.ghc: cabal_configure now passes CFLAGS and LDFLAGS to ghc (#1138982)
(thanks to Sergei Trofimovich and Ville Skyttä)
- ghc-deps.sh: support ghc-pkg for ghc builds <= 7.4.2 as well
* Thu Oct 16 2014 Jens Petersen <petersen@redhat.com> - 1.2.16-1
- ghc.attr needs to handle requires for /usr/bin files too
* Wed Sep 10 2014 Jens Petersen <petersen@redhat.com> - 1.2.15-1
- improve ghc_fix_dynamic_rpath not to assume cwd = pkg_name
- drop -O2: it often uses too much build mem
- add an rpm .attr file for ghc-deps.sh rather than running it
as an external dep generator (#1132275)
(see http://rpm.org/wiki/PackagerDocs/DependencyGenerator)
* Wed Aug 20 2014 Jens Petersen <petersen@redhat.com> - 1.2.14-1
- fix warning in macros.ghc-extra about unused pkgnamever
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.13-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Fri Jun 27 2014 Jens Petersen <petersen@redhat.com> - 1.2.13-2
- ghc-srpm-macros is now a separate source package

3
ghc_bin.attr Normal file
View File

@ -0,0 +1,3 @@
%__ghc_bin_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}
%__ghc_bin_magic executable, .* dynamically linked
%__ghc_bin_flags exeonly

3
ghc_lib.attr Normal file
View File

@ -0,0 +1,3 @@
%__ghc_lib_provides %{_rpmconfigdir}/ghc-deps.sh --provides %{buildroot}%{ghclibdir}
%__ghc_lib_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}
%__ghc_lib_path ^%{ghclibdir}/.*/libHS.*\\.(so|a)$

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
@ -21,17 +22,37 @@ fi
# configure
%cabal_configure\
%ghc_check_bootstrap\
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{?_pkgdocdir}%{!?_pkgdocdir:%{_docdir}/%{name}-%{version}} --libsubdir='$compiler/$pkgid' --datasubdir='$pkgid' --ghc %{!?ghc_without_dynamic:--enable-executable-dynamic} --ghc-option=-O2 %{?with_tests:--enable-tests} %{?cabal_configure_options} $cabal_configure_extra_options
CFLAGS="${CFLAGS:-%optflags}"; export CFLAGS\
LDFLAGS="${LDFLAGS:-%__global_ldflags}"; export LDFLAGS\
%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
# root dir for ghc docs
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
%ghcdocbasedir %{_docdir}/ghc/html
# libraries doc dir
# libraries doc dir (internal)
%ghc_html_libraries_dir %{ghc_html_dir}/libraries
# deprecates
%ghclibdocdir %{ghcdocbasedir}/libraries
# pkg doc dir
%ghcpkgdocdir %{ghcdocbasedir}/libraries/%{pkg_name}
%ghc_html_pkg_dir %{ghc_html_libraries_dir}/%{pkg_name}-%{version}
# deprecates
%ghcpkgdocdir %{ghclibdocdir}/%{pkg_name}-%{version}
# top library dir
%ghclibdir %{_libdir}/ghc-%{ghc_version}
@ -42,8 +63,9 @@ fi
%define pkgnamever %{pkgname}-%{pkgver}\
%define basepkg ghc-%{pkgname}\
%define pkgdir %{ghclibdir}/%{pkgnamever}\
%define docdir %{ghclibdocdir}/%{pkgname}\
%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}\
@ -87,7 +109,7 @@ install -D --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.
# 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} %{?pkg_name:--htmldir=%{ghclibdocdir}/%{pkg_name}} %{?1:--docdir=%{_docdir}/ghc-%1%{!?fedora:-%2} --htmldir=%{ghclibdocdir}/%1} %{!?1:--global} %{?ghc_with_lib_for_ghci:--enable-library-for-ghci}\
%cabal_configure %{!?without_prof:-p} %{!?ghc_without_shared:--enable-shared} %{?pkg_name:--htmldir=%{ghclibdocdir}/%{pkg_name}-%{version}} %{?1:--docdir=%{_docdir}/ghc-%1%{!?fedora:-%2} --htmldir=%{ghclibdocdir}/%1-%2} %{!?1:--global} %{?ghc_with_lib_for_ghci:--enable-library-for-ghci}\
%cabal build\
%{nil}
@ -95,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}
@ -113,8 +139,6 @@ fi
# install bin package
%ghc_bin_install()\
%global _use_internal_dependency_generator 0\
%global __find_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}\
%cabal_install\
%{!?1:%ghc_strip_dynlinked}\
%{!?1:%ghc_clear_execstack}\
@ -122,9 +146,6 @@ fi
# ghc_lib_install [name] [version]
%ghc_lib_install()\
%global _use_internal_dependency_generator 0\
%global __find_provides %{_rpmconfigdir}/ghc-deps.sh --provides %{buildroot}%{ghclibdir}\
%global __find_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}\
%cabal_install\
%cabal_pkg_conf\
%ghc_gen_filelists\
@ -133,18 +154,20 @@ fi
%{nil}
# ghc_fix_dynamic_rpath prog ...
# (assumes cwd = pkg_name!)
%ghc_fix_dynamic_rpath()\
%if %{undefined ghc_without_dynamic}\
if ! type chrpath > /dev/null; then exit 1; fi\
PDIR=$(cd ..; pwd)\
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@%{ghclibdir}@g" -e "s@/dist/build@@g")\
NEWRPATH=$(echo $RPATH | sed -e "s@$PDIR/dist/build@%{ghclibdir}/%{pkg_name}-%{version}@g")\
chrpath -r $NEWRPATH $PROG\
;;\
esac\
@ -156,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

View File

@ -4,8 +4,7 @@
%ghc_lib_subpackage(c:l:x)\
%define pkgname %{?1}%{!?1:%{pkg_name}}\
%define pkgver %{?2}%{!?2:%{version}}\
%define pkgnamever %{pkgname}-%{pkgver}\
%{!-x:%{?1:%global ghc_packages_list %{?ghc_packages_list} %{pkgnamever}}}\
%{!-x:%{?1:%global ghc_packages_list %{?ghc_packages_list} %{pkgname}-%{pkgver}}}\
%define basepkg ghc-%{pkgname}\
%package -n %{basepkg}\
Summary: Haskell %{pkgname} library\