Package: haskell-devscripts
Version: 0.6.6
Severity: wishlist
Tags: patch
Please include the attached hlibrary.mk file and install it in
/usr/share/cdbs/1/class/.
The man page should also have a mention using
include /usr/share/cdbs/1/class/hlibrary.mk
as an alternative to using dh_haskell.
Having haskell-devscripts Suggest or even Recommend cdbs wouldn't
hurt, either.
I would still like to get more feedback about using this CDBS makefile
class, but I think it's ready for wider use already.
# -*- mode: makefile -*-
# Copyright 2008 Kari Pahula <[EMAIL PROTECTED]>
# Description: A class for Haskell library packages
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307 USA.
_cdbs_scripts_path ?= /usr/lib/cdbs
_cdbs_rules_path ?= /usr/share/cdbs/1/rules
_cdbs_class_path ?= /usr/share/cdbs/1/class
include $(_cdbs_rules_path)/debhelper.mk$(_cdbs_makefile_suffix)
CABAL_PACKAGE = $(shell cat *.cabal |\
perl -ne 'if (/^name:\s*(.*)$$/i) {$$_ = $$1; tr/A-Z/a-z/; print; exit 0;}')
ENABLE_PROFILING = $(shell egrep -qe '^Package: libghc6-.*-prof$$' debian/control && echo --enable-library-profiling; exit 0)
# TODO:
# - some of this would probably be useful for generic Haskell programs,
# not just libraries
# - provide more hooks
# - get this included in the cdbs package once this gets mature enough (maybe?)
clean::
test ! -e setup-bin || ./setup-bin clean
rm -rf dist dist-ghc6 dist-hugs setup-bin Setup.hi Setup.ho Setup.o .*config*
rm -f build-ghc6-stamp build-hugs-stamp
setup-bin:
if test ! -e Setup.lhs -a ! -e Setup.hs; then echo "No setup script found!"; exit 1; fi
for setup in Setup.lhs Setup.hs; do if test -e $$setup; then ghc6 -package Cabal $$setup -o setup-bin; exit 0; fi; done
dist-ghc6: setup-bin
echo ENABLE_PROFILING is $(ENABLE_PROFILING)
./setup-bin configure --ghc --prefix=/usr/lib/haskell-packages/ghc6 -v2 $(ENABLE_PROFILING) $(DEB_SETUP_GHC6_CONFIGURE_ARGS)
mv dist dist-ghc6
build-ghc6-stamp: dist-ghc6
mv dist-ghc6 dist
./setup-bin build
mv dist dist-ghc6
touch build-ghc6-stamp
build/libghc6-$(CABAL_PACKAGE)-prof build/libghc6-$(CABAL_PACKAGE)-dev:: build-ghc6-stamp
# Provide two alternate names for the -doc package
build/haskell-$(CABAL_PACKAGE)-doc build/libghc6-$(CABAL_PACKAGE)-doc:: dist-ghc6
mv dist-ghc6 dist
./setup-bin haddock
mv dist dist-ghc6
dist-hugs: setup-bin
./setup-bin configure --hugs --prefix=/usr -v2
mv dist dist-hugs
build/libhugs-$(CABAL_PACKAGE):: dist-hugs
mv dist-hugs dist
./setup-bin build $(DEB_SETUP_HUGS_CONFIGURE_ARGS)
mv dist dist-hugs
install/libghc6-$(CABAL_PACKAGE)-dev:: setup-bin
mv dist-ghc6 dist
./setup-bin copy --destdir=debian/libghc6-$(CABAL_PACKAGE)-dev
find debian/libghc6-$(CABAL_PACKAGE)-dev/usr/lib/haskell-packages/ghc6/lib/ -name "*_p.a" -exec rm '{}' ';'
find debian/libghc6-$(CABAL_PACKAGE)-dev/usr/lib/haskell-packages/ghc6/lib/ -name "*.p_hi" -exec rm '{}' ';'
rm -rf debian/libghc6-$(CABAL_PACKAGE)-dev/usr/share/doc/*
dh_haskell_prep -plibghc6-$(CABAL_PACKAGE)-dev
cp dist/installed-pkg-config debian/libghc6-$(CABAL_PACKAGE)-dev/usr/lib/haskell-packages/ghc6/lib/*/
rm -rf debian/libghc6-$(CABAL_PACKAGE)-dev/usr/lib/haskell-packages/ghc6/share/
mv dist dist-ghc6
install/libghc6-$(CABAL_PACKAGE)-prof:: setup-bin
mv dist-ghc6 dist
./setup-bin copy --destdir=debian/libghc6-$(CABAL_PACKAGE)-prof
find debian/libghc6-$(CABAL_PACKAGE)-prof/usr/lib/haskell-packages/ghc6/lib/ -name "*[^p].a" -exec rm '{}' ';'
find debian/libghc6-$(CABAL_PACKAGE)-prof/usr/lib/haskell-packages/ghc6/lib/ -name "*.o" -exec rm '{}' ';'
find debian/libghc6-$(CABAL_PACKAGE)-prof/usr/lib/haskell-packages/ghc6/lib/ -name "*.hi" -exec rm '{}' ';'
rm -rf debian/libghc6-$(CABAL_PACKAGE)-prof/usr/share/doc/*
dh_haskell_prep -plibghc6-$(CABAL_PACKAGE)-prof
cp dist/installed-pkg-config debian/libghc6-$(CABAL_PACKAGE)-dev/usr/lib/haskell-packages/ghc6/lib/*/
rm -rf debian/libghc6-$(CABAL_PACKAGE)-prof/usr/lib/haskell-packages/ghc6/share/
mv dist dist-ghc6
install/haskell-$(CABAL_PACKAGE)-doc install/libghc6-$(CABAL_PACKAGE)-doc:: setup-bin
mv dist-ghc6 dist
mkdir -p debian/libghc6-$(CABAL_PACKAGE)-doc/usr/share/doc/libghc6-$(CABAL_PACKAGE)-doc/html/
cp -r dist/doc/html/*/* debian/libghc6-$(CABAL_PACKAGE)-doc/usr/share/doc/*/html/
mv dist dist-ghc6
install/libhugs-$(CABAL_PACKAGE):: setup-bin
mv dist-hugs dist
./setup-bin copy --destdir=debian/libhugs-$(CABAL_PACKAGE)
rm -rf debian/libhugs-$(CABAL_PACKAGE)/usr/share/doc/*
dh_haskell_prep -plibhugs-$(CABAL_PACKAGE)
mv dist dist-hugs