Subversion Repositories

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

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