Subversion Repositories

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

Rev 27 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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