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