Rev 27 | 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 | --with-cflags='$(CFLAGS_EXTRA)' \ |
| 93 | --with-cppflags='$(CPPFLAGS_EXTRA)' \ |
||
| 2 | magnus | 94 | --with-bignums \ |
| 95 | --with-gmp \ |
||
| 96 | --with-poll \ |
||
| 97 | --with-zlib \ |
||
| 98 | --with-freetype \ |
||
| 3 | magnus | 99 | --without-ttflib \ |
| 2 | magnus | 100 | --with-libnettle \ |
| 101 | --without-sybase \ |
||
| 3 | magnus | 102 | --without-java \ |
| 2 | magnus | 103 | --with-odbc \ |
| 104 | --with-sane \ |
||
| 105 | --with-postgres \ |
||
| 12 | magnus | 106 | --with-postgres-include-dir=`pg_config --includedir` \ |
| 2 | magnus | 107 | --with-libpq-dir=/usr/lib \ |
| 108 | --with-perl \ |
||
| 109 | --without-ffmpeg \ |
||
| 12 | magnus | 110 | --without-fftw \ |
| 2 | magnus | 111 | --without-libpdf \ |
| 3 | magnus | 112 | --without-libpanda \ |
| 2 | magnus | 113 | --without-GTK \ |
| 3 | magnus | 114 | --without-GTK2 \ |
| 12 | magnus | 115 | --without-bundles \ |
| 3 | magnus | 116 | $(MACHINE_OPTS) $(EXTRA_ARGS) |
| 2 | magnus | 117 | |
| 3 | magnus | 118 | include_prefix=/usr/include/pike/$(VERSION) |
| 119 | lib_prefix=/usr/lib/pike/$(VERSION) |
||
| 2 | magnus | 120 | |
| 3 | magnus | 121 | MODULE_PACKAGES=$(shell dh_listpackages -a -N $(PIKE)-core -N $(PIKE)-dev) |
| 122 | #{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}. |
||
| 123 | #usr/lib/pike/*/modules/Sql.pmod/{module,Sql,rsql,sql_*}.* |
||
| 124 | |||
| 12 | magnus | 125 | excluded_modules:=Ssleay Mird Msql msql PDF Ffmpeg Oracle oracle sybase Gnome GTK GDK DVB Java TTF |
| 3 | magnus | 126 | # This is tricky. Note that it's only possible for an exclusion to match the last |
| 127 | # component specified in an .install file or on the command line, and below. |
||
| 128 | DH_EXCLUDE:=$(addprefix -X,$(excluded_modules)) |
||
| 129 | DH_ALREADY=`for p in $(MODULE_PACKAGES); do \ |
||
| 130 | find debian/$$p/usr/lib/pike/*/* -type f -printf "-X%P "; done` |
||
| 131 | |||
| 132 | TMP=$(CURDIR)/debian/tmp |
||
| 133 | |||
| 12 | magnus | 134 | #export CFLAGS CC PIKE VERSION |
| 135 | export CC |
||
| 2 | magnus | 136 | |
| 137 | build-arch: build-arch-stamp |
||
| 138 | build-arch-stamp: $(DPATCH_STAMPFN) |
||
| 139 | dh_testdir |
||
| 140 | |||
| 141 | # Add here command to compile/build the package. |
||
| 142 | $(MAKE) compile CONFIGUREARGS="$(CFARGS)" |
||
| 143 | touch build-arch-stamp |
||
| 144 | |||
| 145 | build-indep: build-indep-stamp |
||
| 146 | build-indep-stamp: $(DPATCH_STAMPFN) |
||
| 147 | dh_testdir |
||
| 148 | |||
| 149 | # Add here command to compile/build the arch indep package. |
||
| 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 |
||
| 162 | |||
| 163 | # Add here commands to clean up after the build process. |
||
| 12 | magnus | 164 | $(MAKE) distclean |
| 2 | magnus | 165 | rm -rf refdoc/modref refdoc/traditional_manual |
| 166 | |||
| 167 | install: DH_OPTIONS= |
||
| 3 | magnus | 168 | install: build-arch |
| 2 | magnus | 169 | dh_testdir |
| 170 | dh_testroot |
||
| 171 | dh_clean -k |
||
| 172 | |||
| 3 | magnus | 173 | $(MAKE) INSTALLARGS=--traditional \ |
| 174 | buildroot=$(TMP) \ |
||
| 175 | prefix=/usr \ |
||
| 176 | man_prefix=/usr/share/man \ |
||
| 177 | lib_prefix="$(lib_prefix)" \ |
||
| 178 | include_prefix="$(include_prefix)" \ |
||
| 2 | magnus | 179 | pike_name=/usr/bin/$(PIKE) \ |
| 3 | magnus | 180 | install_nodoc |
| 2 | magnus | 181 | |
| 3 | magnus | 182 | # Some cleaning |
| 183 | find "$(TMP)$(lib_prefix)" -name '.autodoc' -type f -exec rm -f '{}' ';' |
||
| 2 | magnus | 184 | |
| 3 | magnus | 185 | install -d -m755 $(TMP)/usr/share/pixmaps |
| 186 | install -m644 debian/pike.xpm $(TMP)/usr/share/pixmaps/$(PIKE).xpm |
||
| 187 | mv $(TMP)/usr/bin/pike $(TMP)/usr/bin/$(PIKE) |
||
| 188 | mv $(TMP)/usr/share/man/man1/pike.1 $(TMP)/usr/share/man/man1/$(PIKE).1 |
||
| 2 | magnus | 189 | |
| 3 | magnus | 190 | # Fix permissions and shebang lines |
| 191 | -for f in `find $(TMP)/usr/bin $(TMP)/usr/lib -type f`; do \ |
||
| 192 | if file $$f | grep -q "script"; then \ |
||
| 193 | chmod a+x $$f; \ |
||
| 194 | sed -ri -e 's@#!.*NOMODULE@#!/usr/bin/$(PIKE)@' \ |
||
| 195 | -e 's@#! */usr/local/bin/pike@#!/usr/bin/$(PIKE)@' \ |
||
| 196 | -e 's@#! */usr/bin/env.*pike@#!/usr/bin/$(PIKE)@' \ |
||
| 197 | $$f; \ |
||
| 198 | fi; \ |
||
| 2 | magnus | 199 | done |
| 200 | |||
| 12 | magnus | 201 | # Don't install our own specs file - the ordinary one is not that bad really |
| 202 | # sed -e 's/@PIKEVERSION@/$(VERSION)/g' \ |
||
| 2 | magnus | 203 | -e 's;@CONFIGURE_ARGS@;$(CFARGS);g' \ |
| 12 | magnus | 204 | debian/specs.in > $(TMP)$(include_prefix)/specs |
| 2 | magnus | 205 | |
| 3 | magnus | 206 | # Install pike-config |
| 12 | magnus | 207 | sed -e "s#@CFLAGS@#-I$(include_prefix)#;s/@LDFLAGS@//" \ |
| 3 | magnus | 208 | -e "s/@MAJOR@/$(MAJOR)/;s/@MINOR@/$(MINOR)/;s/@BUILD@/$(BUILD)/" \ |
| 209 | debian/pike-config.in > $(TMP)/usr/bin/$(PIKE)-config |
||
| 2 | magnus | 210 | |
| 3 | magnus | 211 | # # pike -x module fix |
| 212 | sed -i -e 's;\$$(MODULE_BASE)/dynamic_module_makefile;\$$(PIKE_SRC_DIR)/dynamic_module_makefile;g' \ |
||
| 213 | $(TMP)$(include_prefix)/dynamic_module_makefile |
||
| 2 | magnus | 214 | |
| 215 | # Build architecture-independent files here. |
||
| 216 | # Pass -i to all debhelper commands in this target to reduce clutter. |
||
| 3 | magnus | 217 | binary-indep: build-indep |
| 2 | magnus | 218 | dh_testdir -i |
| 219 | dh_testroot -i |
||
| 3 | magnus | 220 | # install the docs |
| 221 | dh_install -p$(PIKE)-manual refdoc/traditional_manual/* usr/share/doc/$(PIKE)-doc/html/manual |
||
| 222 | dh_install -p$(PIKE)-reference refdoc/modref/* usr/share/doc/$(PIKE)-doc/html/reference |
||
| 223 | dh_install -i -N$(PIKE)-manual -N$(PIKE)-reference --sourcedir=$(TMP) |
||
| 2 | magnus | 224 | dh_installdocs -i |
| 12 | magnus | 225 | dh_installchangelogs -i -k CHANGES |
| 2 | magnus | 226 | dh_link -i |
| 227 | dh_compress -i |
||
| 228 | dh_fixperms -i |
||
| 229 | dh_installdeb -i |
||
| 230 | dh_gencontrol -i |
||
| 231 | dh_md5sums -i |
||
| 232 | dh_builddeb -i |
||
| 233 | |||
| 234 | # Build architecture-dependent files here. |
||
| 235 | binary-arch: build-arch install |
||
| 236 | dh_testdir -a |
||
| 237 | dh_testroot -a |
||
| 238 | # dh_installdebconf -a |
||
| 12 | magnus | 239 | dh_install -a -N$(PIKE)-core --sourcedir=debian/tmp $(DH_EXCLUDE) |
| 3 | magnus | 240 | dh_install -p$(PIKE)-core --sourcedir=debian/tmp $(DH_EXCLUDE) $(DH_ALREADY) |
| 12 | magnus | 241 | for p in $(MODULE_PACKAGES) $(PIKE)-dev; do \ |
| 3 | magnus | 242 | dh_link -p$$p usr/share/doc/$(PIKE)-core usr/share/doc/$$p; \ |
| 243 | done |
||
| 2 | magnus | 244 | dh_installdocs -a |
| 3 | magnus | 245 | dh_installmenu -a |
| 246 | # dh_installman -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 |