Rev 3 | Go to most recent revision | Details | 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 | PIKEV=7.6 | ||
| 17 | PIKE=pike$(PIKEV) | ||
| 18 | |||
| 19 | ifdef CCVER | ||
| 20 | CC=gcc-$(CCVER) | ||
| 21 | else | ||
| 22 | CC=gcc | ||
| 23 | endif | ||
| 24 | |||
| 25 | ifeq (,$(DEB_BUILD_ARCH)) | ||
| 26 | DEB_BUILD_ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH) | ||
| 27 | endif | ||
| 28 | |||
| 29 | CPPFLAGS_EXTRA = -DDEBIAN | ||
| 30 | |||
| 31 | ifdef SSP | ||
| 32 | SSP_FLAGS=-fstack-protector | ||
| 33 | endif | ||
| 34 | |||
| 35 | ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) | ||
| 36 | CFARGSEXTRA=--without-rtldebug --without-cdebug --without-debug --without-copt | ||
| 37 | else | ||
| 38 | CFARGSEXTRA=--without-rtldebug --without-cdebug --without-debug | ||
| 39 | endif | ||
| 40 | |||
| 41 | # Temporary workaround for hppa linker issues | ||
| 42 | ifeq ($(DEB_BUILD_ARCH),hppa) | ||
| 43 | CFLAGS_EXTRA += -ffunction-sections | ||
| 44 | endif | ||
| 45 | |||
| 46 | ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) | ||
| 47 | CFARGSEXTRA += --with-rtldebug --with-cdebug --with-debug | ||
| 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 | |||
| 79 | VERSION:=$(shell dpkg-parsechangelog | grep ^Version | sed -e 's/Version: //;s/-[^-]*$$//') | ||
| 80 | OS=$(shell uname -srm|sed -e 's/ /-/g'|tr '[A-Z]' '[a-z]'|tr '/' '_') | ||
| 81 | BUILDDIR=build/$(OS) | ||
| 82 | CFARGS=$(CFARGSEXTRA) \ | ||
| 83 | --prefix=/usr | ||
| 84 | --with-cflags="$(CFLAGS_EXTRA)" \ | ||
| 85 | --with-cppflags="$(CPPFLAGS_EXTRA)" \ | ||
| 86 | --with-bignums \ | ||
| 87 | --with-gmp \ | ||
| 88 | --with-poll \ | ||
| 89 | --with-zlib \ | ||
| 90 | --with-freetype \ | ||
| 91 | --with-ttflib \ | ||
| 92 | --with-libnettle \ | ||
| 93 | --without-libpdf \ | ||
| 94 | --without-libpanda \ | ||
| 95 | --without-sybase \ | ||
| 96 | --with-java \ | ||
| 97 | --with-odbc \ | ||
| 98 | --with-sane \ | ||
| 99 | --with-postgres \ | ||
| 100 | --with-postgres-include-dir=/usr/include/postgresql \ | ||
| 101 | --with-libpq-dir=/usr/lib \ | ||
| 102 | --with-perl \ | ||
| 103 | --without-ffmpeg \ | ||
| 104 | --without-libpdf \ | ||
| 105 | --without-libpanda $(MACHINE_OPTS) $(EXTRA_ARGS) \ | ||
| 106 | --without-GTK \ | ||
| 107 | --with-GTK2 | ||
| 108 | |||
| 109 | RUNPIKE=$(CURDIR)/$(BUILDDIR)/pike -DNOT_INSTALLED -DPRECOMPILED_SEARCH_MORE -m$(CURDIR)/$(BUILDDIR)/master.pike | ||
| 110 | RUNPIKE2=$(CURDIR)/debian/$(PIKE)-core/usr/bin/pike -m$(CURDIR)/$(BUILDDIR)/lib/master.pike | ||
| 111 | PIKE_FAKEROOT=$(CURDIR)/debian/$(PIKE)-core | ||
| 112 | PIKE_FAKEROOT_OMIT=$(BUILDDIR)*:$(CURDIR)/lib*:$(CURDIR)/src*:$(CURDIR)/bin*:$(CURDIR)/man*:$(BUILDDIR)/lib*:$(CURDIR)*:$(CURDIR)/debian/$(PIKE)-core* | ||
| 113 | |||
| 114 | export CFLAGS CC PIKE VERSION | ||
| 115 | |||
| 116 | build-arch: build-arch-stamp | ||
| 117 | build-arch-stamp: $(DPATCH_STAMPFN) | ||
| 118 | dh_testdir | ||
| 119 | |||
| 120 | # Add here command to compile/build the package. | ||
| 121 | $(MAKE) compile CONFIGUREARGS="$(CFARGS)" | ||
| 122 | touch build-arch-stamp | ||
| 123 | |||
| 124 | build-indep: build-indep-stamp | ||
| 125 | build-indep-stamp: $(DPATCH_STAMPFN) | ||
| 126 | dh_testdir | ||
| 127 | |||
| 128 | # Add here command to compile/build the arch indep package. | ||
| 129 | # It's ok not to do anything here, if you don't need to build | ||
| 130 | # anything for this package. | ||
| 131 | #/usr/bin/docbook-to-man debian/$(PIKE).sgml > $(PIKE).1 | ||
| 132 | |||
| 133 | $(MAKE) documentation CONFIGUREARGS="$(CFARGS)" | ||
| 134 | touch build-indep-stamp | ||
| 135 | |||
| 136 | build: build-arch build-indep | ||
| 137 | |||
| 138 | clean: clean-patched unpatch | ||
| 139 | dh_clean | ||
| 140 | rm -rf debian/pike7.6-gtk | ||
| 141 | |||
| 142 | clean-patched: | ||
| 143 | dh_testdir | ||
| 144 | dh_testroot | ||
| 145 | rm -f build-stamp build-arch-stamp build-indep-stamp configure-stamp | ||
| 146 | |||
| 147 | # Add here commands to clean up after the build process. | ||
| 148 | -$(MAKE) distclean | ||
| 149 | rm -rf refdoc/modref refdoc/traditional_manual | ||
| 150 | |||
| 151 | install: DH_OPTIONS= | ||
| 152 | install: build | ||
| 153 | dh_testdir | ||
| 154 | dh_testroot | ||
| 155 | dh_clean -k | ||
| 156 | dh_installdirs | ||
| 157 | |||
| 158 | # Add here commands to install the package into debian/tmp. | ||
| 159 | $(MAKE) -C$(BUILDDIR)/ \ | ||
| 160 | buildroot=$(CURDIR)/debian/tmp \ | ||
| 161 | prefix=/usr/lib \ | ||
| 162 | pike_name=/usr/bin/$(PIKE) \ | ||
| 163 | include_prefix="/usr/include/pike/$(VERSION)/" \ | ||
| 164 | install | ||
| 165 | |||
| 166 | # Some cleaning | ||
| 167 | # -rm -f `find $(CURDIR)/debian/tmp/usr/lib/pike/$(VERSION)/ -name ".autodoc" -type f -print` | ||
| 168 | # -@for f in `cat $(CURDIR)/debian/toremove.txt | sed -e 's/@PIKE@/$(PIKE)/g;s/@VERSION@/$(VERSION)/g'`; do \ | ||
| 169 | # echo Removing $(CURDIR)/debian/$(PIKE)-core/$$f ; \ | ||
| 170 | # rm $(CURDIR)/debian/$(PIKE)-core/$$f &> /dev/null || echo " FAILED"; \ | ||
| 171 | # done | ||
| 172 | |||
| 173 | # an eye-candy | ||
| 174 | install -d -m 755 -o root -g root $(CURDIR)/debian/$(PIKE)-core/usr/share/pixmaps/pike | ||
| 175 | install -m 644 -o root -g root $(CURDIR)/debian/pike.xpm $(CURDIR)/debian/$(PIKE)-core/usr/share/pixmaps/pike/$(PIKE).xpm | ||
| 176 | |||
| 177 | # install the docs | ||
| 178 | mkdir -p $(CURDIR)/debian/$(PIKE)-doc/usr/share/doc/$(PIKE)-doc/html/manual | ||
| 179 | dh_install --sourcedir=$(CURDIR) -p$(PIKE)-manual refdoc/traditional_manual/* usr/share/doc/$(PIKE)-doc/html/manual | ||
| 180 | mkdir -p $(CURDIR)/debian/$(PIKE)-manual/usr/share/doc/$(PIKE)-doc/html/manual | ||
| 181 | install -m 644 -o root -g root $(CURDIR)/debian/dhelp.manual $(CURDIR)/debian/$(PIKE)-manual/usr/share/doc/$(PIKE)-doc/html/manual/.dhelp | ||
| 182 | |||
| 183 | mkdir -p $(CURDIR)/debian/$(PIKE)-doc/usr/share/doc/$(PIKE)-doc/html/reference | ||
| 184 | mkdir -p $(CURDIR)/debian/$(PIKE)-reference/usr/share/doc/$(PIKE)-doc/html/reference/ | ||
| 185 | dh_install --sourcedir=$(CURDIR) -p$(PIKE)-reference refdoc/modref/* usr/share/doc/$(PIKE)-doc/html/reference | ||
| 186 | install -m 644 -o root -g root $(CURDIR)/debian/dhelp.refdoc $(CURDIR)/debian/$(PIKE)-reference/usr/share/doc/$(PIKE)-doc/html/reference/.dhelp | ||
| 187 | |||
| 188 | ln -sf ../lib/pike/$(VERSION)/bin/pike $(CURDIR)/debian/$(PIKE)-core/usr/bin/$(PIKE) | ||
| 189 | install -m 644 -o root -g root $(CURDIR)/man/pike.1 $(CURDIR)/debian/$(PIKE)-core/usr/share/man/man1/$(PIKE).1 | ||
| 190 | rm -rf $(CURDIR)/debian/$(PIKE)-core/usr/lib/pike/$(VERSION)/man/ | ||
| 191 | |||
| 192 | install -d -m 755 -o root -g root $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/ | ||
| 193 | mv $(CURDIR)/debian/$(PIKE)-core/usr/lib/pike/$(VERSION)/include/pike \ | ||
| 194 | $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/$(VERSION) ; \ | ||
| 195 | rm -rf $(CURDIR)/debian/$(PIKE)-core/usr/lib/pike/$(VERSION)/include | ||
| 196 | chmod 644 `find $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/$(VERSION)/ -type f -print` | ||
| 197 | |||
| 198 | # move all the *.pmod and *.pike files to /usr/share recreating the structure | ||
| 199 | install -d -m 755 -o root -g root $(CURDIR)/debian/$(PIKE)-core/usr/share/pike/$(VERSION) | ||
| 200 | for f in `(cd $(CURDIR)/debian/$(PIKE)-core/usr/lib/pike/$(VERSION)/lib/ && find -name "*.pmod" -print -o -name "*.pike" -print)`; do \ | ||
| 201 | install -d -m 755 -o root -g root $(CURDIR)/debian/$(PIKE)-core/usr/share/pike/$(VERSION)/lib/`dirname $$f`/; \ | ||
| 202 | if [ -f $(CURDIR)/debian/$(PIKE)-core/usr/lib/pike/$(VERSION)/lib/$$f ]; then \ | ||
| 203 | mv $(CURDIR)/debian/$(PIKE)-core/usr/lib/pike/$(VERSION)/lib/$$f $(CURDIR)/debian/$(PIKE)-core/usr/share/pike/$(VERSION)/lib/$$f; \ | ||
| 204 | (echo /usr/share/pike/$(VERSION)/lib/$$f /usr/lib/pike/$(VERSION)/lib/$$f | sed -e 's#/./#/#g') >> $(CURDIR)/debian/links; \ | ||
| 205 | fi; \ | ||
| 206 | done | ||
| 207 | dh_link && rm -f $(CURDIR)/debian/links | ||
| 208 | |||
| 209 | 	sed -e "`$(RUNPIKE) -e 'write("s#@CFLAGS@#%s#g;s/@LDFLAGS@//g;s/@MAJOR@/%d/g; s/@MINOR@/%d/g; s/@BUILD@/%d/g","-I/usr/include/pike/$(VERSION)/", __REAL_MAJOR__, __REAL_MINOR__, __REAL_BUILD__);'`" \ | ||
| 210 | $(CURDIR)/debian/pike-config.in > $(CURDIR)/debian/$(PIKE)-dev/usr/bin/$(PIKE)-config | ||
| 211 | |||
| 212 | # Fix permissions | ||
| 213 | 	find $(CURDIR)/debian/$(PIKE)-core/usr/lib/pike/$(VERSION) -type f -exec chmod -x '{}' ';' | ||
| 214 | chmod 755 $(CURDIR)/debian/$(PIKE)-core/usr/lib/pike/$(VERSION)/bin/pike | ||
| 215 | |||
| 216 | for f in `find $(CURDIR)/debian/$(PIKE)-core/usr/bin -type f` \ | ||
| 217 | `find $(CURDIR)/debian/$(PIKE)-core/usr/lib/pike/$(VERSION) -type f` \ | ||
| 218 | `find $(CURDIR)/debian/$(PIKE)-core/usr/share/pike/$(VERSION) -type f`; \ | ||
| 219 | do \ | ||
| 220 | file $$f | grep "script" >/dev/null \ | ||
| 221 | && perl -pi -e 's@#\!.*NOMODULE@#\!/usr/bin/$(PIKE)@' $$f \ | ||
| 222 | && chmod a+x $$f; \ | ||
| 223 | file $$f | grep "script" >/dev/null \ | ||
| 224 | && perl -pi -e 's@#\!.*/usr/local/bin/pike@#\!/usr/bin/$(PIKE)@' $$f; \ | ||
| 225 | file $$f | grep "script" >/dev/null \ | ||
| 226 | && perl -pi -e 's@#\!.*/usr/bin/env.*pike@#\!/usr/bin/$(PIKE)@' $$f; \ | ||
| 227 | done; exit 0 | ||
| 228 | |||
| 229 | 	find build/ -name precompile.sh -exec 'cp {} $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/$(VERSION)' \; | ||
| 230 | 	find build/ -name smartlink -exec 'cp {} $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/$(VERSION)' \; | ||
| 231 | cp ./bin/fixdepends.sh ./bin/install_module ./bin/mktestsuite $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/$(VERSION) | ||
| 232 | |||
| 233 | # Some more permission changes | ||
| 234 | for f in run_autoconfig precompile.sh smartlink fixdepends.sh install_module mktestsuite; do \ | ||
| 235 | chmod 755 $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/$(VERSION)/$$f ; \ | ||
| 236 | done | ||
| 237 | |||
| 238 | # Create the documentation links to save space | ||
| 239 | for f in `cat $(CURDIR)/debian/tocoredoc.txt`; do \ | ||
| 240 | dh_link -p$$f /usr/share/doc/$(PIKE)-core /usr/share/doc/$$f ; \ | ||
| 241 | done | ||
| 242 | |||
| 243 | # install the specs file | ||
| 244 | sed -e 's/@PIKEVERSION@/$(VERSION)/g' \ | ||
| 245 | -e 's;@CONFIGURE_ARGS@;$(CFARGS);g' \ | ||
| 246 | < $(CURDIR)/debian/specs.in > $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/$(VERSION)/specs | ||
| 247 | |||
| 248 | # pike -x module fix | ||
| 249 | echo 's;\$$\(MODULE_BASE\)/dynamic_module_makefile;\$$\(PIKE_SRC_DIR\)/dynamic_module_makefile;g' > \ | ||
| 250 | $(CURDIR)/debian/sed-script.tmp | ||
| 251 | sed -r -f $(CURDIR)/debian/sed-script.tmp < \ | ||
| 252 | $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/$(VERSION)/dynamic_module_makefile > \ | ||
| 253 | $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/$(VERSION)/dynamic_module_makefile.new | ||
| 254 | mv $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/$(VERSION)/dynamic_module_makefile.new \ | ||
| 255 | $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/$(VERSION)/dynamic_module_makefile | ||
| 256 | rm -f $(CURDIR)/debian/sed-script.tmp | ||
| 257 | |||
| 258 | rm -r $(CURDIR)/debian/$(PIKE)-core/usr/lib/pike/$(VERSION)/doc | ||
| 259 | dh_install --sourcedir=debian/tmp | ||
| 260 | |||
| 261 | # Need to move dynamic_module_makefile back to -core, since it contains platform-specific stuff | ||
| 262 | # mv $(CURDIR)/debian/$(PIKE)-dev/usr/include/pike/$(VERSION)/dynamic_module_makefile \ | ||
| 263 | # $(CURDIR)/debian/$(PIKE)-core/usr/include/pike/$(VERSION)/dynamic_module_makefile | ||
| 264 | |||
| 265 | # Build architecture-independent files here. | ||
| 266 | # Pass -i to all debhelper commands in this target to reduce clutter. | ||
| 267 | binary-indep: build-indep install | ||
| 268 | dh_testdir -i | ||
| 269 | dh_testroot -i | ||
| 270 | dh_installdocs -i | ||
| 271 | dh_installchangelogs -i | ||
| 272 | dh_link -i | ||
| 273 | dh_compress -i | ||
| 274 | dh_fixperms -i | ||
| 275 | dh_installdeb -i | ||
| 276 | dh_gencontrol -i | ||
| 277 | dh_md5sums -i | ||
| 278 | dh_builddeb -i | ||
| 279 | |||
| 280 | # Build architecture-dependent files here. | ||
| 281 | binary-arch: build-arch install | ||
| 282 | dh_testdir -a | ||
| 283 | dh_testroot -a | ||
| 284 | # dh_installdebconf -a | ||
| 285 | dh_installdocs -a | ||
| 286 | dh_installmenu -a -p$(PIKE)-core | ||
| 287 | dh_installman -p$(PIKE)-core debian/tmp/usr/share/man/man1/$(PIKE).1 | ||
| 288 | dh_installchangelogs -a | ||
| 289 | dh_strip -a | ||
| 290 | dh_link -a | ||
| 291 | dh_compress -a | ||
| 292 | dh_fixperms -a | ||
| 293 | dh_installdeb -a | ||
| 294 | dh_shlibdeps -a | ||
| 295 | dh_gencontrol -a | ||
| 296 | dh_md5sums -a | ||
| 297 | dh_builddeb -a | ||
| 298 | |||
| 299 | binary: binary-indep binary-arch | ||
| 300 | .PHONY: build clean binary-indep binary-arch binary install configure |