Subversion Repositories

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

Rev 93 | Rev 95 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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