[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 08/11] Parameterize the compiler name



---
 Dh_Haskell.sh            | 182 +++++++++++++++++++++++++++++++----------------
 dh_haskell_blurbs        |  18 +++--
 dh_haskell_depends       |  25 ++++---
 dh_haskell_extra_depends |   5 +-
 dh_haskell_provides      |  21 +++---
 dh_haskell_shlibdeps     |  10 +--
 hlibrary.mk              |  30 ++++----
 7 files changed, 185 insertions(+), 106 deletions(-)

diff --git a/Dh_Haskell.sh b/Dh_Haskell.sh
index 4e56b64..1e1fce6 100644
--- a/Dh_Haskell.sh
+++ b/Dh_Haskell.sh
@@ -68,6 +68,24 @@ hc_haddock(){
     esac
 }

+hc_docdir(){
+    hc=$1
+    pkgid=$2
+    echo "usr/lib/${hc}-doc/haddock/${pkgid}/"
+}
+
+hc_htmldir(){
+    hc=$1
+    CABAL_PACKAGE=$2
+    echo "usr/share/doc/lib${hc}-${CABAL_PACKAGE}-doc/html/"
+}
+
+hc_hoogle(){
+    local hc
+    hc=$1
+    echo "/usr/lib/${hc}-doc/hoogle/"
+}
+
 strip_hash(){
  echo "$1" | sed 's/-................................$//'
 }
@@ -91,7 +109,10 @@ dependency(){
 }

 ghc_pkg_field(){
-    ghc-pkg --global field $@ | head -n1
+    hc=$1
+    pkg=$2
+    field=$3
+    ${hc}-pkg --global field ${pkg} ${field} | head -n1
 }

 providing_package_for_ghc(){
@@ -100,9 +121,11 @@ providing_package_for_ghc(){
     local dir
     local dirs
     local lib
-    dep=`strip_hash $1`
-    dirs=`ghc_pkg_field $dep library-dirs | grep -i ^library-dirs |
cut -d':' -f 2`
-    lib=`ghc_pkg_field $dep hs-libraries | grep -i ^hs-libraries |
sed -e 's|hs-libraries: *\([^ ]*\).*|\1|' `
+    local hc
+    hc=$1
+    dep=`strip_hash $2`
+    dirs=`ghc_pkg_field $hc $dep library-dirs | grep -i ^library-dirs
| cut -d':' -f 2`
+    lib=`ghc_pkg_field $hc $dep hs-libraries | grep -i ^hs-libraries
|  sed -e 's|hs-libraries: *\([^ ]*\).*|\1|' `
     for dir in $dirs ; do
  if [ -e "${dir}/lib${lib}.a" ] ; then
     package=`dpkg-query -S ${dir}/lib${lib}.a | cut -d':' -f 1` || exit $?
@@ -118,9 +141,11 @@ providing_package_for_ghc_prof(){
     local dir
     local dirs
     local lib
-    dep=`strip_hash $1`
-    dirs=`ghc_pkg_field $dep library-dirs | grep -i ^library-dirs |
cut -d':' -f 2`
-    lib=`ghc_pkg_field $dep hs-libraries | grep -i ^hs-libraries |
sed -e 's|hs-libraries: *\([^ ]*\).*|\1|' `
+    local hc
+    hc=$1
+    dep=`strip_hash $2`
+    dirs=`ghc_pkg_field $hc $dep library-dirs | grep -i ^library-dirs
| cut -d':' -f 2`
+    lib=`ghc_pkg_field $hc $dep hs-libraries | grep -i ^hs-libraries
| sed -e 's|hs-libraries: *\([^ ]*\).*|\1|' `
     for dir in $dirs ; do
  if [ -e "${dir}/lib${lib}_p.a" ] ; then
     package=`dpkg-query -S ${dir}/lib${lib}_p.a | cut -d':' -f 1` || exit $?
@@ -166,12 +191,14 @@ cabal_depends(){
 }

 hashed_dependency(){
+    local hc
     local type
     local pkgid
     local virpkg
-    type=$1
-    pkgid=$2
-    virtual_pkg=`package_id_to_virtual_package $type $pkgid`
+    hc=$1
+    type=$2
+    pkgid=$3
+    virtual_pkg=`package_id_to_virtual_package "${hc}" "$type" $pkgid`
     # As a transition measure, check if dpkg knows about this virtual package
     if dpkg-query -W $virtual_pkg >/dev/null 2>/dev/null;
     then
@@ -183,11 +210,14 @@ depends_for_ghc(){
     local dep
     local packages
     local pkgid
+    local hc
+    hc=$1
+    shift
     for pkgid in `cabal_depends $@` ; do
- dep=`hashed_dependency dev $pkgid`
+ dep=`hashed_dependency ${hc} dev $pkgid`
  if [ -z "$dep" ]
  then
-  pkg=`providing_package_for_ghc $pkgid`
+  pkg=`providing_package_for_ghc $hc $pkgid`
           if [ -n "$pkg" ]
           then
       dep=`dependency $pkg`
@@ -207,11 +237,14 @@ depends_for_ghc_prof(){
     local dep
     local packages
     local pkgid
+    local hc
+    hc=$1
+    shift
     for pkgid in `cabal_depends $@` ; do
- dep=`hashed_dependency prof $pkgid`
+ dep=`hashed_dependency ${hc} prof $pkgid`
  if [ -z "$dep" ]
  then
-  pkg=`providing_package_for_ghc_prof $pkgid`
+  pkg=`providing_package_for_ghc_prof $hc $pkgid`
           if [ -n "$pkg" ]
           then
       dep=`dependency $pkg`
@@ -228,29 +261,39 @@ depends_for_ghc_prof(){
 }

 provides_for_ghc(){
+    local hc
     local dep
     local packages
+    hc=$1
+    shift
     for package_id in `cabal_package_ids $@` ; do
- packages="$packages, `package_id_to_virtual_package dev $package_id`"
+ packages="$packages, `package_id_to_virtual_package "${hc}" dev $package_id`"
     done
     echo $packages | sed -e 's/^,[ ]*//'
 }

 provides_for_ghc_prof(){
+    local hc
     local dep
     local packages
+    hc=$1
+    shift
     for package_id in `cabal_package_ids $@` ; do
- packages="$packages, `package_id_to_virtual_package prof $package_id`"
+ packages="$packages, `package_id_to_virtual_package "${hc}" prof $package_id`"
     done
     echo $packages | sed -e 's/^,[ ]*//'
 }

 package_id_to_virtual_package(){
+ local hc
  local type
- type="$1"
- echo $2 | tr A-Z a-z | \
+ local pkgid
+ hc="$1"
+ type="$2"
+ pkgid="$3"
+ echo ${pkgid} | tr A-Z a-z | \
             grep '[a-z0-9]\+-[0-9\.]\+-................................' | \
- perl -pe 's/([a-z0-9-]+)-([0-9\.]+)-(.....).........................../libghc-\1-'$type'-\2-\3/'
+ perl -pe 's/([a-z0-9-]+)-([0-9\.]+)-(.....).........................../lib'${hc}'-\1-'$type'-\2-\3/'
 }

 depends_for_hugs(){
@@ -265,17 +308,18 @@ find_config_for_ghc(){
     local f
     local pkg
     pkg=$1
+    pkgdir=`package_pkgdir ${pkg}`
     case "$pkg" in
  ghc-prof)
     pkg=ghc
     ;;
- libghc-*-prof)
+ *-prof)
     pkg=`echo $pkg | sed -e 's/-prof$/-dev/'`
     ;;
  *)
     ;;
     esac
-    for f in debian/$pkg/var/lib/ghc/package.conf.d/*.conf ; do
+    for f in debian/$pkg/${pkgdir}/*.conf ; do
  if [ -f "$f" ] ; then
     echo $f
     echo " "
@@ -292,7 +336,7 @@ clean_recipe(){
     rm -rf dist dist-ghc dist-hugs ${DEB_SETUP_BIN_NAME} Setup.hi
Setup.ho Setup.o .*config*
     rm -f configure-ghc-stamp build-ghc-stamp build-hugs-stamp
build-haddock-stamp
     rm -rf debian/tmp-inst-ghc
-    rm -f debian/extra-depends
+    rm -f debian/extra-depends-ghc
     rm -f debian/libghc-${CABAL_PACKAGE}-doc.links
     if [ -f ${DEB_LINTIAN_OVERRIDES_FILE} ] ; then \
       sed -i '/binary-or-shlib-defines-rpath/ d'
${DEB_LINTIAN_OVERRIDES_FILE} ; \
@@ -311,32 +355,37 @@ make_setup_recipe(){
 configure_recipe(){
     DEB_SETUP_BIN_NAME=$1
     CABAL_PACKAGE=$2
-    DEB_HADDOCK_DIR=$3
-    DEB_HADDOCK_HTML_DIR=$4
-    ENABLE_PROFILING=$5
-    NO_GHCI_FLAG=$6
-    DEB_SETUP_GHC6_CONFIGURE_ARGS=$7
-    DEB_SETUP_GHC_CONFIGURE_ARGS=$8
-    OPTIMIZATION=$9
-    TESTS=$10
-    COMPILERS=$11
+    CABAL_VERSION=$3
+    ENABLE_PROFILING=$4
+    NO_GHCI_FLAG=$5
+    DEB_SETUP_GHC6_CONFIGURE_ARGS=$6
+    DEB_SETUP_GHC_CONFIGURE_ARGS=$7
+    OPTIMIZATION=$8
+    TESTS=$9
+    DEB_DEFAULT_COMPILER=$10
+    DEB_PACKAGES=$11
+
+    hc=`packages_hc "${DEB_DEFAULT_COMPILER}" "${DEB_PACKAGES}"`

+    ENABLE_PROFILING=`{ for i in ${DEB_PACKAGES}; do package_ext $i |
grep prof; done; } | sort -u | sed
's/prof/--enable-library-profiling/'`
     local GHC_OPTIONS
     for i in `dpkg-buildflags --get LDFLAGS`; do
GHC_OPTIONS="$GHC_OPTIONS -optl$i"; done

-    ${DEB_SETUP_BIN_NAME} configure ${COMPILERS} -v2
--package-db=/var/lib/ghc/package.conf.d \
-        --prefix=/usr --libdir=/usr/lib/haskell-packages/ghc/lib \
- --builddir=dist-ghc \
+    ${DEB_SETUP_BIN_NAME} configure "--${hc}" -v2
--package-db=/`hc_pkgdir ${hc}` \
+        --prefix=/`hc_prefix ${hc}` --libdir=/`hc_libdir ${hc}` \
+ --builddir=dist-${hc} \
        --ghc-options="${GHC_OPTIONS}" \
- --haddockdir=${DEB_HADDOCK_DIR} --datasubdir=${CABAL_PACKAGE}\
- --htmldir=${DEB_HADDOCK_HTML_DIR} ${ENABLE_PROFILING} ${NO_GHCI_FLAG} \
+ --haddockdir=/`hc_docdir ${hc} ${CABAL_PACKAGE}-${CABAL_VERSION}`
--datasubdir=${CABAL_PACKAGE}\
+ --htmldir=/`hc_htmldir ${hc} ${CABAL_PACKAGE}` ${ENABLE_PROFILING}
${NO_GHCI_FLAG} \
  ${DEB_SETUP_GHC6_CONFIGURE_ARGS} ${DEB_SETUP_GHC_CONFIGURE_ARGS}
${OPTIMIZATION} ${TESTS}
 }

 build_recipe(){
     DEB_SETUP_BIN_NAME=$1
-    COMPILER=$2
-    ${DEB_SETUP_BIN_NAME} build --builddir=dist-${COMPILER}
+    DEB_DEFAULT_COMPILER=$2
+    DEB_PACKAGES=$3
+    hc=`packages_hc "${DEB_DEFAULT_COMPILER}" "${DEB_PACKAGES}"`
+    ${DEB_SETUP_BIN_NAME} build --builddir=dist-${hc}
 }

 check_recipe(){
@@ -350,15 +399,19 @@ check_recipe(){
 haddock_recipe(){
     DEB_SETUP_BIN_NAME=$1
     DEB_HADDOCK_OPTS=$2
-    COMPILER=$3
-    [ ! -x /usr/bin/haddock ] || ${DEB_SETUP_BIN_NAME} haddock
--builddir=dist-${COMPILER} --with-haddock=/usr/bin/haddock
--with-ghc=${COMPILER} ${DEB_HADDOCK_OPTS} || \
+    DEB_DEFAULT_COMPILER=$3
+    DEB_PACKAGES=$4
+    hc=`packages_hc "${DEB_DEFAULT_COMPILER}" "${DEB_PACKAGES}"`
+    haddock=`hc_haddock ${hc}`
+    [ ! -x /usr/bin/${haddock} ] || ${DEB_SETUP_BIN_NAME} haddock
--builddir=dist-${hc} --with-haddock=/usr/bin/${haddock}
--with-ghc=${hc} ${DEB_HADDOCK_OPTS} || \
   echo "Haddock failed (no modules?), creating empty documentation package."
 }

 extra_depends_recipe(){
     DEB_SETUP_BIN_NAME=$1
-    pkg_config=`${DEB_SETUP_BIN_NAME} register --builddir=dist-ghc
--gen-pkg-config | tr -d ' \n' | sed -r 's,^.*:,,'`
-    dh_haskell_extra_depends $pkg_config
+    hc=$2
+    pkg_config=`${DEB_SETUP_BIN_NAME} register --builddir=dist-${hc}
--gen-pkg-config | tr -d ' \n' | sed -r 's,^.*:,,'`
+    dh_haskell_extra_depends ${hc} $pkg_config
     rm $pkg_config
 }

@@ -370,12 +423,17 @@ install_dev_recipe(){
     DEB_GHC_EXTRA_PACKAGES=$5
     DEB_LINTIAN_OVERRIDES_FILE=$6
     PKG=$7
-    ( cd debian/tmp-inst-ghc ; mkdir -p
usr/lib/haskell-packages/ghc/lib ; find
usr/lib/haskell-packages/ghc/lib/ \
+
+    hc=`package_hc ${PKG}`
+    libdir=`package_libdir ${PKG}`
+    pkgdir=`package_pkgdir ${PKG}`
+
+    ( cd debian/tmp-inst-${hc} ; mkdir -p ${libdir} ; find ${libdir}/ \
      \( ! -name "*_p.a" ! -name "*.p_hi" ! -type d \) \
      -exec install -Dm 644 '{}' ../${PKG}/'{}' ';' )
-    pkg_config=`${DEB_SETUP_BIN_NAME} register --builddir=dist-ghc
--gen-pkg-config | tr -d ' \n' | sed -r 's,^.*:,,'`
+    pkg_config=`${DEB_SETUP_BIN_NAME} register --builddir=dist-${hc}
--gen-pkg-config | tr -d ' \n' | sed -r 's,^.*:,,'`
     if [ "${HASKELL_HIDE_PACKAGES}" ]; then sed -i 's/^exposed:
True$/exposed: False/' $pkg_config; fi
-    install -Dm 644 $pkg_config
debian/${PKG}/var/lib/ghc/package.conf.d/$pkg_config
+    install -Dm 644 $pkg_config debian/${PKG}/${pkgdir}/$pkg_config
     rm -f $pkg_config
     if [ "z${DEB_GHC_EXTRA_PACKAGES}" != "z" ] ; then
        mkdir -p debian/$(notdir $@)/usr/lib/haskell-packages/extra-packages; \
@@ -391,7 +449,8 @@ install_dev_recipe(){

 install_prof_recipe(){
     PKG=$1
-    ( cd debian/tmp-inst-ghc ; mkdir -p
usr/lib/haskell-packages/ghc/lib ; find
usr/lib/haskell-packages/ghc/lib/ \
+    libdir=`package_libdir ${PKG}`
+    ( cd debian/tmp-inst-`package_hc ${PKG}` ; mkdir -p ${libdir} ;
find ${libdir}/ \
         ! \( ! -name "*_p.a" ! -name "*.p_hi" \) \
         -exec install -Dm 644 '{}' ../${PKG}/'{}' ';' )
     dh_haskell_provides -p${PKG}
@@ -400,23 +459,26 @@ install_prof_recipe(){

 install_doc_recipe(){
     CABAL_PACKAGE=$1
-    DEB_HADDOCK_DIR=$2
-    DEB_HADDOCK_HTML_DIR=$3
-    DEB_ENABLE_HOOGLE=$4
-    DEB_HOOGLE_TXT_DIR=$5
-    PKG=$6
-    mkdir -p debian/${PKG}/${DEB_HADDOCK_HTML_DIR}
-    ( cd debian/tmp-inst-ghc/ ; find ./${DEB_HADDOCK_HTML_DIR} \
+    CABAL_VERSION=$2
+    DEB_ENABLE_HOOGLE=$3
+    PKG=$4
+    hc=`package_hc ${PKG}`
+    pkgid=${CABAL_PACKAGE}-${CABAL_VERSION}
+    docdir=`hc_docdir ${hc} ${pkgid}`
+    htmldir=`hc_htmldir ${hc} ${CABAL_PACKAGE}`
+    hoogle=`hc_hoogle ${hc}`
+    mkdir -p debian/${PKG}/${htmldir}
+    ( cd debian/tmp-inst-${hc}/ ; find ./${htmldir} \
      ! -name "*.haddock" ! -type d -exec install -Dm 644 '{}' \
      ../${PKG}/'{}' ';' )
-    mkdir -p debian/${PKG}/${DEB_HADDOCK_DIR}
-    [ 0 = `ls debian/tmp-inst-ghc/${DEB_HADDOCK_DIR}/ 2>/dev/null | wc -l` ] ||
-     cp -r debian/tmp-inst-ghc/${DEB_HADDOCK_DIR}/*.haddock \
-        debian/${PKG}/${DEB_HADDOCK_DIR}
+    mkdir -p debian/${PKG}/${docdir}
+    [ 0 = `ls debian/tmp-inst-${hc}/${docdir}/ 2>/dev/null | wc -l` ] ||
+     cp -r debian/tmp-inst-${hc}/${docdir}/*.haddock \
+        debian/${PKG}/${docdir}
     if [ "${DEB_ENABLE_HOOGLE}" = "yes" ]; then
-        find debian/${PKG}/${DEB_HADDOCK_HTML_DIR} -name "*.txt" \
-            -printf "%p ${DEB_HOOGLE_TXT_DIR}/${PKG}.txt\n" >>
debian/libghc-${CABAL_PACKAGE}-doc.links
-        sed -i s,^debian/libghc-${CABAL_PACKAGE}-doc,,
debian/libghc-${CABAL_PACKAGE}-doc.links
+        find debian/${PKG}/${htmldir} -name "*.txt" \
+            -printf "%p ${hoogle}/${PKG}.txt\n" >>
debian/lib${hc}-${CABAL_PACKAGE}-doc.links
+        sed -i s,^debian/lib${hc}-${CABAL_PACKAGE}-doc,,
debian/lib${hc}-${CABAL_PACKAGE}-doc.links
     fi
     dh_haskell_depends -p${PKG}
 }
diff --git a/dh_haskell_blurbs b/dh_haskell_blurbs
index 83b30af..6d6d3a2 100644
--- a/dh_haskell_blurbs
+++ b/dh_haskell_blurbs
@@ -6,6 +6,11 @@

 set -e

+. /usr/share/haskell-devscripts/Dh_Haskell.sh
+
+packages=`dh_listpackages`
+hc=`packages_hc ${packages}`
+
 for pkg in `dh_listpackages $args`; do
     sfile=debian/$pkg.substvars
     touch $sfile
@@ -17,18 +22,19 @@ for pkg in `dh_listpackages $args`; do
  -e ^haskell:ShortDescription \
  $sfile > $sfile.tmp || true

-    case "$pkg" in
- libghc-*-dev) cat >> $sfile.tmp <<'__END__' ;;
+    ext=`package_ext ${pkg}`
+    case "$ext" in
+ dev) cat >> $sfile.tmp <<'__END__' ;;
 haskell:ShortBlurb=
 haskell:Blurb=This package provides a library for the Haskell
programming language.${Newline}See http://www.haskell.org/ for more
information on Haskell.
 __END__

- libghc-*-prof) cat >> $sfile.tmp <<'__END__' ;;
+ prof) cat >> $sfile.tmp <<'__END__' ;;
 haskell:ShortBlurb=; profiling libraries
 haskell:Blurb=This package provides a library for the Haskell
programming language, compiled${Newline}for profiling.  See
http://www.haskell.org/ for more information on Haskell.
 __END__

- libghc-*-doc) cat >> $sfile.tmp <<'__END__' ;;
+ doc) cat >> $sfile.tmp <<'__END__' ;;
 haskell:ShortBlurb=; documentation
 haskell:Blurb=This package provides the documentation for a library
for the Haskell${Newline}programming language.${Newline}See
http://www.haskell.org/ for more information on Haskell.
 __END__
@@ -55,9 +61,9 @@ haskell:ShortDescription=$shortDescription
 haskell:LongDescription=$longDescription
 __END__

-    version=$(dpkg-query --showformat='${version}' --show ghc | egrep
-o ".*-" \
+    version=$(dpkg-query --showformat='${version}' --show ${hc} |
egrep -o ".*-" \
  | egrep -o "[^-]*")
-    echo "haskell:ghc-version=ghc (>= ${version}), ghc (<<
${version}+)" >> $sfile.tmp
+    echo "haskell:${hc}-version=${hc} (>= ${version}), ${hc} (<<
${version}+)" >> $sfile.tmp

     mv $sfile.tmp $sfile
 done
diff --git a/dh_haskell_depends b/dh_haskell_depends
index f23271b..cd84c56 100644
--- a/dh_haskell_depends
+++ b/dh_haskell_depends
@@ -60,8 +60,11 @@ for pkg in `dh_listpackages $args`; do
     sfile=debian/$pkg.substvars
     touch $sfile

-    case "$pkg" in
- libghc-*-dev|libghc-*-prof)
+    hc=`package_hc ${pkg}`
+    ext=`package_ext ${pkg}`
+
+    case "$hc,$ext" in
+ ghc,dev|ghc,prof|ghcjs,dev|ghcjs,prof)
     if [ -z "$files" ] ; then
  cfiles=`find_config_for_ghc $pkg`
     else
@@ -71,14 +74,14 @@ for pkg in `dh_listpackages $args`; do
       echo "dh_haskell_depends - no installed package description
files found" >&2
       exit 1
     fi
-    case "$pkg" in
- libghc-*-dev)
+    case "$ext" in
+ dev)
             grep -v \
                         -e ^haskell:Depends \
                         -e ^haskell:Recommends \
                         -e ^haskell:Suggests \
                         $sfile > $sfile.tmp || true
-    echo "haskell:Depends=`depends_for_ghc $cfiles`" >> $sfile.tmp
+    echo "haskell:Depends=`depends_for_ghc ${hc} $cfiles`" >> $sfile.tmp
                     echo "haskell:Recommends=" >> $sfile.tmp
                     doc=`echo $pkg | sed -e 's/-dev$/-doc/'`
                     prof=`echo $pkg | sed -e 's/-dev$/-prof/'`
@@ -93,7 +96,7 @@ for pkg in `dh_listpackages $args`; do
                     fi
                     echo "haskell:Suggests=$suggests" >> $sfile.tmp
     ;;
- libghc-*-prof)
+ prof)
             grep -v \
                         -e ^haskell:Depends \
                         -e ^haskell:Recommends \
@@ -101,14 +104,14 @@ for pkg in `dh_listpackages $args`; do
                         $sfile > $sfile.tmp || true
                     dev=`echo $pkg | sed -e 's/-prof$/-dev/'`
                     version='(=${binary:Version})'
-                    depends="$dev ${version}, `depends_for_ghc_prof $cfiles`"
+                    depends="$dev ${version}, `depends_for_ghc_prof
${hc} $cfiles`"
     echo "haskell:Depends=$depends" >> $sfile.tmp
                     echo "haskell:Recommends=" >> $sfile.tmp
                     echo "haskell:Suggests=" >> $sfile.tmp
     ;;
     esac
     ;;
- libhugs-*)
+ hugs,*)
     grep -v \
                 -e ^haskell:Depends \
                 -e ^haskell:Recommends \
@@ -118,7 +121,7 @@ for pkg in `dh_listpackages $args`; do
             echo "haskell:Recommends=" >> $sfile.tmp
             echo "haskell:Suggests=" >> $sfile.tmp
     ;;
-        libghc-*-doc)
+        ghc,doc|ghcjs,doc)
     grep -v \
                 -e ^haskell:Depends \
                 -e ^haskell:Recommends \
@@ -136,7 +139,7 @@ for pkg in `dh_listpackages $args`; do
                 | cut -d: -f1 \
                 | sort -u \
                 | sed -e :a -e '$!N; s/\n/, /; ta'`
-            dev=`echo $pkg | sed -e 's/^[^-]\+-\(.\+\)-doc/libghc-\1-dev/'`
+            dev=`echo $pkg | sed -e 's/^[^-]\+-\(.\+\)-doc/lib${hc}-\1-dev/'`
             grep -v '^#' debian/control | grep $dev > /dev/null \
                 && recommends="$recommends, $dev" \
                 || recommends="$recommends"
@@ -148,7 +151,7 @@ for pkg in `dh_listpackages $args`; do
     ;;
     esac

-    echo "haskell:Extra-Depends=`cat debian/extra-depends`" >> $sfile.tmp
+    echo "haskell:Extra-Depends=`cat debian/extra-depends-${hc}`" >> $sfile.tmp

     mv $sfile.tmp $sfile
 done
diff --git a/dh_haskell_extra_depends b/dh_haskell_extra_depends
index 22087c1..513eb88 100644
--- a/dh_haskell_extra_depends
+++ b/dh_haskell_extra_depends
@@ -54,6 +54,9 @@

 set -e

+hc=$1
+shift
+
 . /usr/share/haskell-devscripts/Dh_Haskell.sh

 extradeps=''
@@ -64,5 +67,5 @@ for dep in `cabal_depends $files` ; do
         extradeps="$extradeps, `cat $extra_packages_file`"
     fi
 done
-echo $extradeps | sed -e 's/^,[ ]*//' > debian/extra-depends
+echo $extradeps | sed -e 's/^,[ ]*//' > debian/extra-depends-${hc}

diff --git a/dh_haskell_provides b/dh_haskell_provides
index cf4923c..630777a 100644
--- a/dh_haskell_provides
+++ b/dh_haskell_provides
@@ -66,8 +66,11 @@ for pkg in `dh_listpackages $args`; do
     sfile=debian/$pkg.substvars
     touch $sfile

-    case "$pkg" in
- libghc-*-dev|libghc-*-prof|ghc|ghc-prof)
+    hc=`package_hc ${pkg}`
+    ext=`package_ext ${pkg}`
+
+    case "$ext" in
+ dev|prof)
     if [ -z "$files" ] ; then
  cfiles=`find_config_for_ghc $pkg`
     else
@@ -77,24 +80,24 @@ for pkg in `dh_listpackages $args`; do
       echo "dh_haskell_provides - no installed package description
files found" >&2
       exit 1
     fi
-    case "$pkg" in
- libghc-*-dev|ghc)
+    case "$ext" in
+ dev)
             grep -v \
                         -e ^haskell:Provides \
                         $sfile > $sfile.tmp || true
-            echo "haskell:Provides=`provides_for_ghc $cfiles`" >> $sfile.tmp
+            echo "haskell:Provides=`provides_for_ghc $hc $cfiles`" >>
$sfile.tmp
     mv $sfile.tmp $sfile
             grep -v \
-                        -e ^haskell:ghc-package \
+                        -e ^haskell:${hc}-package \
                         $sfile > $sfile.tmp || true
-            echo "haskell:ghc-package=`cabal_package_ids $cfiles`" >>
$sfile.tmp
+            echo "haskell:${hc}-package=`cabal_package_ids $cfiles`"
>> $sfile.tmp
     mv $sfile.tmp $sfile
     ;;
- libghc-*-prof|ghc-prof)
+ prof)
             grep -v \
                         -e ^haskell:Provides \
                         $sfile > $sfile.tmp || true
-            echo "haskell:Provides=`provides_for_ghc_prof $cfiles`"
>> $sfile.tmp
+            echo "haskell:Provides=`provides_for_ghc_prof $hc
$cfiles`" >> $sfile.tmp
     mv $sfile.tmp $sfile
     ;;
     esac
diff --git a/dh_haskell_shlibdeps b/dh_haskell_shlibdeps
index 45a1a05..f18c701 100644
--- a/dh_haskell_shlibdeps
+++ b/dh_haskell_shlibdeps
@@ -31,8 +31,9 @@ pkgs=`dh_listpackages $args`

 for pkg in $pkgs
 do
-    case "$pkg" in
-        libghc-*-dev)
+    ext=`package_ext ${pkg}`
+    case "$ext" in
+        dev)
     if [ -z "$files" ] ; then
  files=`find_config_for_ghc $pkg`
     fi
@@ -67,8 +68,9 @@ gcc $args $T_DIR/probe.c -o $T_DIR/probe

 for pkg in $pkgs
 do
-    case "$pkg" in
-        libghc-*-dev)
+    ext=`package_ext ${pkg}`
+    case "$ext" in
+        dev)
             dpkg-shlibdeps --warnings=1 -Tdebian/$pkg.substvars $T_DIR/probe
             ;;
     esac
diff --git a/hlibrary.mk b/hlibrary.mk
index c7a4bf2..2c8bd76 100644
--- a/hlibrary.mk
+++ b/hlibrary.mk
@@ -23,6 +23,10 @@ export GREP_OPTIONS :=
 # cabal expects it to be available.
 export HOME = /homedoesnotexistatbuildtime

+# If we can't figure out which compiler to use from the library
+# package names, and DEB_DEFAULT_COMPILER isn't set in debian/rules,
+# we can safely assume the desired compiler is ghc.
+DEB_DEFAULT_COMPILER ?= ghc

 DEB_CABAL_PACKAGE ?= $(shell cat *.cabal |\
  perl -ne \
@@ -60,20 +64,16 @@ DEB_DH_MAKESHLIBS_ARGS_ALL += -XlibHS
 # - get this included in the cdbs package once this gets mature enough (maybe?)

 DEB_SETUP_BIN_NAME ?= debian/hlibrary.setup
-DEB_HADDOCK_HTML_DIR ?= /usr/share/doc/libghc-$(CABAL_PACKAGE)-doc/html/

 # most likely you don't need to touch this one
 GHC6_VERSION = $(shell ghc --numeric-version)
 GHC_VERSION = $(shell ghc --numeric-version)
-DEB_HADDOCK_DIR ?= /usr/lib/ghc-doc/haddock/$(CABAL_PACKAGE)-$(CABAL_VERSION)/

 DEB_HADDOCK_OPTS += --html --hoogle
 ifndef DEB_NO_IMPLICIT_HADDOCK_HYPERLINK
 DEB_HADDOCK_OPTS += --hyperlink-source
 endif

-DEB_HOOGLE_TXT_DIR = /usr/lib/ghc-doc/hoogle/
-
 MAKEFILE := debian/hlibrary.Makefile

 #ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
@@ -102,13 +102,13 @@ $(DEB_SETUP_BIN_NAME):

 configure-ghc-stamp: $(DEB_SETUP_BIN_NAME)
  . /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-  configure_recipe "$(DEB_SETUP_BIN_NAME)" "$(CABAL_PACKAGE)"
"$(DEB_HADDOCK_DIR)" "$(DEB_HADDOCK_HTML_DIR)" \
+  configure_recipe "$(DEB_SETUP_BIN_NAME)" "$(CABAL_PACKAGE)"
"$(CABAL_VERSION)" \
     "$(ENABLE_PROFILING)" "$(NO_GHCI_FLAG)"
"$(DEB_SETUP_GHC6_CONFIGURE_ARGS)" \
-    "$(DEB_SETUP_GHC_CONFIGURE_ARGS)" "$(OPTIMIZATION)" "$(TESTS)" "--ghc"
+    "$(DEB_SETUP_GHC_CONFIGURE_ARGS)" "$(OPTIMIZATION)" "$(TESTS)"
"$(DEB_DEFAULT_COMPILER)" "$(DEB_PACKAGES)"
  touch $@

 build-ghc-stamp: configure-ghc-stamp
- . /usr/share/haskell-devscripts/Dh_Haskell.sh && build_recipe
"$(DEB_SETUP_BIN_NAME)" ghc
+ . /usr/share/haskell-devscripts/Dh_Haskell.sh && build_recipe
"$(DEB_SETUP_BIN_NAME)" "$(DEB_DEFAULT_COMPILER)" "$(DEB_PACKAGES)"
  touch $@

 ifeq ($(DEB_ENABLE_TESTS),yes)
@@ -130,7 +130,7 @@ endif
 build/libghc-$(CABAL_PACKAGE)-prof
build/libghc-$(CABAL_PACKAGE)-dev:: build-ghc-stamp check-ghc-stamp

 build-haddock-stamp:
- . /usr/share/haskell-devscripts/Dh_Haskell.sh && haddock_recipe
"$(DEB_SETUP_BIN_NAME)" "$(DEB_HADDOCK_OPTS)" ghc
+ . /usr/share/haskell-devscripts/Dh_Haskell.sh && haddock_recipe
"$(DEB_SETUP_BIN_NAME)" "$(DEB_HADDOCK_OPTS)"
"$(DEB_DEFAULT_COMPILER)" "$(DEB_PACKAGES)"
  touch build-haddock-stamp

 build/libghc-$(CABAL_PACKAGE)-doc:: configure-ghc-stamp build-haddock-stamp
@@ -144,23 +144,23 @@ build/libhugs-$(CABAL_PACKAGE):: dist-hugs
 debian/tmp-inst-ghc: $(DEB_SETUP_BIN_NAME) build-ghc-stamp
  $(DEB_SETUP_BIN_NAME) copy --builddir=dist-ghc --destdir=debian/tmp-inst-ghc

-debian/extra-depends: debian/tmp-inst-ghc
- . /usr/share/haskell-devscripts/Dh_Haskell.sh &&
extra_depends_recipe "$(DEB_SETUP_BIN_NAME)"
+debian/extra-depends-ghc: debian/tmp-inst-ghc
+ . /usr/share/haskell-devscripts/Dh_Haskell.sh &&
extra_depends_recipe "$(DEB_SETUP_BIN_NAME)" ghc

 DEB_LINTIAN_OVERRIDES_FILE =
debian/libghc-$(CABAL_PACKAGE)-dev.lintian-overrides

-install/libghc-$(CABAL_PACKAGE)-dev:: debian/tmp-inst-ghc debian/extra-depends
+install/libghc-$(CABAL_PACKAGE)-dev:: debian/tmp-inst-ghc
debian/extra-depends-ghc
  . /usr/share/haskell-devscripts/Dh_Haskell.sh && \
   install_dev_recipe "$(DEB_SETUP_BIN_NAME)" "$(CABAL_PACKAGE)"
"$(CABAL_VERSION)" "$(HASKELL_HIDE_PACKAGES)"
"$(DEB_GHC_EXTRA_PACKAGES)" $(DEB_LINTIAN_OVERRIDES_FILE) "$(notdir
$@)"

-install/libghc-$(CABAL_PACKAGE)-prof:: debian/tmp-inst-ghc
install/libghc-$(CABAL_PACKAGE)-dev debian/extra-depends
+install/libghc-$(CABAL_PACKAGE)-prof:: debian/tmp-inst-ghc
install/libghc-$(CABAL_PACKAGE)-dev debian/extra-depends-ghc
  . /usr/share/haskell-devscripts/Dh_Haskell.sh && install_prof_recipe
"$(notdir $@)"

-install/libghc-$(CABAL_PACKAGE)-doc:: debian/tmp-inst-ghc
build-haddock-stamp debian/extra-depends
+install/libghc-$(CABAL_PACKAGE)-doc:: debian/tmp-inst-ghc
build-haddock-stamp debian/extra-depends-ghc
  . /usr/share/haskell-devscripts/Dh_Haskell.sh && \
-  install_doc_recipe "$(CABAL_PACKAGE)" "$(DEB_HADDOCK_DIR)"
"$(DEB_HADDOCK_HTML_DIR)" "$(DEB_ENABLE_HOOGLE)"
"$(DEB_HOOGLE_TXT_DIR)" "$(notdir $@)"
+  install_doc_recipe "$(CABAL_PACKAGE)" "$(CABAL_VERSION)"
"$(DEB_ENABLE_HOOGLE)" "$(notdir $@)"

-install/libhugs-$(CABAL_PACKAGE):: $(DEB_SETUP_BIN_NAME) dist-hugs
debian/extra-depends
+install/libhugs-$(CABAL_PACKAGE):: $(DEB_SETUP_BIN_NAME) dist-hugs
debian/extra-depends-hugs
  $(DEB_SETUP_BIN_NAME) copy --destdir=debian/libhugs-$(CABAL_PACKAGE)
--builddir=dist-hugs
  rm -rf debian/libhugs-$(CABAL_PACKAGE)/usr/share/doc/*
  dh_haskell_depends -p$(notdir $@)
-- 
1.9.1


Reply to: