File: rules

package info (click to toggle)
cernlib 2004.11.04.dfsg-0sarge1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 29,292 kB
  • ctags: 1,159
  • sloc: ansic: 2,285; sh: 840; makefile: 582
file content (238 lines) | stat: -rwxr-xr-x 7,513 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
234
235
236
237
238
#!/usr/bin/make -f
export DH_COMPAT=3
export DH_ALWAYS_EXCLUDE=CVS
export DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)

# current package version
DEBIAN_VERSION=$(strip $(shell \
		head -n 1 debian/changelog | cut -f 2 -d ' ' | tr -d '()'))

# current upstream version
UPSTREAM_VERSION=$(shell echo $(DEBIAN_VERSION) | sed 's/-.*//')

# set of library packages for which to generate shlibs
# Currently libpaw1 is filtered out since its shlibs should be more recent
# than everything else's (new public function added in 2004.11.04-3)
LIBPKGS=$(filter-out libpaw1,$(shell grep "^Package: lib" debian/control | \
	grep -v -- -dev | grep -v libgeant | cut -d " " -f 2))

# yes, the quote marks below must be escaped:
LOCAL_DEFINES = -DCERNLIB_DEBIAN -DDEBIAN_VERSION=\"$(DEBIAN_VERSION)\"

# location of non-debian-specific patches
PATCHDIR = debian/generic

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

# Backwards compatibility hack for po-debconf; see
# http://lists.debian.org/debian-i18n/2003/debian-i18n-200307/msg00026.html
ifeq (,$(wildcard /usr/bin/po2debconf))
    PO2DEBCONF := no
    MINDEBCONFVER := 0.5
else
    PO2DEBCONF := yes
    MINDEBCONFVER := 1.2.0
endif

# output a helpful usage message
help:
	@cat debian/local/rules-help.txt

# this target downloads source code from the Cernlib web site to the
# directory "upstream".
get-orig-source:
	set -e ; \
	mkdir -p upstream ; \
	cd upstream ; \
	for file in Imakefile car cfortran cmz config geant321 graflib include\
		mathlib mclibs packlib patchy pawlib phtools scripts ; \
	do \
		wget --continue http://wwwinfo.cern.ch/asd/cernlib/download/2004_source/tar/src_$${file}.tar.gz ; \
	done

# this target recreates the source code tar.gz files, having deleted those
# files with GPL-incompatible copyrights as listed in debian/local/deadpool.txt
remove-deadpool:
	chmod a+x debian/local/scripts/remove-deadpool
	debian/local/scripts/remove-deadpool

# This target creates an orig.tar.gz file in the directory ".."
# Don't do this if you already have an orig.tar.gz for this source version, 
# as the md5sums will not match!
orig.tar.gz: ../cernlib_$(UPSTREAM_VERSION).orig.tar.gz

../cernlib_$(UPSTREAM_VERSION).orig.tar.gz:
	$(MAKE) -f debian/rules clean remove-deadpool
	mkdir ../cernlib-$(UPSTREAM_VERSION).orig
	cp -a upstream ../cernlib-$(UPSTREAM_VERSION).orig
	cd .. && tar czf cernlib_$(UPSTREAM_VERSION).orig.tar.gz \
		cernlib-$(UPSTREAM_VERSION).orig
	rm -rf ../cernlib-$(UPSTREAM_VERSION).orig

# Do not depend on build-indep so that buildd's don't needlessly run
# build-indep target.
build: build-arch

Makefile: $(PATCHDIR)/Makefile
	cp -f $(PATCHDIR)/Makefile .

unpack: Makefile
	dh_testdir
	$(MAKE) gunzip

patch: Makefile
	dh_testdir
	$(MAKE) prefix=/usr mandir=/usr/share/man sysconfdir=/etc \
		LOCAL_DEFINES='$(LOCAL_DEFINES)' patch
	# force use of system cfortran.h since we Build-Depend upon it
	rm -f src/include/cfortran.h			

build-arch: patch
	dh_testdir
	$(MAKE) prefix=/usr mandir=/usr/share/man sysconfdir=/etc \
		LOCAL_DEFINES='$(LOCAL_DEFINES)' cernlib-arch
ifeq (,$(findstring keepbuild,$(DEB_BUILD_OPTIONS)))
	# delete build tree to save disk space (only if both builds are done)
	if [ -e stampdir/cernlib-indep-stamp ] ; then rm -rf build ; fi
endif

build-indep: patch
	dh_testdir
	$(MAKE) prefix=/usr mandir=/usr/share/man sysconfdir=/etc \
		LOCAL_DEFINES='$(LOCAL_DEFINES)' cernlib-indep
ifeq (,$(findstring keepbuild,$(DEB_BUILD_OPTIONS)))
	# delete build tree to save disk space (only if both builds are done)
	if [ -e stampdir/cernlib-arch-stamp ] ; then rm -rf build ; fi
endif

clean: Makefile
	dh_testdir
	dh_testroot
	$(MAKE) clean
	rm -f Makefile $(PATCHDIR)/bin/kuipc
	-rm -rf upstream/200?
	rm -rf debian/tmp/
	-find . -name higz_windows.dat -o -name last.kumac \
		-o -name last.kumacold -o -name paw.metafile | xargs rm -f
	-rm -rf lib*.txt libdeps/ bindeps/ # clean up output of makedeplist
	dh_clean
	# Regenerate debian/control here:
	rm -f debian/control && $(MAKE) -f debian/rules debian/control
ifeq ($(PO2DEBCONF),yes)	
	# Hack for woody compatibility. This makes sure that the
	# debian/pawserv.templates file shipped in the source package doesn't
	# specify encodings, which woody's debconf can't handle. If building
	# on a system with po-debconf installed (conveniently debhelper (>=
	# 4.1.16) depends on it), the binary-arch target will generate a
	# better version for sarge.
	echo 1 > debian/po/output
	po2debconf debian/pawserv.templates.master > debian/pawserv.templates
	rm -f debian/po/output
endif

debian/control:
	# isajet currently doesn't build on m68k, so don't produce it.
	cd debian/local/control ; \
	if [ "$(DEB_BUILD_ARCH)" = m68k ] ; then \
		mkdir non-m68k ; \
		for package in libisajet758 libisajet758-dev ; do \
			mv $$package.control non-m68k/ ; \
		done ; \
	fi ; \
	cat 0base.control [a-z]*.control > ../../control ; \
	if [ -d non-m68k ] ; then \
		mv -u non-m68k/* . ; \
		rmdir non-m68k ; \
	fi

install-common:
	dh_testdir
	dh_testroot
	dh_clean -k

# target to install arch-dependent files
install-arch: install-common build-arch
	dh_installdirs -a
	mkdir -p debian/tmp/etc/logrotate.d
	$(MAKE) prefix=debian/tmp/usr mandir=debian/tmp/usr/share/man \
		sysconfdir=debian/tmp/etc install-arch

# target to install arch-independent files
install-indep: install-common build-indep
	dh_installdirs -i
	$(MAKE) prefix=debian/tmp/usr mandir=debian/tmp/usr/share/man \
		sysconfdir=debian/tmp/etc install-indep

install: install-indep install-arch

binary-arch: install-arch
	dh_testdir
	dh_testroot
	dh_install -a
	dh_installdocs -a
	dh_installexamples -a
	set -e ; \
	# Lintian overrides of spurious warnings
	for package in paw paw++ paw-static paw++-static ; do \
		cp -p debian/$$package.overrides \
		debian/$$package/usr/share/lintian/overrides/$$package ; \
	done
	dh_installmenu -a
	dh_installman -a
	dh_installchangelogs -a
ifeq ($(PO2DEBCONF),yes)
	po2debconf -e utf8 debian/pawserv.templates.master > \
		debian/pawserv.templates
endif
	dh_installdebconf -a
	dh_strip -a
	dh_link -a
	dh_compress -a
	dh_installcron -a
	dh_installlogrotate -a
	dh_fixperms -a
	chmod 0700 debian/pawserv/var/log/pawserv
	for package in $(LIBPKGS) ; do \
		dh_makeshlibs -p$$package -V"$$package (>= 2004.01.20-6)" ; \
	done
	dh_makeshlibs -plibpaw1 -V"libpaw1 (>> 2004.11.04-2)"
	dh_makeshlibs -plibgeant1 -V"libgeant1 (>> 2004.11.04.dfsg)"
	dh_shlibdeps -a -lshlib
	dh_installdeb -a
	dh_gencontrol -a -- -V"debconf-depends=debconf (>= $(MINDEBCONFVER))"
	dh_md5sums -a
	dh_builddeb -a

binary-indep: install-indep
	dh_testdir
	dh_testroot
	dh_install -i
	dh_installdocs -i
	dh_installexamples -i
	dh_installman -i
	dh_installchangelogs -i
	dh_link -i
	dh_compress -i -X.dat -X.kumac -X.F

	# Fudge metapackage docs a little bit for efficiency:
	for package in cernlib cernlib-core cernlib-core-dev cernlib-extras; do\
		rm -rf debian/$$package/usr/share/doc/$$package ; \
		ln -sf cernlib-base debian/$$package/usr/share/doc/$$package ; \
	done
	rm -rf debian/cernlib-montecarlo/usr/share/doc/cernlib-montecarlo
	ln -sf montecarlo-base \
		debian/cernlib-montecarlo/usr/share/doc/cernlib-montecarlo

	dh_fixperms -i
	dh_installdeb -i
	dh_gencontrol -i
	dh_md5sums -i
	dh_builddeb -i

binary: binary-indep binary-arch

.PHONY: help get-orig-source remove-deadpool build build-indep build-arch \
	clean debian/control install install-common install-indep install-arch\
	binary binary-indep binary-arch unpack patch orig.tar.gz