2
# Generic Haskell cabal library debian/rules v8 by Ian Lynagh,
3
# based on the example by Joey Hess.
4
# This file is public domain software.
6
# Uncomment this to turn on verbose mode.
9
# Get the Cabal package name. Assumes that the Debian package name is standard.
10
CABAL_PACKAGE = $(shell dpkg-parsechangelog | sed "1s/source: haskell-//i; q")
12
GHC6_PACKAGE = libghc6-$(CABAL_PACKAGE)-dev
13
GHC6_PROF_PACKAGE = libghc6-$(CABAL_PACKAGE)-prof
14
GHC6_DOC_PACKAGE = libghc6-$(CABAL_PACKAGE)-doc
16
# Find ghc. The ghc in the path might point to some other version of
17
# GHC, so use ghc6 if it exists (which it ought to when building for
19
GHC := $(firstword $(shell bash -c "type -p ghc6 ghc"))
21
CONFIGURE_OPTS = --enable-library-vanilla \
22
--enable-library-profiling \
23
--enable-library-for-ghci
24
ifneq '$(findstring $(shell dpkg-architecture -qDEB_HOST_ARCH), i386 amd64)' ''
25
CONFIGURE_OPTS += --enable-split-objs
32
update-haskell-control --check
33
$(GHC) --make Setup.hs -o setup-ghc
34
./setup-ghc configure --ghc --with-compiler=$(GHC) --prefix=/usr --datadir=/usr/share/doc/ghc6-doc/html/cabal_libraries --datasubdir=$(CABAL_PACKAGE) $(CONFIGURE_OPTS)
41
PROF_FILE = \( -name "*.p_*" -o -name "lib*_p.a" \)
43
install: install-stamp
44
install-stamp: build-stamp
50
./setup-ghc copy --destdir=debian/tmp/
51
find debian/tmp/usr/lib -type f ! $(PROF_FILE) \
52
> debian/$(GHC6_PACKAGE).install
53
find debian/tmp -type d -empty >> debian/$(GHC6_PACKAGE).install
54
find debian/tmp/usr/lib -type f $(PROF_FILE) \
55
> debian/$(GHC6_PROF_PACKAGE).install
56
echo "debian/tmp/usr/share/doc" > debian/$(GHC6_DOC_PACKAGE).install
58
./setup-ghc register --gen-script
59
./setup-ghc unregister --gen-script
60
mkdir -p debian/$(GHC6_PACKAGE)/usr/lib/$(GHC6_PACKAGE)
61
mv register.sh debian/$(GHC6_PACKAGE)/usr/lib/$(GHC6_PACKAGE)
62
mv unregister.sh debian/$(GHC6_PACKAGE)/usr/lib/$(GHC6_PACKAGE)
66
update-generated-files:
67
update-debian-haskell-files
68
update-haskell-control
69
sed "s/@PACKAGE@/$(GHC6_PACKAGE)/g" debian/$(GHC6_PACKAGE).prerm.in \
70
> debian/$(GHC6_PACKAGE).prerm
71
sed "s/@PACKAGE@/$(GHC6_PACKAGE)/g" debian/$(GHC6_PACKAGE).postinst.in \
72
> debian/$(GHC6_PACKAGE).postinst
77
rm -f build-stamp install-stamp binary-common-stamp
80
rm -f Setup.o Setup.hi setup-ghc
81
rm -f debian/*.install
85
# Build architecture-dependent files here.
86
binary-common: binary-common-stamp
87
binary-common-stamp: install-stamp
93
dh_install --fail-missing
94
# Nasty hack as Cabal doesn't let us tell it where to put the docs
95
mkdir debian/$(GHC6_DOC_PACKAGE)/usr/share/doc/ghc6-doc/html/libraries/
96
ln -s ../cabal_libraries/$(CABAL_PACKAGE)/doc/html/ debian/$(GHC6_DOC_PACKAGE)/usr/share/doc/ghc6-doc/html/libraries/$(CABAL_PACKAGE)
111
dh_compress -X.haddock
122
# binary-indep and binary-arch both build everything, as otherwise
123
# # "dh_install --fail-missing" falls over
125
# Build architecture-independent files here.
126
binary-indep: binary-common-stamp
127
# We have nothing to do by default.
129
# Build architecture-dependent files here.
130
binary-arch: binary-common-stamp
132
binary: binary-indep binary-arch
133
.PHONY: build clean binary-indep binary-arch binary-common binary install