File: rules

package info (click to toggle)
ghc-cvs 20040725-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 68,484 kB
  • ctags: 19,658
  • sloc: haskell: 251,945; ansic: 109,709; asm: 24,961; sh: 12,825; perl: 5,786; makefile: 5,334; xml: 3,884; python: 682; yacc: 650; lisp: 477; cpp: 337; ml: 76; fortran: 24; csh: 18
file content (233 lines) | stat: -rwxr-xr-x 8,743 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# This file is public domain software, originally written by Joey Hess.
#
# This version is for a multibinary package. It also allows you to build any
# of the binary packages independantly, via binary-<package> targets.

# 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

# From /usr/share/doc/autotools-dev/examples/rules.gz:
export DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
  confflags += --build $(DEB_HOST_GNU_TYPE)
else
  confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
endif

include ghc/mk/version.mk

GHC=$(firstword $(shell bash -c "type -p ghc6 ghc5 ghc"))
EXTRA_CONFIGURE_FLAGS=--with-ghc="$(GHC)"
ifeq '$(findstring $(shell dpkg-architecture -qDEB_HOST_ARCH), i386 sparc)' ''
HAS_GHCI = no
else
HAS_GHCI = yes
endif

build: build-stamp
build-stamp:
	dh_testdir

	touch configure
	chmod +x configure
	chmod +x debian/xmlise-flags.sgml

	echo "readline=`grep-status -r -FProvides '\<libreadline-dev\>' -a -FStatus installed -s Package -n | tr '\n' ,`" >> debian/ghc-cvs.substvars

	echo "ProjectsToBuild = glafp-utils ghc libraries hslibs" > mk/build.mk
	echo "SGMLDocWays	:= html dvi ps" >> mk/build.mk
	echo "GhcRTSWays += debug_p thr_debug thr_debug_p" >> mk/build.mk
ifeq '$(findstring $(shell dpkg-architecture -qDEB_HOST_ARCH), i386 sparc)' ''
	echo "GhcUnregisterised=YES" >> mk/build.mk
	echo "SplitObjs=NO" >> mk/build.mk
endif
ifeq '$(HAS_GHCI)' 'no'
	echo "GhcWithInterpreter=NO" >> mk/build.mk
else
	echo "GhcWithInterpreter=YES" >> mk/build.mk
endif
ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	echo "SRC_HC_OPTS   += -H32m -O0" >> mk/build.mk
	echo "GhcHcOpts     += -Rghc-timing -DDEBUG" >> mk/build.mk
	echo "GhcLibHcOpts  += -O -dcore-lint -keep-hc-files " >> mk/build.mk
	echo "SplitObjs     = NO" >> mk/build.mk
	echo "STRIP         = :" >> mk/build.mk
endif
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	echo "SRC_HC_OPTS   += -H32m -O0" >> mk/build.mk
	echo "GhcHcOpts     += -O0" >> mk/build.mk
	# This breaks the build - to be investigated:
	# echo "GhcLibHcOpts  += -O0" >> mk/build.mk
	echo "GhcRtsCcOpts  += -O0" >> mk/build.mk
endif
	rm -f config.sub
	rm -f config.guess
	ln -s /usr/share/misc/config.sub .
	ln -s /usr/share/misc/config.guess .
	./configure $(confflags) --enable-hopengl --prefix=/usr --bindir='$${libdir}/bin' $(EXTRA_CONFIGURE_FLAGS)
	$(MAKE)

	mkdir debian/test-build
	echo 'main = putStrLn "Foo"' > debian/test-build/foo.hs
	ghc/compiler/ghc-inplace debian/test-build/foo.hs -o debian/test-build/foo
	[ "$$(debian/test-build/foo)" = "Foo" ]
	rm debian/test-build/*
	echo 'main = putStrLn "Foo"' > debian/test-build/foo.hs
	ghc/compiler/ghc-inplace debian/test-build/foo.hs -o debian/test-build/foo -O2
	[ "$$(debian/test-build/foo)" = "Foo" ]
	rm debian/test-build/*

	echo 'import IO; main = hPutStr stderr ""' > debian/test-build/foo.hs
	$(MAKE) -C testsuite boot
	mkdir debian/locale
	localedef -i en_GB -f UTF-8 debian/locale/en_GB
	export LOCPATH=`pwd`/debian/locale; \
		export LC_ALL=en_GB; export LC_CTYPE=en_GB; \
		$(MAKE) -C testsuite/tests/ghc-regress \
			TEST_HC=`pwd`/ghc/compiler/stage2/ghc-inplace \
			CLEANUP=1 \
	        TIMEOUT=`python -c "import os; import math; from os import *; from resource import *; \
	           spawnl(os.P_WAIT, 'ghc/compiler/ghc-inplace', 'ghc-inplace', \
	                             'debian/test-build/foo.hs', \
	                             '-o', 'debian/test-build/foo', '-O2'); \
	           spawnl(os.P_WAIT, 'debian/test-build/foo.hs', 'foo'); \
	           xs = getrusage(RUSAGE_CHILDREN); \
	           print (300*int(math.ceil(xs[0] + xs[1])))"`
	rm debian/test-build/*
	
	$(MAKE) -f debian/scripts.mk all
	debian/xmlise-flags.sgml
	xsltproc debian/flags.xsl ghc/docs/users_guide/flags.xml > debian/ghc-cvs.1
	for m in ghci-cvs ghc-$(ProjectVersion) ghci-$(ProjectVersion); do echo ".so man1/ghc-cvs.1" > debian/$$m.1; done
	cp ghc/utils/hp2ps/hp2ps.1 debian/hp2ps-ghc-cvs.1
	echo debian/*.1 > debian/ghc-cvs.manpages

	touch build-stamp

	dh_installdirs

	$(MAKE) prefix=`pwd`/debian/tmp/usr install GhcLibsWithOpenGL=NO GhcLibsWithGLUT=NO
	$(MAKE) prefix=`pwd`/debian/ghc-cvs-hopengl/usr -C libraries/OpenGL install
	$(MAKE) prefix=`pwd`/debian/ghc-cvs-hopengl/usr -C libraries/GLUT   install
	$(MAKE) prefix=`pwd`/debian/ghc-cvs-doc/usr datadir='$${prefix}/share/doc/ghc-cvs-doc' install-docs
	cd libraries && find . \( -name "*.hs" -o -name "*.lhs" \) -print0 | cpio -updV0 ../debian/ghc-cvs-libsrc/usr/share/doc/ghc-cvs-libsrc
	cd hslibs    && find . \( -name "*.hs" -o -name "*.lhs" \) -print0 | cpio -updV0 ../debian/ghc-cvs-libsrc/usr/share/doc/ghc-cvs-libsrc

	find debian/tmp -type f    -name "*.p_hi"    \
	                       -o  -name "*_p.a"     \
	                                        > debian/ghc-cvs-prof.install
	find debian/tmp \( -type f -o -type l \) !  -name "*.p_hi"    \
	                                         !  -name "*_p.a"     \
	                                        > debian/ghc-cvs.install
	dh_install
	/usr/bin/install -c -m 755 -d debian/ghc-cvs/usr/bin
	ln -s /usr/lib/ghc-$(ProjectVersion)/bin/ghc  debian/ghc-cvs/usr/bin/ghc-cvs
	ln -s /usr/lib/ghc-$(ProjectVersion)/bin/ghci debian/ghc-cvs/usr/bin/ghci-cvs
	for f in ghc ghc-pkg ghci; do ln -s /usr/lib/ghc-$(ProjectVersion)/bin/$$f-$(ProjectVersion) debian/ghc-cvs/usr/bin/; done
	
clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp

	-$(MAKE) maintainer-clean
	-$(MAKE) -C testsuite clean
	find . -type l -print0 | xargs -0 rm -f
	find testsuite \( -name "*.o" -o -name "*.hi" -o -name "*.hc" \
	               -o -name "*_stub.h" -o -name "*_stub.c" -o -name "*.out"  \
				   -o -name "*.genscript" -o -name "*.interp.*" \
	               -o -name "*.run.*" -o -name "*.comp.*" \
	               \) -print0 | xargs -0 rm -f
	find testsuite/tests/ghc-regress/ -type f -perm +111 -print0 \
	    | xargs -0 rm -f
	rm -f testsuite/driver/testlib.pyc
	rm -f testsuite/driver/testutil.pyc
	rm -f testsuite/tests/ghc-regress/lib/IO/hClose001.tmp
	rm -f testsuite/tests/ghc-regress/lib/IO/readwrite001.inout
	rm -f testsuite/tests/ghc-regress/lib/IO/readwrite002.inout
	rm -f testsuite/tests/ghc-regress/driver/B/C.ooo
	rm -f testsuite/tests/ghc-regress/driver/B/C.xhi
	rm -f testsuite/tests/ghc-regress/driver/A.ooo
	rm -f testsuite/tests/ghc-regress/driver/A.xhi
	rm -rf debian/locale
	rm -f mk/config.mk mk/config.h mk/stamp-h
	rm -f hslibs/doc/hslibs.out ghc/docs/users_guide/users_guide.out
	rm -f ghc/driver/package.conf.inplace.old ghc/driver/package.conf.old
	rm -f debian/ghc-cvs.install
	rm -f debian/ghc-cvs-prof.install
	rm -f debian/*.1
	rm -f debian/ghc-cvs.manpages
	rm -f ghc/docs/users_guide/flags.xml
	rm -f mk/build.mk
	rm -f libraries/libraries.html
	rm -rf libraries/html
	rm -f libraries/OpenAL/config.status
	rm -f libraries/OpenAL/config.log
	rm -f libraries/OpenAL/config.mk
	rm -f libraries/OpenAL/include/HsOpenALConfig.h
	rm -f libraries/OpenAL/include/HsOpenAL.h
	rm -f libraries/X11/doc/HSX11.out
	rm -f libraries/config.status
	rm -f libraries/libraries.txt
	rm -f ghc/compiler/parser/Parser.y
	rm -f ghc/includes/gmp.h
	rm -rf debian/test-build
	$(MAKE) -f debian/scripts.mk clean

	dh_clean

# This single target is used to build all the packages, all at once, or
# one at a time. So keep in mind: any options passed to commands here will
# affect _all_ packages. Anything you want to only affect one package
# should be put in another target, such as the install target.
binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_installmenu
#	dh_installdebconf
#	dh_installlogrotate
#	dh_installemacsen
#	dh_installcatalogs
#	dh_installpam
#	dh_installmime
#	dh_installinit
	dh_installman
#	dh_installcron
#	dh_installinfo
#	dh_undocumented
	dh_strip
	dh_link
	dh_compress
	dh_fixperms
#	dh_perl
#	dh_python
#	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture independant packages using the common target.
binary-indep: build
	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

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

# Any other binary targets build just one binary package at a time.
binary-%: build
	make -f debian/rules binary-common DH_OPTIONS=-p$*

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary-common binary