Compare commits

...

6 Commits
master ... f20

Author SHA1 Message Date
Jens Petersen 27813db9f9 rename ghc-rpm-macros.ghc* to macros.ghc* 2015-01-22 16:55:18 +09:00
Jens Petersen 579a14565d various minor backports
- 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)
- ghc-deps.sh: support ghc-pkg for ghc builds <= 7.4.2 as well
- improve ghc_fix_dynamic_rpath not to assume cwd = pkg_name
- fix warning in macros.ghc-extra about unused pkgnamever
2015-01-22 16:53:13 +09:00
Jens Petersen 26bbb3510b bcond --enable-tests, -O2 everywhere, GPLv3+, use _rpmconfigdir,
backport recent changes from Rawhide:
- do bcond cabal configure --enable-tests also for Bin packages
- enable configure bcond check for tests
- use -O2 also for executable (Bin) packages and allow it to be overrided
- set Url field when generating subpackages
- update license tag to GPLv3+
- handle no _pkgdocdir in RHEL7 and docdir path different to F20+
- abort ghc_fix_dynamic_rpath if no chrpath
- Install macros to %%{_rpmconfigdir}/macros.d. (Ville Skyttä)
- set datasubdir in cabal_configure for ghc-7.8

note -O2 has known issues with the ghc-7.6 llvm backend
where it sometimes backfires (eg pandoc)
2014-05-17 12:51:01 +09:00
Jens Petersen 0be5b40270 backport ghc-deps.sh support for ghc-7.8 and cabal-tweak-flag manual field
- ghc_fix_dynamic_rpath: abort for non-existent executable name with error msg
- cabal-tweak-flag: add manual field to enforce flag changes
- ghc-deps.sh fixes for bootstrapping new ghc version
  - use objdump -p instead of ldd to read executable dependencies
  - update for ghc-7.8 rts
2014-02-04 12:55:27 +09:00
Jens Petersen c3e1d45228 ghcpkgdocdir should be versioned for F20 and earlier 2013-10-25 17:09:26 +09:00
Jens Petersen d449f876b5 add ghcpkgdocdir and drop ghc_docdir 2013-10-25 16:52:22 +09:00
5 changed files with 101 additions and 41 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
@ -47,4 +47,4 @@ if [ ! -f $CABALFILE.orig ]; then
BACKUP=.orig
fi
sed -i$BACKUP -e "/[Ff]lag *$FLAG/,/[Dd]efault: *$OLD/ s/\([Dd]efault: *\)$OLD/\1$NEW/" $CABALFILE
sed -i$BACKUP -e "/[Ff]lag *$FLAG/,/[Dd]efault: *$OLD/ s/\( \+\)\([Dd]efault:[ \t]*\)$OLD/\1\2$NEW\n\1manual: True/" $CABALFILE

View File

@ -8,15 +8,30 @@
[ $# -ne 2 ] && echo "Usage: `basename $0` [--provides|--requires] %{buildroot}%{ghclibdir}" && exit 1
set +x
MODE=$1
PKGBASEDIR=$2
PKGCONFDIR=$PKGBASEDIR/package.conf.d
GHC_VER=$(basename $PKGBASEDIR | sed -e s/ghc-//)
if [ ! -x "/usr/bin/ghc-pkg-${GHC_VER}" -a -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_PKG="/usr/bin/ghc-pkg-${GHC_VER}"
fi
case $MODE in
@ -29,14 +44,10 @@ if [ -d "$PKGBASEDIR" ]; then
SHARED=$(find $PKGBASEDIR -type f -name '*.so')
fi
GHCVERSION=$(ghc --numeric-version)
files=$(cat)
#set -x
for i in $files; do
LIB_FILE=$(echo $i | grep /libHS | egrep -v "$PKGBASEDIR/libHS")
LIB_FILE=$(echo $i | grep /libHS | egrep -v "/libHSrts")
if [ "$LIB_FILE" ]; then
if [ -d "$PKGCONFDIR" ]; then
META=""
@ -68,7 +79,7 @@ for i in $files; do
fi
elif [ "$MODE" = "--requires" ]; then
if file $i | grep -q 'executable, .* dynamically linked'; then
BIN_DEPS=$(ldd $i | grep libHS | grep -v libHSrts | sed -e "s%^\\tlibHS\(.*\)-ghc${GHCVERSION}.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

View File

@ -1,29 +1,29 @@
%global debug_package %{nil}
%global macros_dir %{_sysconfdir}/rpm
%global macros_dir %{_rpmconfigdir}/macros.d
# uncomment to bootstrap without hscolour
#%%global without_hscolour 1
Name: ghc-rpm-macros
Version: 1.0.7
Version: 1.0.7.4
Release: 1%{?dist}
Summary: RPM macros for building packages for GHC
License: GPLv3
License: GPLv3+
URL: https://fedoraproject.org/wiki/Packaging:Haskell
# This is a Fedora maintained package, originally made for
# the distribution. Hence the source is currently only available
# from this package. But it could be hosted on fedorahosted.org
# for example if other rpm distros would prefer that.
Source0: ghc-rpm-macros.ghc
Source0: macros.ghc
Source1: COPYING
Source2: AUTHORS
Source3: ghc-deps.sh
Source4: cabal-tweak-dep-ver
Source5: cabal-tweak-flag
Source6: ghc-rpm-macros.ghc-extra
Source6: macros.ghc-extra
# ver-rel for unversioned docdir
Requires: redhat-rpm-config >= 9.1.0-50.fc20
%if %{undefined without_hscolour}
@ -41,10 +41,12 @@ these macros.
%package extra
Summary: Extra RPM macros for building Haskell packages with several libs
Summary: Extra RPM macros for building Haskell library subpackages
Requires: %{name} = %{version}-%{release}
%description extra
Extra macros used for subpackaging of Haskell libraries,
for example in ghc and haskell-platform.
%prep
@ -57,15 +59,14 @@ echo no build stage needed
%install
install -p -D -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{macros_dir}/macros.ghc
install -p -D -m 0644 %{SOURCE6} ${RPM_BUILD_ROOT}/%{macros_dir}/macros.ghc-extra
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 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
@ -90,11 +91,45 @@ EOF
%changelog
* Thu Jan 22 2015 Jens Petersen <petersen@redhat.com>
- 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)
- ghc-deps.sh: support ghc-pkg for ghc builds <= 7.4.2 as well
- improve ghc_fix_dynamic_rpath not to assume cwd = pkg_name
- fix warning in macros.ghc-extra about unused pkgnamever
* Sat May 17 2014 Jens Petersen <petersen@redhat.com> - 1.0.7.4-1
- do bcond cabal configure --enable-tests also for Bin packages
- enable configure bcond check for tests
- use -O2 also for executable (Bin) packages and allow it to be overrided
- set Url field when generating subpackages
- update license tag to GPLv3+
- handle no _pkgdocdir in RHEL7 and docdir path different to F20+
- abort ghc_fix_dynamic_rpath if no chrpath
- Install macros to %%{_rpmconfigdir}/macros.d.
- set datasubdir in cabal_configure for ghc-7.8
* Tue Feb 4 2014 Jens Petersen <petersen@redhat.com> - 1.0.7.3-1
- quote the ghc_fix_dynamic_rpath error message
- ghc_fix_dynamic_rpath: abort for non-existent executable name
- cabal-tweak-flag: add manual field to enforce flag changes
- ghc-deps.sh: fix ghc-pkg path when bootstrapping new ghc version
- fix ghc-deps.sh when bootstrapping a new ghc version
- use objdump -p instead of ldd to read executable dependencies
- update ghc-deps.sh to handling ghc-7.8 rts
* Fri Oct 25 2013 Jens Petersen <petersen@redhat.com> - 1.0.7.2-1
- ghcpkgdocdir should be versioned (for F20 and earlier)
* Fri Oct 25 2013 Jens Petersen <petersen@redhat.com> - 1.0.7.1-1
- add ghcpkgdocdir, which like _pkgdocdir allows for unversioned haddock dirs
- drop ghc_docdir in favor of _pkgdocdir
* Fri Jul 26 2013 Jens Petersen <petersen@redhat.com> - 1.0.7-1
- add ghc_docdir for package's docdir since not provided by standard macros
* Fri Jul 26 2013 Jens Petersen <petersen@redhat.com> - 1.0.6-1
- also make %ghc_lib_build docdir unversioned
- also make %%ghc_lib_build docdir unversioned
- require redhat-rpm-config >= 9.1.0-50.fc20 for unversioned docdir
* Fri Jul 26 2013 Jens Petersen <petersen@redhat.com> - 1.0.5-1

View File

@ -21,17 +21,26 @@ fi
# configure
%cabal_configure\
%ghc_check_bootstrap\
%cabal configure --prefix=%{_prefix} --libdir=%{_libdir} --docdir=%{ghc_docdir} --libsubdir='$compiler/$pkgid' --ghc %{!?ghc_without_dynamic:--enable-executable-dynamic} %{?cabal_configure_options} $cabal_configure_extra_options
%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
# install
%cabal_install %cabal copy --destdir=%{buildroot} -v
# F20 has unversioned docdir's
%ghc_docdir %{_docdir}/%{name}
# root dir for ghc docs
# 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
%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}
@ -75,8 +84,7 @@ done\
%define pkgver %{?2}%{!?2:%{version}}\
%define pkgnamever %{pkgname}-%{pkgver}\
%cabal register --gen-pkg-config\
mkdir -p %{buildroot}%{ghclibdir}/package.conf.d\
install --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.d\
install -D --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.d/%{pkgnamever}.conf\
%{nil}
# ghc_bin_build
@ -88,7 +96,7 @@ install --mode=0644 %{pkgnamever}.conf %{buildroot}%{ghclibdir}/package.conf.d\
# 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}-%{version}} %{?1:--docdir=%{_docdir}/ghc-%1 --htmldir=%{ghclibdocdir}/%1-%2} %{!?1:--global} %{?ghc_with_lib_for_ghci:--enable-library-for-ghci} --ghc-option=-O2\
%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}
@ -108,8 +116,8 @@ find %{buildroot} -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \
# ghc_clear_execstack
%ghc_clear_execstack\
if [ -d "%{buildroot}%{_bindir}" ]; then\
find %{buildroot}%{_bindir} -type f -exec sh -c "file {} | grep -q ' ELF '" \\; -exec execstack -c "{}" \\;\
if [ -d "%{buildroot}%{_bindir}" -a -x "%{_bindir}/execstack" ]; then\
find %{buildroot}%{_bindir} -type f -exec sh -c "file {} | grep -q ' ELF '" \\; -exec %{_bindir}/execstack -c "{}" \\;\
fi
# install bin package
@ -136,16 +144,22 @@ fi
# ghc_fix_dynamic_rpath prog ...
%ghc_fix_dynamic_rpath()\
%if %{undefined ghc_without_dynamic}\
PDIR=$(cd ..; pwd)\
if ! type chrpath > /dev/null; then exit 1; fi\
PDIR=$(pwd)\
for i in %*; do\
PROG=%{buildroot}%{_bindir}/$i\
RPATH=$(chrpath $PROG| sed -e "s@^$PROG: RPATH=@@")\
case $RPATH in\
*$PDIR*)\
NEWRPATH=$(echo $RPATH | sed -e "s@$PDIR@%{ghclibdir}@g" -e "s@/dist/build@@g")\
chrpath -r $NEWRPATH $PROG\
;;\
esac\
if [ -x "$PROG" ]; then\
RPATH=$(chrpath $PROG | sed -e "s@^$PROG: RPATH=@@")\
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"\
exit 1\
fi\
done\
%endif\
%{nil}

View File

@ -4,13 +4,13 @@
%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\
%{?1:Version: %{pkgver}}\
%{-l:License: %{-l*}}\
Url: http://hackage.haskell.org/package/%{pkgname}\
%{?ghc_pkg_obsoletes:Obsoletes: %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1/g")}\
\
%description -n %{basepkg}\