diff --git a/AUTHORS b/AUTHORS index 9725c64..adc72fc 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,3 +1,7 @@ +Maintainer: +Jens Petersen + +Initial implementation: Bryan O'Sullivan Jens Petersen -Yaakov Nemoy \ No newline at end of file +Yaakov Nemoy diff --git a/ghc-deps.sh b/ghc-deps.sh index 9e2caa0..720dc75 100755 --- a/ghc-deps.sh +++ b/ghc-deps.sh @@ -1,35 +1,50 @@ #!/bin/sh # find rpm provides and requires for Haskell GHC libraries -#set -x - # 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 -# %define __find_provides /usr/lib/rpm/ghc-deps.sh --provides +# %define __find_requires /usr/lib/rpm/ghc-deps.sh --requires %{buildroot}%{ghcpkgbasedir} +# %define __find_provides /usr/lib/rpm/ghc-deps.sh --provides %{buildroot}%{ghcpkgbasedir} -[ $# -ne 1 ] && echo "Usage: `basename $0` [--provides|--requires]" && exit 1 +[ $# -ne 2 ] && echo "Usage: `basename $0` [--provides|--requires] %{buildroot}" && exit 1 MODE=$1 - -case $MODE in - --provides) FIELD=id ;; - --requires) FIELD=depends -esac +PKGBASEDIR=$2 +PKGCONFDIR=$PKGBASEDIR/package.conf.d files=$(cat) -PKGCONF=$(echo $files | tr [:blank:] '\n' | grep package.conf.d) +#set -x -if [ -n "$PKGCONF" ]; then - CONFDIR=$(dirname $PKGCONF) - PKGS=$(ghc-pkg -f $CONFDIR describe '*' | awk '/^name: / {print $2}') - for pkg in $PKGS; do - HASHS=$(ghc-pkg -f $CONFDIR field $pkg $FIELD | sed -e "s/^$FIELD: \+//") - for i in $HASHS; do - echo "ghc($i)" - done - done +if [ -d "$PKGCONFDIR" ]; then + for i in $files; do + LIB_FILE=$(echo $i | grep /libHS | grep -v /libHSrts) + if [ -n "$LIB_FILE" ]; then + case $LIB_FILE in + *.so) META=ghc ;; + *_p.a) META=ghc-prof SELF=ghc-devel ;; + *.a) META=ghc-devel SELF=ghc ;; + esac + if [ -n "$META" ]; then + case $MODE in + --provides) FIELD=id ;; + --requires) FIELD=depends ;; + *) echo "`basename $0`: Need --provides or --requires" ; exit 1 + esac + 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 + echo $i | sed -e "s/\(.*\)-\(.*\)/$META(\1) = \2/" + done + if [ "$MODE" = "--requires" -a -n "$SELF" ]; then + HASHS=$(ghc-pkg -f $PKGCONFDIR field $PKGVER id | sed -e "s/^id: \+//") + for i in $HASHS; do + echo $i | sed -e "s/\(.*\)-\(.*\)/$SELF(\1) = \2/" + done + fi + fi + fi + done fi echo $files | tr [:blank:] '\n' | /usr/lib/rpm/rpmdeps $MODE diff --git a/ghc-rpm-macros.ghc b/ghc-rpm-macros.ghc index e311dcd..9d2d1cb 100644 --- a/ghc-rpm-macros.ghc +++ b/ghc-rpm-macros.ghc @@ -60,21 +60,12 @@ mkdir -p $RPM_BUILD_ROOT%{ghcpkgbasedir}/package.conf.d \ install --mode=0644 %{?1}%{!?1:%{pkg_name}}-%{version}.conf $RPM_BUILD_ROOT%{ghcpkgbasedir}/package.conf.d # devel pkg basic requires -%ghc_requires Requires: ghc = %{ghc_version}\ -Requires(post): ghc = %{ghc_version}\ -Requires(postun): ghc = %{ghc_version}\ -%if 0%{!?without_shared:1}\ -Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}} = %{-v:%{-v*}}%{!-v:%{version}}-%{release}\ -%endif - -# doc pkg basic requires -%ghc_doc_requires Requires: ghc-doc = %{ghc_version}\ -Requires(post): ghc-doc = %{ghc_version}\ -Requires(postun): ghc-doc = %{ghc_version} +%ghc_devel_requires Requires(post): ghc = %{ghc_version}\ +Requires(postun): ghc = %{ghc_version} # prof pkg basic requires -%ghc_prof_requires Requires: ghc-prof = %{ghc_version}\ -Requires: ghc-%{-n:%{-n*}}%{!-n:%{pkg_name}}-devel = %{-v:%{-v*}}%{!-v:%{version}}-%{release} +%ghc_prof_requires \ +%{nil} # ghc_lib_package [-n pkgname] [-c cdepslist] [-h pkgdepslist] (-o deprecated no-op) %ghc_lib_package(n:c:h:o:)\ @@ -112,13 +103,14 @@ This package provides the shared library.\ %ghc_pkg_recache %{_bindir}/ghc-pkg recache --no-user-package-conf || : # for docs post and postun -%ghc_reindex_haddock ( cd %{ghcdocbasedir}/libraries && [ -x "./gen_contents_index" ] && ./gen_contents_index ) || : +%ghc_reindex_haddock\ +%{nil} # ghc_package_devel [-n pkgname] [-c cdepslist] [-h pkgdepslist] [-l licensetag] [-v version] (-o deprecated no-op) %ghc_package_devel(n:c:h:l:v:o:)\ %global _use_internal_dependency_generator 0\ -%global __find_provides /usr/lib/rpm/ghc-deps.sh --provides\ -#%%global __find_requires /usr/lib/rpm/ghc-deps.sh --requires\ +%global __find_provides /usr/lib/rpm/ghc-deps.sh --provides %{buildroot}%{ghcpkgbasedir}\ +%global __find_requires /usr/lib/rpm/ghc-deps.sh --requires %{buildroot}%{ghcpkgbasedir}\ %global debug_package %{nil}\ %define local_pkg_name %{-n:%{-n*}}%{!-n:%{pkg_name}}\ %define ghc_pkg_name ghc-%{local_pkg_name}\ @@ -127,8 +119,7 @@ Summary: %{?common_summary}%{!?common_summary:%{local_pkg_name} library} Group: Development/Libraries\ %{-v:Version: %{-v*}}\ %{-l:License: %{-l*}}\ -%{?ghc_requires}\ -%{?ghc_doc_requires}\ +%{?ghc_devel_requires}\ %{!-h:%{?ghc_pkg_deps:Requires: %{ghc_pkg_deps}}}\ %{-h:Requires: %{-h*}}\ %{!-c:%{?ghc_pkg_c_deps:Requires: %{ghc_pkg_c_deps}}}\ diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec index a7ddbab..98a9ca7 100644 --- a/ghc-rpm-macros.spec +++ b/ghc-rpm-macros.spec @@ -1,5 +1,5 @@ Name: ghc-rpm-macros -Version: 0.9.1 +Version: 0.10.0 Release: 1%{?dist} Summary: Macros for building packages for GHC @@ -53,6 +53,9 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Mon Nov 22 2010 Jens Petersen - 0.10.0-1 +- turn pkg hash metadata (for ghc-7 builds) + * Thu Sep 30 2010 Jens Petersen - 0.9.1-1 - fix without_shared build so it actually works