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