new cabal-tweak-drop-dep and other merges from github

- no longer use a topdir for subpackage building
- only autopackage license if subpackaging
- move uniq to ghc-pkg-wrapper
- add macros.ghc-fedora for Fedora specific config
- replace cabal_verbose with cabal_configure_verbose, cabal_build_verbose,
  cabal_install_verbose, cabal_haddock_verbose, and cabal_test_verbose
- new _ghcdocdir
epel9
Jens Petersen 8 years ago
parent cab483029e
commit 5517c1f361

@ -5,3 +5,7 @@ Initial implementation:
Bryan O'Sullivan Bryan O'Sullivan
Jens Petersen Jens Petersen
Yaakov Nemoy Yaakov Nemoy
Contributions from:
Peter Trommler
Ondřej Súkup

@ -0,0 +1,30 @@
#!/bin/sh
set -e +x
USAGE="Usage: $0 dep"
if [ $# -ne 1 ]; then
echo "$USAGE"
exit 1
fi
DEP=$1
CABALFILE=$(ls *.cabal)
if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then
echo "There needs to be one .cabal file in the current dir!"
exit 1
fi
if [ ! -f $CABALFILE.orig ]; then
BACKUP=.orig
fi
if grep $DEP $CABALFILE | sed -e "s/$DEP//" | grep -q -e "[A-Za-z]"; then
echo "$0: deleting whole $DEP lines not safe - try more precise pattern"
exit 1
fi
sed -i$BACKUP -e "/$DEP/d" $CABALFILE

@ -5,15 +5,15 @@
set +x set +x
MODE=$1 mode=$1
PKGBASEDIR=$2 pkgbasedir=$2
PKGCONFDIR=$PKGBASEDIR/package.conf.d pkgconfdir=$pkgbasedir/package.conf.d
GHC_PKG="/usr/lib/rpm/ghc-pkg-wrapper $PKGBASEDIR" ghc_pkg="/usr/lib/rpm/ghc-pkg-wrapper $pkgbasedir"
case $MODE in case $mode in
--provides) FIELD=id ;; --provides) field=id ;;
--requires) FIELD=depends ;; --requires) field=depends ;;
*) echo "`basename $0`: Need --provides or --requires" ; exit 1 *) echo "`basename $0`: Need --provides or --requires" ; exit 1
esac esac
@ -22,10 +22,11 @@ files=$(cat)
for i in $files; do for i in $files; do
case $i in case $i in
# exclude builtin_rts.conf # exclude builtin_rts.conf
$PKGCONFDIR/*-*.conf) $pkgconfdir/*-*.conf)
PKGVER=$(echo $i | sed -e "s%$PKGCONFDIR/\(.\+\)-.\+.conf%\1%") pkgver=$(echo $i | sed -e "s%$pkgconfdir/\(.\+\)-.\+.conf%\1%")
OUT=$($GHC_PKG field $PKGVER $FIELD | sed -e "s/rts//" -e "s/bin-package-db-[^ ]\+//") ids=$($ghc_pkg field $pkgver $field | sed -e "s/rts//" -e "s/bin-package-db-[^ ]\+//")
for d in $OUT; do
for d in $ids; do
case $d in case $d in
*-*) echo "ghc-devel($d)" ;; *-*) echo "ghc-devel($d)" ;;
*) ;; *) ;;

@ -29,4 +29,4 @@ else
GHC_PKG="/usr/bin/ghc-pkg-${GHC_VER} -f $PKGCONFDIR" GHC_PKG="/usr/bin/ghc-pkg-${GHC_VER} -f $PKGCONFDIR"
fi fi
$GHC_PKG -v0 --simple-output --global $* $GHC_PKG -v0 --simple-output --global $* | uniq

@ -10,8 +10,8 @@
#%%global without_hscolour 1 #%%global without_hscolour 1
Name: ghc-rpm-macros Name: ghc-rpm-macros
Version: 1.6.11 Version: 1.6.12
Release: 2%{?dist} Release: 1%{?dist}
Summary: RPM macros for building Haskell packages for GHC Summary: RPM macros for building Haskell packages for GHC
License: GPLv3+ License: GPLv3+
@ -26,6 +26,8 @@ Source5: cabal-tweak-flag
Source6: macros.ghc-extra Source6: macros.ghc-extra
Source7: ghc.attr Source7: ghc.attr
Source8: ghc-pkg-wrapper Source8: ghc-pkg-wrapper
Source9: macros.ghc-fedora
Source11: cabal-tweak-drop-dep
Requires: redhat-rpm-config Requires: redhat-rpm-config
# for ghc_version # for ghc_version
Requires: ghc-compiler Requires: ghc-compiler
@ -99,6 +101,7 @@ echo no build stage needed
%install %install
install -p -D -m 0644 %{SOURCE0} %{buildroot}/%{macros_dir}/macros.ghc 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 0644 %{SOURCE6} %{buildroot}/%{macros_dir}/macros.ghc-extra
install -p -D -m 0644 %{SOURCE9} %{buildroot}/%{macros_dir}/macros.ghc-fedora
install -p -D -m 0755 %{SOURCE3} %{buildroot}/%{_prefix}/lib/rpm/ghc-deps.sh install -p -D -m 0755 %{SOURCE3} %{buildroot}/%{_prefix}/lib/rpm/ghc-deps.sh
@ -108,6 +111,7 @@ install -p -D -m 0644 %{SOURCE7} %{buildroot}/%{_prefix}/lib/rpm/fileattrs/ghc.a
install -p -D -m 0755 %{SOURCE4} %{buildroot}/%{_bindir}/cabal-tweak-dep-ver install -p -D -m 0755 %{SOURCE4} %{buildroot}/%{_bindir}/cabal-tweak-dep-ver
install -p -D -m 0755 %{SOURCE5} %{buildroot}/%{_bindir}/cabal-tweak-flag install -p -D -m 0755 %{SOURCE5} %{buildroot}/%{_bindir}/cabal-tweak-flag
install -p -D -m 0755 %{SOURCE11} %{buildroot}/%{_bindir}/cabal-tweak-drop-dep
install -p -D -m 0755 %{SOURCE8} %{buildroot}/%{_prefix}/lib/rpm/ghc-pkg-wrapper install -p -D -m 0755 %{SOURCE8} %{buildroot}/%{_prefix}/lib/rpm/ghc-pkg-wrapper
%if 0%{?rhel} && 0%{?rhel} < 7 %if 0%{?rhel} && 0%{?rhel} < 7
@ -122,12 +126,14 @@ EOF
%license COPYING %license COPYING
%doc AUTHORS %doc AUTHORS
%{macros_dir}/macros.ghc %{macros_dir}/macros.ghc
%{macros_dir}/macros.ghc-fedora
%if 0%{?fedora} || 0%{?rhel} >= 7 %if 0%{?fedora} || 0%{?rhel} >= 7
%{_prefix}/lib/rpm/fileattrs/ghc.attr %{_prefix}/lib/rpm/fileattrs/ghc.attr
%endif %endif
%{_prefix}/lib/rpm/ghc-deps.sh %{_prefix}/lib/rpm/ghc-deps.sh
%{_prefix}/lib/rpm/ghc-pkg-wrapper %{_prefix}/lib/rpm/ghc-pkg-wrapper
%{_bindir}/cabal-tweak-dep-ver %{_bindir}/cabal-tweak-dep-ver
%{_bindir}/cabal-tweak-drop-dep
%{_bindir}/cabal-tweak-flag %{_bindir}/cabal-tweak-flag
@ -141,6 +147,16 @@ EOF
%changelog %changelog
* Wed Feb 8 2017 Jens Petersen <petersen@redhat.com> - 1.6.12-1
- no longer use a topdir for subpackage building
- only autopackage license if subpackaging
- add new cabal-tweak-drop-dep script for excluding trivial deps
- move uniq to ghc-pkg-wrapper
- add macros.ghc-fedora for Fedora specific config
- replace cabal_verbose with cabal_configure_verbose, cabal_build_verbose,
cabal_install_verbose, cabal_haddock_verbose, and cabal_test_verbose
- new _ghcdocdir
* Fri Dec 2 2016 Jens Petersen <petersen@redhat.com> - 1.6.11-2 * Fri Dec 2 2016 Jens Petersen <petersen@redhat.com> - 1.6.11-2
- add more F25 obsoletes for: editline, hashed-storage, nats, primes - add more F25 obsoletes for: editline, hashed-storage, nats, primes

@ -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_verbose} %cabal build %{?cabal_build_options}
# 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_verbose}\ %cabal build %{?cabal_build_options}\
%{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\

@ -51,13 +51,13 @@ This package provides the Haskell %{pkgname} library development files.\
%postun -n %{basepkg}-devel\ %postun -n %{basepkg}-devel\
%ghc_pkg_recache\ %ghc_pkg_recache\
\ \
%files -n %{basepkg} -f %{basepkg}.files\ %files -n %{basepkg} -f ../%{pkgname}-%{pkgver}/%{basepkg}.files\
%if 0%{?rhel} && 0%{?rhel} < 7\ %if 0%{?rhel} && 0%{?rhel} < 7\
%defattr(-,root,root,-)\ %defattr(-,root,root,-)\
%endif\ %endif\
%{?base_doc_files:%doc %base_doc_files}\ %{?base_doc_files:%doc %base_doc_files}\
\ \
%files -n %{basepkg}-devel -f %{basepkg}-devel.files\ %files -n %{basepkg}-devel -f ../%{pkgname}-%{pkgver}/%{basepkg}-devel.files\
%if 0%{?rhel} && 0%{?rhel} < 7\ %if 0%{?rhel} && 0%{?rhel} < 7\
%defattr(-,root,root,-)\ %defattr(-,root,root,-)\
%endif\ %endif\
@ -94,7 +94,6 @@ cd $i\
name=$(echo $i | sed -e "s/\\(.*\\)-.*/\\1/")\ name=$(echo $i | sed -e "s/\\(.*\\)-.*/\\1/")\
ver=$(echo $i | sed -e "s/.*-\\(.*\\)/\\1/")\ ver=$(echo $i | sed -e "s/.*-\\(.*\\)/\\1/")\
%ghc_lib_install $name $ver\ %ghc_lib_install $name $ver\
mv *.files ..\
cd ..\ cd ..\
done\ done\
%ghc_fix_rpath $args\ %ghc_fix_rpath $args\

@ -0,0 +1,5 @@
# Fedora specific settings
%_ghcdocdir %{?_defaultlicensedir}%{!?_defaultlicensedir:%_docdir}/%{name}
%cabal_install_options -v

@ -24,7 +24,7 @@ ARCH=$(arch)
if [ -f /etc/os-release ]; then if [ -f /etc/os-release ]; then
eval $(grep VERSION_ID /etc/os-release) eval $(grep VERSION_ID /etc/os-release)
case $VERSION_ID in case $VERSION_ID in
22) BRANCH=master ;; 26) BRANCH=master ;;
7.*) BRANCH=epel7 ;; 7.*) BRANCH=epel7 ;;
*) BRANCH="f$VERSION_ID" ;; *) BRANCH="f$VERSION_ID" ;;
esac esac

Loading…
Cancel
Save