Subversion Repositories

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

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

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