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
This commit is contained in:
parent
cab483029e
commit
5517c1f361
4
AUTHORS
4
AUTHORS
@ -5,3 +5,7 @@ Initial implementation:
|
||||
Bryan O'Sullivan
|
||||
Jens Petersen
|
||||
Yaakov Nemoy
|
||||
|
||||
Contributions from:
|
||||
Peter Trommler
|
||||
Ondřej Súkup
|
||||
|
30
cabal-tweak-drop-dep
Executable file
30
cabal-tweak-drop-dep
Executable file
@ -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
|
23
ghc-deps.sh
23
ghc-deps.sh
@ -5,15 +5,15 @@
|
||||
|
||||
set +x
|
||||
|
||||
MODE=$1
|
||||
PKGBASEDIR=$2
|
||||
PKGCONFDIR=$PKGBASEDIR/package.conf.d
|
||||
mode=$1
|
||||
pkgbasedir=$2
|
||||
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
|
||||
--provides) FIELD=id ;;
|
||||
--requires) FIELD=depends ;;
|
||||
case $mode in
|
||||
--provides) field=id ;;
|
||||
--requires) field=depends ;;
|
||||
*) echo "`basename $0`: Need --provides or --requires" ; exit 1
|
||||
esac
|
||||
|
||||
@ -22,10 +22,11 @@ files=$(cat)
|
||||
for i in $files; do
|
||||
case $i in
|
||||
# exclude builtin_rts.conf
|
||||
$PKGCONFDIR/*-*.conf)
|
||||
PKGVER=$(echo $i | sed -e "s%$PKGCONFDIR/\(.\+\)-.\+.conf%\1%")
|
||||
OUT=$($GHC_PKG field $PKGVER $FIELD | sed -e "s/rts//" -e "s/bin-package-db-[^ ]\+//")
|
||||
for d in $OUT; do
|
||||
$pkgconfdir/*-*.conf)
|
||||
pkgver=$(echo $i | sed -e "s%$pkgconfdir/\(.\+\)-.\+.conf%\1%")
|
||||
ids=$($ghc_pkg field $pkgver $field | sed -e "s/rts//" -e "s/bin-package-db-[^ ]\+//")
|
||||
|
||||
for d in $ids; do
|
||||
case $d in
|
||||
*-*) echo "ghc-devel($d)" ;;
|
||||
*) ;;
|
||||
|
@ -29,4 +29,4 @@ else
|
||||
GHC_PKG="/usr/bin/ghc-pkg-${GHC_VER} -f $PKGCONFDIR"
|
||||
fi
|
||||
|
||||
$GHC_PKG -v0 --simple-output --global $*
|
||||
$GHC_PKG -v0 --simple-output --global $* | uniq
|
||||
|
@ -10,8 +10,8 @@
|
||||
#%%global without_hscolour 1
|
||||
|
||||
Name: ghc-rpm-macros
|
||||
Version: 1.6.11
|
||||
Release: 2%{?dist}
|
||||
Version: 1.6.12
|
||||
Release: 1%{?dist}
|
||||
Summary: RPM macros for building Haskell packages for GHC
|
||||
|
||||
License: GPLv3+
|
||||
@ -26,6 +26,8 @@ Source5: cabal-tweak-flag
|
||||
Source6: macros.ghc-extra
|
||||
Source7: ghc.attr
|
||||
Source8: ghc-pkg-wrapper
|
||||
Source9: macros.ghc-fedora
|
||||
Source11: cabal-tweak-drop-dep
|
||||
Requires: redhat-rpm-config
|
||||
# for ghc_version
|
||||
Requires: ghc-compiler
|
||||
@ -99,6 +101,7 @@ echo no build stage needed
|
||||
%install
|
||||
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 %{SOURCE9} %{buildroot}/%{macros_dir}/macros.ghc-fedora
|
||||
|
||||
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 %{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
|
||||
|
||||
%if 0%{?rhel} && 0%{?rhel} < 7
|
||||
@ -122,12 +126,14 @@ EOF
|
||||
%license COPYING
|
||||
%doc AUTHORS
|
||||
%{macros_dir}/macros.ghc
|
||||
%{macros_dir}/macros.ghc-fedora
|
||||
%if 0%{?fedora} || 0%{?rhel} >= 7
|
||||
%{_prefix}/lib/rpm/fileattrs/ghc.attr
|
||||
%endif
|
||||
%{_prefix}/lib/rpm/ghc-deps.sh
|
||||
%{_prefix}/lib/rpm/ghc-pkg-wrapper
|
||||
%{_bindir}/cabal-tweak-dep-ver
|
||||
%{_bindir}/cabal-tweak-drop-dep
|
||||
%{_bindir}/cabal-tweak-flag
|
||||
|
||||
|
||||
@ -141,6 +147,16 @@ EOF
|
||||
|
||||
|
||||
%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
|
||||
- add more F25 obsoletes for: editline, hashed-storage, nats, primes
|
||||
|
||||
|
58
macros.ghc
58
macros.ghc
@ -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_verbose}
|
||||
%cabal build %{?cabal_build_options}
|
||||
|
||||
# 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_verbose}\
|
||||
%cabal build %{?cabal_build_options}\
|
||||
%{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\
|
||||
|
@ -51,13 +51,13 @@ This package provides the Haskell %{pkgname} library development files.\
|
||||
%postun -n %{basepkg}-devel\
|
||||
%ghc_pkg_recache\
|
||||
\
|
||||
%files -n %{basepkg} -f %{basepkg}.files\
|
||||
%files -n %{basepkg} -f ../%{pkgname}-%{pkgver}/%{basepkg}.files\
|
||||
%if 0%{?rhel} && 0%{?rhel} < 7\
|
||||
%defattr(-,root,root,-)\
|
||||
%endif\
|
||||
%{?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\
|
||||
%defattr(-,root,root,-)\
|
||||
%endif\
|
||||
@ -94,7 +94,6 @@ cd $i\
|
||||
name=$(echo $i | sed -e "s/\\(.*\\)-.*/\\1/")\
|
||||
ver=$(echo $i | sed -e "s/.*-\\(.*\\)/\\1/")\
|
||||
%ghc_lib_install $name $ver\
|
||||
mv *.files ..\
|
||||
cd ..\
|
||||
done\
|
||||
%ghc_fix_rpath $args\
|
||||
|
5
macros.ghc-fedora
Normal file
5
macros.ghc-fedora
Normal file
@ -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
|
||||
eval $(grep VERSION_ID /etc/os-release)
|
||||
case $VERSION_ID in
|
||||
22) BRANCH=master ;;
|
||||
26) BRANCH=master ;;
|
||||
7.*) BRANCH=epel7 ;;
|
||||
*) BRANCH="f$VERSION_ID" ;;
|
||||
esac
|
||||
|
Loading…
Reference in New Issue
Block a user