add rpm hash requires for dynamic executables in ghc-deps.sh

- compile Setup in cabal macro
- use _rpmconfigdir
epel9
Jens Petersen 14 years ago
parent ed934fb2e1
commit a1abcaaa78

@ -18,14 +18,18 @@ case $MODE in
*) echo "`basename $0`: Need --provides or --requires" ; exit 1 *) echo "`basename $0`: Need --provides or --requires" ; exit 1
esac esac
GHCVERSION=$(ghc --numeric-version)
files=$(cat) files=$(cat)
#set -x #set -x
if [ -d "$PKGCONFDIR" ]; then for i in $files; do
for i in $files; do LIB_FILE=$(echo $i | grep /libHS | egrep -v "$PKGBASEDIR/libHS")
LIB_FILE=$(echo $i | grep /libHS | egrep -v "$PKGBASEDIR/libHS") if [ -n "$LIB_FILE" ]; then
if [ -n "$LIB_FILE" ]; then if [ -d "$PKGCONFDIR" ]; then
META=""
SELF=""
case $LIB_FILE in case $LIB_FILE in
*.so) META=ghc ;; *.so) META=ghc ;;
*_p.a) META=ghc-prof SELF=ghc-devel ;; *_p.a) META=ghc-prof SELF=ghc-devel ;;
@ -48,7 +52,15 @@ if [ -d "$PKGCONFDIR" ]; then
fi fi
fi fi
fi fi
done elif [ "$MODE" = "--requires" ]; then
fi 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%")
for p in ${BIN_DEPS}; do
HASH=$(ghc-pkg --global field $p id | sed -e "s/^id: \+//")
echo $HASH | sed -e "s/\(.*\)-\(.*\)/ghc(\1) = \2/"
done
fi
fi
done
echo $files | tr [:blank:] '\n' | /usr/lib/rpm/rpmdeps $MODE echo $files | tr [:blank:] '\n' | /usr/lib/rpm/rpmdeps $MODE

@ -1,5 +1,6 @@
# "cabal" # "cabal"
%cabal ./Setup %cabal [ -x Setup ] || ghc --make -dynamic Setup\
./Setup
# configure # configure
%cabal_configure\ %cabal_configure\
@ -130,8 +131,8 @@ This package provides the shared library.\
%define pkgnamever %{pkgname}-%{pkgver}\ %define pkgnamever %{pkgname}-%{pkgver}\
%define basepkg ghc-%{pkgname}\ %define basepkg ghc-%{pkgname}\
%global _use_internal_dependency_generator 0\ %global _use_internal_dependency_generator 0\
%global __find_provides /usr/lib/rpm/ghc-deps.sh --provides %{buildroot}%{ghclibdir}\ %global __find_provides %{_rpmconfigdir}/ghc-deps.sh --provides %{buildroot}%{ghclibdir}\
%global __find_requires /usr/lib/rpm/ghc-deps.sh --requires %{buildroot}%{ghclibdir}\ %global __find_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}\
%package -n %{basepkg}-devel\ %package -n %{basepkg}-devel\
Summary: %{?common_summary}%{!?common_summary:Haskell %{pkgname} library} development files\ Summary: %{?common_summary}%{!?common_summary:Haskell %{pkgname} library} development files\
Group: Development/Libraries\ Group: Development/Libraries\
@ -197,14 +198,12 @@ find %{buildroot} -type f -exec sh -c "file {} | grep -q 'dynamically linked'" \
# ghc_bin_build # ghc_bin_build
%ghc_bin_build\ %ghc_bin_build\
ghc --make -dynamic Setup\
%cabal_configure\ %cabal_configure\
%cabal build %cabal build
# ghc_lib_build [name] [version] # ghc_lib_build [name] [version]
%ghc_lib_build()\ %ghc_lib_build()\
%{?1:cd %1-%2}\ %{?1:cd %1-%2}\
ghc --make -dynamic Setup\
%cabal_configure %{!?without_prof:-p} %{?1:--docdir=%{_docdir}/ghc-%1-%2 --htmldir=%{ghclibdocdir}/%1-%2}\ %cabal_configure %{!?without_prof:-p} %{?1:--docdir=%{_docdir}/ghc-%1-%2 --htmldir=%{ghclibdocdir}/%1-%2}\
%cabal build\ %cabal build\
%{!?without_haddock:%cabal haddock %{!?without_hscolour:--hyperlink-source}}\ %{!?without_haddock:%cabal haddock %{!?without_hscolour:--hyperlink-source}}\
@ -213,6 +212,8 @@ ghc --make -dynamic Setup\
# install bin package # install bin package
%ghc_bin_install\ %ghc_bin_install\
%global _use_internal_dependency_generator 0\
%global __find_requires %{_rpmconfigdir}/ghc-deps.sh --requires %{buildroot}%{ghclibdir}\
%cabal_install\ %cabal_install\
%ghc_strip_dynlinked %ghc_strip_dynlinked

@ -1,5 +1,5 @@
Name: ghc-rpm-macros Name: ghc-rpm-macros
Version: 0.11.4 Version: 0.11.5
Release: 1%{?dist} Release: 1%{?dist}
Summary: Macros for building packages for GHC Summary: Macros for building packages for GHC
@ -47,6 +47,11 @@ install -p %{SOURCE3} ${RPM_BUILD_ROOT}/%{_prefix}/lib/rpm
%changelog %changelog
* Sun Jan 23 2011 Jens Petersen <petersen@redhat.com> - 0.11.5-1
- add rpm hash requires for dynamic executables in ghc-deps.sh
- compile Setup in cabal macro
- use _rpmconfigdir
* Sat Jan 22 2011 Jens Petersen <petersen@redhat.com> - 0.11.4-1 * Sat Jan 22 2011 Jens Petersen <petersen@redhat.com> - 0.11.4-1
- drop deprecated ghcdocdir and ghcpkgdir - drop deprecated ghcdocdir and ghcpkgdir
- new ghclibdocdir - new ghclibdocdir

Loading…
Cancel
Save