Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 23 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23 Rev 27
1
#!/usr/bin/make -f
1
#!/usr/bin/make -f
2
# Sample debian/rules that uses debhelper. 
2
# Sample debian/rules that uses debhelper. 
3
# GNU copyright 1997 by Joey Hess.
3
# GNU copyright 1997 by Joey Hess.
4
#
4
#
5
# This version is for a hypothetical package that builds an
5
# This version is for a hypothetical package that builds an
6
# architecture-dependant package, as well as an architecture-independent
6
# architecture-dependant package, as well as an architecture-independent
7
# package.
7
# package.
8
#
8
#
9
# $Id: rules,v 1.64 2006/08/05 15:49:18 grendel Exp $
9
# $Id: rules,v 1.64 2006/08/05 15:49:18 grendel Exp $
10
#
10
#
11
11
12
# Uncomment this to turn on verbose mode. 
12
# Uncomment this to turn on verbose mode. 
13
#export DH_VERBOSE=1
13
#export DH_VERBOSE=1
14
include /usr/share/dpatch/dpatch.make
14
include /usr/share/dpatch/dpatch.make
15
15
16
ifdef CCVER
16
ifdef CCVER
17
CC=gcc-$(CCVER)
17
CC=gcc-$(CCVER)
18
else
18
else
19
CC=gcc
19
CC=gcc
20
endif
20
endif
21
21
22
ifeq (,$(DEB_BUILD_ARCH))
22
ifeq (,$(DEB_BUILD_ARCH))
23
DEB_BUILD_ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
23
DEB_BUILD_ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
24
endif
24
endif
25
25
-
 
26
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-
 
27
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-
 
28
26
CFLAGS_EXTRA = -g
29
CFLAGS_EXTRA = -g
27
CPPFLAGS_EXTRA = -DDEBIAN
30
CPPFLAGS_EXTRA = -DDEBIAN
28
31
29
ifdef SSP
32
ifdef SSP
30
SSP_FLAGS=-fstack-protector
33
SSP_FLAGS=-fstack-protector
31
endif
34
endif
32
35
33
CFARGSEXTRA = --with-cdebug
36
CFARGSEXTRA = --with-cdebug
34
37
35
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
38
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
36
CFARGSEXTRA += --without-copt
39
CFARGSEXTRA += --without-copt
37
else
40
else
38
CFARGSEXTRA += --with-copt
41
CFARGSEXTRA += --with-copt
39
endif
42
endif
40
43
41
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
44
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
42
CFARGSEXTRA += --with-rtldebug
45
CFARGSEXTRA += --with-rtldebug
43
else
46
else
44
CFARGSEXTRA += --without-rtldebug
47
CFARGSEXTRA += --without-rtldebug
45
endif
48
endif
46
49
47
CFLAGS_EXTRA += $(SSP_FLAGS)
50
CFLAGS_EXTRA += $(SSP_FLAGS)
48
# Temporary workaround for hppa linker issues
51
# Temporary workaround for hppa linker issues
49
ifeq ($(DEB_BUILD_ARCH),hppa)
52
ifeq ($(DEB_BUILD_ARCH),hppa)
50
CFLAGS_EXTRA += -ffunction-sections
53
CFLAGS_EXTRA += -ffunction-sections
51
endif
54
endif
52
55
53
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
56
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
54
	INSTALL_PROGRAM += -s
57
	INSTALL_PROGRAM += -s
55
endif
58
endif
56
59
57
EXTRA_ARGS=--with-security
60
EXTRA_ARGS=--with-security
58
61
59
DO_MACHINE_CODE=no
62
DO_MACHINE_CODE=no
60
ifeq ($(DEB_BUILD_ARCH),i386)
63
ifeq ($(DEB_BUILD_ARCH),i386)
61
DO_MACHINE_CODE=yes
64
DO_MACHINE_CODE=yes
62
endif
65
endif
63
ifeq ($(DEB_BUILD_ARCH),powerpc)
66
ifeq ($(DEB_BUILD_ARCH),powerpc)
64
DO_MACHINE_CODE=yes
67
DO_MACHINE_CODE=yes
65
endif
68
endif
66
ifeq ($(DEB_BUILD_ARCH),sparc)
69
ifeq ($(DEB_BUILD_ARCH),sparc)
67
DO_MACHINE_CODE=no
70
DO_MACHINE_CODE=no
68
endif
71
endif
69
72
70
ifeq ($(DO_MACHINE_CODE),yes)
73
ifeq ($(DO_MACHINE_CODE),yes)
71
MACHINE_OPTS=--with-machine-code
74
MACHINE_OPTS=--with-machine-code
72
else
75
else
73
MACHINE_OPTS=--without-machine-code
76
MACHINE_OPTS=--without-machine-code
74
endif
77
endif
75
78
76
DEBVERSION:=$(shell dpkg-parsechangelog | sed -ne 's/Version: *\(.*\)-.*$$/\1/p')
79
DEBVERSION:=$(shell dpkg-parsechangelog | sed -ne 's/Version: *\(.*\)-.*$$/\1/p')
77
MAJOR:=$(shell sed -ne 's/major://p' buildid.txt)
80
MAJOR:=$(shell sed -ne 's/major://p' buildid.txt)
78
MINOR:=$(shell sed -ne 's/minor://p' buildid.txt)
81
MINOR:=$(shell sed -ne 's/minor://p' buildid.txt)
79
BUILD:=$(shell sed -ne 's/build://p' buildid.txt)
82
BUILD:=$(shell sed -ne 's/build://p' buildid.txt)
80
PIKEV:=$(MAJOR).$(MINOR)
83
PIKEV:=$(MAJOR).$(MINOR)
81
VERSION:=$(MAJOR).$(MINOR).$(BUILD)
84
VERSION:=$(MAJOR).$(MINOR).$(BUILD)
82
PIKE:=pike$(PIKEV)
85
PIKE:=pike$(PIKEV)
83
86
84
ifneq ($(VERSION),$(DEBVERSION))
87
ifneq ($(VERSION),$(DEBVERSION))
85
$(error Version mismatch; buildid.txt: $(VERSION), debian/changelog: $(DEBVERSION))
88
$(error Version mismatch; buildid.txt: $(VERSION), debian/changelog: $(DEBVERSION))
86
endif
89
endif
87
90
88
CFARGS=$(CFARGSEXTRA) \
91
CFARGS=$(CFARGSEXTRA) \
-
 
92
       --host=$(DEB_HOST_GNU_TYPE) \
-
 
93
       --build=$(DEB_BUILD_GNU_TYPE) \
89
       --with-cflags=\\'$(CFLAGS_EXTRA)\\' \
94
       --with-cflags='$(CFLAGS_EXTRA)' \
90
       --with-cppflags=\\'$(CPPFLAGS_EXTRA)\\' \
95
       --with-cppflags='$(CPPFLAGS_EXTRA)' \
91
       --with-bignums \
96
       --with-bignums \
92
       --with-gmp \
97
       --with-gmp \
93
       --with-poll \
98
       --with-poll \
94
       --with-zlib \
99
       --with-zlib \
95
       --with-freetype \
100
       --with-freetype \
96
       --without-ttflib \
101
       --without-ttflib \
97
       --with-libnettle \
102
       --with-libnettle \
98
       --without-sybase \
103
       --without-sybase \
99
       --without-java \
104
       --without-java \
100
       --with-odbc \
105
       --with-odbc \
101
       --with-sane \
106
       --with-sane \
102
       --with-postgres \
107
       --with-postgres \
103
       --with-postgres-include-dir=`pg_config --includedir` \
108
       --with-postgres-include-dir=`pg_config --includedir` \
104
       --with-libpq-dir=/usr/lib \
109
       --with-libpq-dir=/usr/lib \
105
       --with-perl \
110
       --with-perl \
106
       --without-ffmpeg \
111
       --without-ffmpeg \
107
       --without-fftw \
112
       --without-fftw \
108
       --without-libpdf \
113
       --without-libpdf \
109
       --without-libpanda \
114
       --without-libpanda \
110
       --without-GTK \
115
       --without-GTK \
111
       --without-GTK2 \
116
       --without-GTK2 \
112
       --without-bundles \
117
       --without-bundles \
113
       $(MACHINE_OPTS) $(EXTRA_ARGS)
118
       $(MACHINE_OPTS) $(EXTRA_ARGS)
114
119
115
include_prefix=/usr/include/pike/$(VERSION)
120
include_prefix=/usr/include/pike/$(VERSION)
116
lib_prefix=/usr/lib/pike/$(VERSION)
121
lib_prefix=/usr/lib/pike/$(VERSION)
117
122
118
MODULE_PACKAGES=$(shell dh_listpackages -a -N $(PIKE)-core -N $(PIKE)-dev)
123
MODULE_PACKAGES=$(shell dh_listpackages -a -N $(PIKE)-core -N $(PIKE)-dev)
119
#{ADT,Array,Audio,Cache,Calendar,Calendar_I,COM,Colors,CommonLog,Crypto,Debug,Filesystem,Error,Float,Function,Geography,Getopt,Gettext,Gmp,Graphics,Gz,HTTPAccept,Int,Kerberos,Languages,Local,Locale,Mapping,Math,MIME,Mird,Multiset,Nettle,Parser,Pike,Pipe,Process,Program,Protocols,Regexp,Remote,SSL,Shuffler,Standards,Stdio,String,System,Thread,Tools,Unicode,Web,Yabu,Yp,_ADT,_Charset,_Roxen,___Gz,___MIME,___Math,___Mird,___Regexp,___Yp,____Charset,__builtin*,spider}.
124
#{ADT,Array,Audio,Cache,Calendar,Calendar_I,COM,Colors,CommonLog,Crypto,Debug,Filesystem,Error,Float,Function,Geography,Getopt,Gettext,Gmp,Graphics,Gz,HTTPAccept,Int,Kerberos,Languages,Local,Locale,Mapping,Math,MIME,Mird,Multiset,Nettle,Parser,Pike,Pipe,Process,Program,Protocols,Regexp,Remote,SSL,Shuffler,Standards,Stdio,String,System,Thread,Tools,Unicode,Web,Yabu,Yp,_ADT,_Charset,_Roxen,___Gz,___MIME,___Math,___Mird,___Regexp,___Yp,____Charset,__builtin*,spider}.
120
#usr/lib/pike/*/modules/Sql.pmod/{module,Sql,rsql,sql_*}.*
125
#usr/lib/pike/*/modules/Sql.pmod/{module,Sql,rsql,sql_*}.*
121
126
122
excluded_modules:=Ssleay Mird Msql msql PDF Ffmpeg Oracle oracle sybase Gnome GTK GDK DVB Java TTF
127
excluded_modules:=Ssleay Mird Msql msql PDF Ffmpeg Oracle oracle sybase Gnome GTK GDK DVB Java TTF
123
# This is tricky. Note that it's only possible for an exclusion to match the last
128
# This is tricky. Note that it's only possible for an exclusion to match the last
124
# component specified in an .install file or on the command line, and below.
129
# component specified in an .install file or on the command line, and below.
125
DH_EXCLUDE:=$(addprefix -X,$(excluded_modules))
130
DH_EXCLUDE:=$(addprefix -X,$(excluded_modules))
126
DH_ALREADY=`for p in $(MODULE_PACKAGES); do \
131
DH_ALREADY=`for p in $(MODULE_PACKAGES); do \
127
	      find debian/$$p/usr/lib/pike/*/* -type f -printf "-X%P "; done`
132
	      find debian/$$p/usr/lib/pike/*/* -type f -printf "-X%P "; done`
128
133
129
TMP=$(CURDIR)/debian/tmp
134
TMP=$(CURDIR)/debian/tmp
130
135
131
#export CFLAGS CC PIKE VERSION
136
#export CFLAGS CC PIKE VERSION
132
export CC
137
export CC
133
138
134
build-arch: build-arch-stamp
139
build-arch: build-arch-stamp
135
build-arch-stamp: $(DPATCH_STAMPFN)
140
build-arch-stamp: $(DPATCH_STAMPFN)
136
	dh_testdir
141
	dh_testdir
137
142
138
	# Add here command to compile/build the package.
143
	# Add here command to compile/build the package.
139
	$(MAKE) compile CONFIGUREARGS="$(CFARGS)"
144
	$(MAKE) compile CONFIGUREARGS="$(CFARGS)"
140
	touch build-arch-stamp
145
	touch build-arch-stamp
141
146
142
build-indep: build-indep-stamp
147
build-indep: build-indep-stamp
143
build-indep-stamp: $(DPATCH_STAMPFN)
148
build-indep-stamp: $(DPATCH_STAMPFN)
144
	dh_testdir
149
	dh_testdir
145
150
146
	# Add here command to compile/build the arch indep package.
151
	# Add here command to compile/build the arch indep package.
147
	$(MAKE) documentation CONFIGUREARGS="$(CFARGS)"
152
	$(MAKE) documentation CONFIGUREARGS="$(CFARGS)"
148
	touch build-indep-stamp
153
	touch build-indep-stamp
149
154
150
build: build-arch
155
build: build-arch
151
156
152
clean: clean-patched unpatch
157
clean: clean-patched unpatch
153
	dh_clean
158
	dh_clean
154
159
155
clean-patched:
160
clean-patched:
156
	dh_testdir
161
	dh_testdir
157
	dh_testroot
162
	dh_testroot
158
	rm -f build-stamp build-arch-stamp build-indep-stamp configure-stamp
163
	rm -f build-stamp build-arch-stamp build-indep-stamp configure-stamp
159
164
160
	# Add here commands to clean up after the build process.
165
	# Add here commands to clean up after the build process.
161
	$(MAKE) distclean
166
	$(MAKE) distclean
162
	rm -rf refdoc/modref refdoc/traditional_manual
167
	rm -rf refdoc/modref refdoc/traditional_manual
163
168
164
install: DH_OPTIONS=
169
install: DH_OPTIONS=
165
install: build-arch
170
install: build-arch
166
	dh_testdir
171
	dh_testdir
167
	dh_testroot
172
	dh_testroot
168
	dh_clean -k
173
	dh_clean -k
169
174
170
	$(MAKE) INSTALLARGS=--traditional \
175
	$(MAKE) INSTALLARGS=--traditional \
171
		buildroot=$(TMP) \
176
		buildroot=$(TMP) \
172
	        prefix=/usr \
177
	        prefix=/usr \
173
	        man_prefix=/usr/share/man \
178
	        man_prefix=/usr/share/man \
174
	        lib_prefix="$(lib_prefix)" \
179
	        lib_prefix="$(lib_prefix)" \
175
		include_prefix="$(include_prefix)" \
180
		include_prefix="$(include_prefix)" \
176
		pike_name=/usr/bin/$(PIKE) \
181
		pike_name=/usr/bin/$(PIKE) \
177
	        install_nodoc
182
	        install_nodoc
178
183
179
#	Some cleaning
184
#	Some cleaning
180
	find "$(TMP)$(lib_prefix)" -name '.autodoc' -type f -exec rm -f '{}' ';'
185
	find "$(TMP)$(lib_prefix)" -name '.autodoc' -type f -exec rm -f '{}' ';'
181
186
182
	install -d -m755 $(TMP)/usr/share/pixmaps
187
	install -d -m755 $(TMP)/usr/share/pixmaps
183
	install -m644 debian/pike.xpm $(TMP)/usr/share/pixmaps/$(PIKE).xpm
188
	install -m644 debian/pike.xpm $(TMP)/usr/share/pixmaps/$(PIKE).xpm
184
	mv $(TMP)/usr/bin/pike $(TMP)/usr/bin/$(PIKE)
189
	mv $(TMP)/usr/bin/pike $(TMP)/usr/bin/$(PIKE)
185
	mv $(TMP)/usr/share/man/man1/pike.1 $(TMP)/usr/share/man/man1/$(PIKE).1
190
	mv $(TMP)/usr/share/man/man1/pike.1 $(TMP)/usr/share/man/man1/$(PIKE).1
186
191
187
#	Fix permissions and shebang lines
192
#	Fix permissions and shebang lines
188
	-for f in `find $(TMP)/usr/bin $(TMP)/usr/lib -type f`; do \
193
	-for f in `find $(TMP)/usr/bin $(TMP)/usr/lib -type f`; do \
189
	  if file $$f | grep -q "script"; then \
194
	  if file $$f | grep -q "script"; then \
190
	    chmod a+x $$f; \
195
	    chmod a+x $$f; \
191
	    sed -ri -e 's@#!.*NOMODULE@#!/usr/bin/$(PIKE)@' \
196
	    sed -ri -e 's@#!.*NOMODULE@#!/usr/bin/$(PIKE)@' \
192
	            -e 's@#! */usr/local/bin/pike@#!/usr/bin/$(PIKE)@' \
197
	            -e 's@#! */usr/local/bin/pike@#!/usr/bin/$(PIKE)@' \
193
	            -e 's@#! */usr/bin/env.*pike@#!/usr/bin/$(PIKE)@' \
198
	            -e 's@#! */usr/bin/env.*pike@#!/usr/bin/$(PIKE)@' \
194
	        $$f; \
199
	        $$f; \
195
	  fi; \
200
	  fi; \
196
	done
201
	done
197
202
198
#	Don't install our own specs file - the ordinary one is not that bad really
203
#	Don't install our own specs file - the ordinary one is not that bad really
199
#	sed -e 's/@PIKEVERSION@/$(VERSION)/g' \
204
#	sed -e 's/@PIKEVERSION@/$(VERSION)/g' \
200
	    -e 's;@CONFIGURE_ARGS@;$(CFARGS);g' \
205
	    -e 's;@CONFIGURE_ARGS@;$(CFARGS);g' \
201
	    debian/specs.in > $(TMP)$(include_prefix)/specs
206
	    debian/specs.in > $(TMP)$(include_prefix)/specs
202
207
203
#	Install pike-config
208
#	Install pike-config
204
	sed -e "s#@CFLAGS@#-I$(include_prefix)#;s/@LDFLAGS@//" \
209
	sed -e "s#@CFLAGS@#-I$(include_prefix)#;s/@LDFLAGS@//" \
205
	    -e "s/@MAJOR@/$(MAJOR)/;s/@MINOR@/$(MINOR)/;s/@BUILD@/$(BUILD)/" \
210
	    -e "s/@MAJOR@/$(MAJOR)/;s/@MINOR@/$(MINOR)/;s/@BUILD@/$(BUILD)/" \
206
	    debian/pike-config.in > $(TMP)/usr/bin/$(PIKE)-config
211
	    debian/pike-config.in > $(TMP)/usr/bin/$(PIKE)-config
207
212
208
# 	# pike -x module fix
213
# 	# pike -x module fix
209
	sed -i -e 's;\$$(MODULE_BASE)/dynamic_module_makefile;\$$(PIKE_SRC_DIR)/dynamic_module_makefile;g' \
214
	sed -i -e 's;\$$(MODULE_BASE)/dynamic_module_makefile;\$$(PIKE_SRC_DIR)/dynamic_module_makefile;g' \
210
		$(TMP)$(include_prefix)/dynamic_module_makefile
215
		$(TMP)$(include_prefix)/dynamic_module_makefile
211
216
212
# Build architecture-independent files here.
217
# Build architecture-independent files here.
213
# Pass -i to all debhelper commands in this target to reduce clutter.
218
# Pass -i to all debhelper commands in this target to reduce clutter.
214
binary-indep: build-indep
219
binary-indep: build-indep
215
	dh_testdir -i
220
	dh_testdir -i
216
	dh_testroot -i
221
	dh_testroot -i
217
	# install the docs
222
	# install the docs
218
	dh_install -p$(PIKE)-manual refdoc/traditional_manual/* usr/share/doc/$(PIKE)-doc/html/manual
223
	dh_install -p$(PIKE)-manual refdoc/traditional_manual/* usr/share/doc/$(PIKE)-doc/html/manual
219
	dh_install -p$(PIKE)-reference refdoc/modref/* usr/share/doc/$(PIKE)-doc/html/reference
224
	dh_install -p$(PIKE)-reference refdoc/modref/* usr/share/doc/$(PIKE)-doc/html/reference
220
	dh_install -i -N$(PIKE)-manual -N$(PIKE)-reference --sourcedir=$(TMP)
225
	dh_install -i -N$(PIKE)-manual -N$(PIKE)-reference --sourcedir=$(TMP)
221
	dh_installdocs -i
226
	dh_installdocs -i
222
	dh_installchangelogs -i -k CHANGES
227
	dh_installchangelogs -i -k CHANGES
223
	dh_link -i
228
	dh_link -i
224
	dh_compress -i
229
	dh_compress -i
225
	dh_fixperms -i
230
	dh_fixperms -i
226
	dh_installdeb -i
231
	dh_installdeb -i
227
	dh_gencontrol -i
232
	dh_gencontrol -i
228
	dh_md5sums -i
233
	dh_md5sums -i
229
	dh_builddeb -i
234
	dh_builddeb -i
230
235
231
# Build architecture-dependent files here.
236
# Build architecture-dependent files here.
232
binary-arch: build-arch install
237
binary-arch: build-arch install
233
	dh_testdir -a
238
	dh_testdir -a
234
	dh_testroot -a
239
	dh_testroot -a
235
#	dh_installdebconf -a
240
#	dh_installdebconf -a
236
	dh_install -a -N$(PIKE)-core --sourcedir=debian/tmp $(DH_EXCLUDE)
241
	dh_install -a -N$(PIKE)-core --sourcedir=debian/tmp $(DH_EXCLUDE)
237
	dh_install -p$(PIKE)-core --sourcedir=debian/tmp $(DH_EXCLUDE) $(DH_ALREADY)
242
	dh_install -p$(PIKE)-core --sourcedir=debian/tmp $(DH_EXCLUDE) $(DH_ALREADY)
238
	for p in $(MODULE_PACKAGES) $(PIKE)-dev; do \
243
	for p in $(MODULE_PACKAGES) $(PIKE)-dev; do \
239
		dh_link -p$$p usr/share/doc/$(PIKE)-core usr/share/doc/$$p; \
244
		dh_link -p$$p usr/share/doc/$(PIKE)-core usr/share/doc/$$p; \
240
	done
245
	done
241
	dh_installdocs -a
246
	dh_installdocs -a
242
	dh_installmenu -a
247
	dh_installmenu -a
243
#	dh_installman -a
248
#	dh_installman -a
244
	dh_installchangelogs -a -k CHANGES
249
	dh_installchangelogs -a -k CHANGES
245
	dh_strip -a
250
	dh_strip -a
246
	dh_compress -a
251
	dh_compress -a
247
	dh_fixperms -a -X/run_autoconfig -X/precompile.sh -X/smartlink -X/fixdepends.sh -X/install_module -X/mktestsuite
252
	dh_fixperms -a -X/run_autoconfig -X/precompile.sh -X/smartlink -X/fixdepends.sh -X/install_module -X/mktestsuite
248
	dh_installdeb -a
253
	dh_installdeb -a
249
	dh_shlibdeps -a
254
	dh_shlibdeps -a
250
	dh_gencontrol -a
255
	dh_gencontrol -a
251
	dh_md5sums -a
256
	dh_md5sums -a
252
	dh_builddeb -a
257
	dh_builddeb -a
253
258
254
binary: binary-indep binary-arch
259
binary: binary-indep binary-arch
255
.PHONY: build clean binary-indep binary-arch binary install configure
260
.PHONY: build clean binary-indep binary-arch binary install configure