backport ghc-deps.sh for unhashed auto deps; drop ghc_pkg_deps from ghc_package_devel and ghc_package_prof

This commit is contained in:
Jens Petersen 2011-05-08 23:29:21 +09:00
parent 15ee332aeb
commit 874310f1a5
3 changed files with 67 additions and 3 deletions

53
ghc-deps.sh Executable file
View File

@ -0,0 +1,53 @@
#!/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}%{ghcpkgbasedir}
[ $# -ne 2 ] && echo "Usage: `basename $0` --requires %{buildroot}" && exit 1
MODE=$1
PKGBASEDIR=$2
PKGCONFDIR=$PKGBASEDIR/package.conf.d
case $MODE in
--requires) FIELD=depends ;;
*) echo "`basename $0`: Need --requires" ; exit 1
esac
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")
if [ "$LIB_FILE" ]; then
if [ -d "$PKGCONFDIR" ]; then
DEP=""
case $LIB_FILE in
*.so) ;;
*_p.a) DEP=ghc-\\1-prof ;;
*.a) DEP=ghc-\\1-devel ;;
esac
if [ "$DEP" ]; then
PKGVER=$(echo $LIB_FILE | sed -e "s%$PKGBASEDIR/\([^/]\+\)/libHS.*%\1%")
HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER $FIELD | sed -e "s/^$FIELD: \+//")
for i in $HASHS; do
case $i in
*-*) echo $i | sed -e "s/\(.*\)-\(.*\)-.*/$DEP = \2/" ;;
*) ;;
esac
done
fi
fi
fi
done
echo $files | tr [:blank:] '\n' | /usr/lib/rpm/rpmdeps $MODE

View File

@ -138,13 +138,14 @@ This package provides the shared library.\
%define pkgver %{?2}%{!?2:%{version}}\
%define pkgnamever %{pkgname}-%{pkgver}\
%define basepkg ghc-%{pkgname}\
%global _use_internal_dependency_generator 0\
%global __find_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}\
%package -n %{basepkg}-devel\
Summary: %{?common_summary}%{!?common_summary:Haskell %{pkgname} library} development files\
Group: Development/Libraries\
%{?1:Version: %{pkgver}}\
%{-l:License: %{-l*}}\
%{?ghc_devel_requires}\
%{!-h:%{?ghc_pkg_deps:Requires: %{ghc_pkg_deps}}}\
%{-h:Requires: %{-h*}}\
%{!-c:%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}}\
%{-c:Requires: %{-c*}}\
@ -182,7 +183,6 @@ Group: Development/Libraries\
%{?1:Version: %{pkgver}}\
%{-l:License: %{-l*}}\
%{?ghc_prof_requires}\
%{!-h:%{?ghc_pkg_deps:Requires: %(echo "%{ghc_pkg_deps}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-prof/g")}}\
%{-h:Requires: %(echo "%{-h*}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-prof/g")}\
%{?ghc_pkg_obsoletes:Obsoletes: %(echo "%{ghc_pkg_obsoletes}" | sed -e "s/\\(ghc-[^, ]*\\)-devel/\\1-prof/g")}\
\

View File

@ -1,7 +1,7 @@
%global debug_package %{nil}
Name: ghc-rpm-macros
Version: 0.10.52
Version: 0.10.53
Release: 1%{?dist}
Summary: Macros for building packages for GHC
@ -15,6 +15,7 @@ URL: https://fedoraproject.org/wiki/Haskell_SIG
Source0: ghc-rpm-macros.ghc
Source1: COPYING
Source2: AUTHORS
Source3: ghc-deps.sh
%description
A set of macros for building GHC packages following the Haskell Guidelines
@ -34,6 +35,9 @@ echo no build stage needed
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm
install -p -m 0644 %{SOURCE0} ${RPM_BUILD_ROOT}/%{_sysconfdir}/rpm/macros.ghc
mkdir -p ${RPM_BUILD_ROOT}/%{_prefix}/lib/rpm
install -p %{SOURCE3} ${RPM_BUILD_ROOT}/%{_prefix}/lib/rpm
# this is why this package is now arch-dependent:
# turn off shared libs and dynamic linking on secondary archs
%ifnarch %{ix86} x86_64
@ -50,9 +54,16 @@ EOF
%defattr(-,root,root,-)
%doc COPYING AUTHORS
%config(noreplace) %{_sysconfdir}/rpm/macros.ghc
%{_prefix}/lib/rpm/ghc-deps.sh
%changelog
* Sat May 7 2011 Jens Petersen <petersen@redhat.com> - 0.10.53-1
- backport ghc-deps.sh rpm dependency script for automatic versioned
library dependencies (without hashes)
- drop ghc_pkg_deps from ghc_package_devel and ghc_package_prof since
ghc-deps.sh generates better inter-package dependencies already
* Wed Mar 16 2011 Jens Petersen <petersen@redhat.com> - 0.10.52-1
- backport ghc fixes and secondary arch support from 0.11.12:
- add ghc_pkg_obsoletes to binlib base lib package too