Subversion Repositories

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

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