1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
# -*- mode: makefile -*-
# Copyright 2008 Kari Pahula <kaol@debian.org>
# 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?)
# For now, you can find the newest version in
# http://people.debian.org/~kaol/repos/hlibrary/
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
./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
# The build target may be called by buildds without having the
# build-depends-indep installed
[ ! -x /usr/bin/haddock ] || ./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/*
rm -rf debian/libghc6-$(CABAL_PACKAGE)-dev/usr/lib/haskell-packages/ghc6/bin/
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/
dh_haskell_depends -plibghc6-$(CABAL_PACKAGE)-dev
mv dist dist-ghc6
install/libghc6-$(CABAL_PACKAGE)-prof:: setup-bin install/libghc6-$(CABAL_PACKAGE)-dev
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/*
rm -rf debian/libghc6-$(CABAL_PACKAGE)-prof/usr/lib/haskell-packages/ghc6/bin/
dh_haskell_prep -plibghc6-$(CABAL_PACKAGE)-prof
rm -rf debian/libghc6-$(CABAL_PACKAGE)-prof/usr/lib/haskell-packages/ghc6/share/
dh_haskell_depends -plibghc6-$(CABAL_PACKAGE)-prof
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
|