File: rules

package info (click to toggle)
haskell-src-exts 0.2.1~darcs20071212-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 348 kB
  • ctags: 14
  • sloc: haskell: 3,777; makefile: 144; sh: 42
file content (182 lines) | stat: -rwxr-xr-x 6,849 bytes parent folder | download
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets  by Bill Allombert 2001

# Include dpatch
# include /usr/share/dpatch/dpatch.make

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)

GHC6_LIBDIR  := $(shell ghc6 --print-libdir)
GHC6_VERSION := $(shell ghc6 --numeric-version)
GHC6_CONFIGURE_FLAGS := --prefix=/usr/lib/haskell-packages/ghc6  \
	--bindir=/usr/bin
# \ 	--enable-library-profiling 
# ghc -split-objs only works on i386 and amd64
ifneq (,$(findstring $(DEB_HOST_ARCH),"i386 amd64"))
GHC6_CONFIGURE_FLAGS += --enable-split-objs
endif
MODULES  := haskell-src-exts harp

# Handle DEB_BUILD_OPTIONS containing noopt
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
GHC6_OPTIONS=-O0
# Only optimise on the more powerfull architectures,
# as the optimising of the parser takes quite some memory
else ifeq (,$(findstring $(DEB_HOST_ARCH),"i386 amd64 ia64"))
GHC6_OPTIONS=-O0
else
GHC6_OPTIONS=
endif

configure: configure-stamp
configure-stamp: 
	dh_testdir
# Make a private copy of the the ghc6 package.conf and install wrappers 
# for ghc6 and ghc-pkg6 which use the local copy instead.
	cp $(GHC6_LIBDIR)/package.conf debian/package.conf
	sed -e "s|@PACKAGE_CONF@|$(CURDIR)/debian/package.conf|" \
	    debian/ghc6.in > debian/ghc6
	sed -e "s|@PACKAGE_CONF@|$(CURDIR)/debian/package.conf|" \
	    debian/ghc-pkg6.in > debian/ghc-pkg6
	chmod 755 debian/ghc6 debian/ghc-pkg6
	for d in $(MODULES) ; do \
	    cd "$(CURDIR)/src/$$d" && \
	    "$(CURDIR)/debian/ghc6" --make Setup.hs -o setup -package Cabal && \
	    name=`grep "^Name:" *.cabal | sed "s|^Name:[ \t]*\(.*\)|\1|"` && \
	    vers=`grep "^Version:" *.cabal | sed "s|^Version:[ \t]*\(.*\)|\1|"` && \
	    sed -e "s|@LIBRARY@|$$name|g" -e "s|@VERSION@|$$vers|g" \
		"$(CURDIR)/debian/postinst.in" > \
		"$(CURDIR)/debian/libghc6-$$d-dev.postinst" && \
	    sed -e "s|@LIBRARY@|$$name|g" -e "s|@VERSION@|$$vers|g" \
		"$(CURDIR)/debian/prerm.in" > \
		"$(CURDIR)/debian/libghc6-$$d-dev.prerm" ; \
	done
	mv debian/libghc6-haskell-src-exts-dev.postinst debian/libghc6-src-exts-dev.postinst
	mv debian/libghc6-haskell-src-exts-dev.prerm debian/libghc6-src-exts-dev.prerm
	cd src/trhsx && "$(CURDIR)/debian/ghc6" --make Setup.hs -o setup -package Cabal
	touch configure-stamp

# clean: clean-patched unpatch
clean:
	dh_testdir
	dh_testroot
	rm -f configure-stamp build-arch-stamp build-indep-stamp
	for d in $(MODULES) trhsx ; do \
	    cd "$(CURDIR)/src/$$d" && \
	    if [ -x setup ] && [ -e .setup-config ]; then ./setup clean ; fi && \
	    rm -rf setup Setup.hi Setup.ho Setup.o .*config* dist html register.sh && \
            rm -f "$(CURDIR)/debian/libghc6-$$d-dev.postinst" && \
            rm -f "$(CURDIR)/debian/libghc6-$$d-dev.prerm" ;\
	done
	rm -f debian/trhsx.1 debian/libghc6-src-exts-dev.postinst debian/libghc6-src-exts-dev.prerm
	rm -rf dist debian/libghc6-haskell-src-exts-dev
	rm -f debian/package.conf debian/package.conf.old debian/ghc6 debian/ghc-pkg6
	dh_clean 

build: build-arch
build-arch: build-arch-stamp
build-arch-stamp: configure-stamp
	for d in $(MODULES) ; do \
	    cd "$(CURDIR)/src/$$d" && \
	    ./setup configure $(GHC6_CONFIGURE_FLAGS) \
		--with-compiler="$(CURDIR)/debian/ghc6" \
		--with-hc-pkg="$(CURDIR)/debian/ghc-pkg6" && \
	    GHC6_OPTIONS=$(GHC6_OPTIONS) ./setup build && \
	    ./setup register --gen-script && \
	    sed -i -e "s%import-dirs:.*%import-dirs: `pwd`/dist/build%" \
		-e "s%library-dirs:.*%library-dirs: `pwd`/dist/build%" \
		-e "s%include-dirs:.*%include-dirs: `pwd`/dist/build%" \
		-e "s%haddock-interfaces:.*%haddock-interfaces: `pwd`/dist/html/$$d.haddock%" \
		-e "s%haddock-html:.*\(|.*\)%haddock-html: `pwd`/dist/html ' \1%" \
		register.sh &&\
	    ./register.sh || (echo "BUILD of $$d FAILED" ; break ) ;\
	done
	cd src/trhsx && ./setup configure $(GHC6_CONFIGURE_FLAGS) \
		--with-compiler="$(CURDIR)/debian/ghc6" \
		--with-hc-pkg="$(CURDIR)/debian/ghc-pkg6" && \
		GHC6_OPTIONS=$(GHC6_OPTIONS) ./setup build
	pod2man --section=1 --release="Debian Project" --center="Debian GNU/Linux manual" debian/trhsx.pod > debian/trhsx.1
	touch build-arch-stamp

build-indep: build-indep-stamp
build-indep-stamp: build-arch-stamp
#	for d in $(MODULES) ; do \
#	    cd "$(CURDIR)/src/$$d" && ./setup haddock \
#		|| echo ( "GENERATING DOCS for $$d FAILED" ; break ) ;\
#	done
	touch build-indep-stamp

install: install-arch install-indep
install-arch: build-arch-stamp
	dh_testdir 
	dh_testroot
	dh_clean -k -s
	dh_installdirs -s
	for d in $(MODULES) ; do \
	    cd "$(CURDIR)/src/$$d" && \
	    ./setup copy --destdir="$(CURDIR)/debian/libghc6-$$d-dev" && \
	    for libdir in `find "$(CURDIR)/debian/libghc6-$$d-dev/usr/lib/haskell-packages/ghc6/lib/" -mindepth 1 -maxdepth 1 -type d` ; do \
		sed -e "s%haddock-interfaces:.*%haddock-interfaces: /usr/share/doc/$$-doc/html/$$d.haddock%" \
		    -e "s%haddock-html: .*%haddock-html: /usr/share/doc/$$d-doc/html%" \
		    -e "s%include-dirs: .*%include-dirs:%" \
		"$(CURDIR)/src/$$d/dist/installed-pkg-config" > "$$libdir/installed-pkg-config" ; \
	    done && \
	    find "$(CURDIR)/debian/libghc6-$$d-dev/usr/" -empty -type d -delete ; \
	done
	mv debian/libghc6-haskell-src-exts-dev/* debian/libghc6-src-exts-dev/ 
	cd src/trhsx && ./setup copy --destdir="$(CURDIR)/debian/libghc6-harp-dev/"
	dh_install -s

install-indep: build-indep-stamp
	dh_testdir 
	dh_testroot
	dh_clean -k -i
	dh_installdirs -i
	dh_install -i

# Must not depend on anything. This is to be called by
# binary-arch/binary-indep
# in another 'make' thread.
binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs README
	dh_installman 
	dh_installexamples
	dh_link
	dh_strip
	dh_compress -X.haddock 
	dh_fixperms
	dh_installdeb
	dh_haskell_depends
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb
# Build architecture independant packages using the common target.
#binary-indep: build-indep install-indep
#	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
binary-indep:

# Build architecture dependant packages using the common target.
binary-arch: build-arch install-arch
	$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common

binary: binary-arch binary-indep
.PHONY: build build-arch build-indep clean binary-indep binary-arch binary install install-indep install-arch configure