#!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 export DH_OPTIONS export CXXFLAGS = -fno-strict-aliasing export CFLAGS = -fno-strict-aliasing configure: configure-stamp configure-stamp: dh_testdir # Add here commands to configure the package. touch configure-stamp patch: dh_testdir dpatch apply-all unpatch: dpatch deapply-all #rm -f patch-stamp build: build-stamp build-stamp: patch # create a dummy ipsec.secrets file before building the package so # that no RSA keys are created during the build process # (a package should not include a RSA key, it should produce the key # on demand, e.g. in the postinst script) touch $(CURDIR)/debian/ipsec.secrets $(MAKE) programs INC_USRLOCAL=/usr \ FINALBINDIR=/usr/lib/ipsec \ FINALLIBEXECDIR=/usr/lib/ipsec \ PUBDIR=/usr/sbin \ MANTREE=/usr/share/man \ CONFDIR=$(CURDIR)/debian \ USE_LDAP=true USE_LIBCURL=true HAVE_THREADS=true \ USE_XAUTH=true USE_XAUTHPAM=true # remove the temporary file, it will be created during install rm -f $(CURDIR)/debian/ipsec.secrets # here we re-generate the upstream HTML documentation $(MAKE) -C doc/ index.html touch build-stamp clean: unpatch dh_testdir dh_testroot rm -f build-stamp configure-stamp [ ! -f Makefile ] || $(MAKE) clean # after a make clean, no binaries _should_ be left, but .... -find $(CURDIR) -name "*.o" | xargs --no-run-if-empty rm -find $(CURDIR)/lib/libcrypto -name "*.a" | xargs --no-run-if-empty rm rm -rf debian/openswan-modules-source-build/ # Really clean (#356716) # This is a hack: should be better implemented rm -f lib/libopenswan/libopenswan.a || true rm -f lib/libopenswan/liboswlog.a || true rm -rf OBJ.* || true rm -rf doc/manpage.d/*.html || true rm -f doc/index.html || true # just in case something went wrong rm -f $(CURDIR)/debian/ipsec.secrets # and make sure that template are up-to-date debconf-updatepo dh_clean install-openswan: DH_OPTIONS=-a install-openswan: build dh_testdir dh_testroot dh_prep dh_installdirs # Add here commands to install the package into debian/tmp. $(MAKE) install INC_USRLOCAL=/usr \ FINALBINDIR=/usr/lib/ipsec \ FINALLIBEXECDIR=/usr/lib/ipsec \ PUBDIR=$(CURDIR)/debian/openswan/usr/sbin \ MANTREE=$(CURDIR)/debian/openswan/usr/share/man \ DESTDIR=$(CURDIR)/debian/openswan rm -rf $(CURDIR)/debian/openswan/usr/local install --mode=0600 $(CURDIR)/debian/ipsec.secrets.proto $(CURDIR)/debian/openswan/etc/ipsec.secrets rm -f $(CURDIR)/debian/openswan/etc/init.d/ipsec?* rm -f $(CURDIR)/debian/openswan/usr/lib/ipsec/_plutorun?* # this is handled by update-rc.d rm -rf $(CURDIR)/debian/openswan/etc/rc?.d # delete var/lock/subsys and var/run to satisfy lintian rm -rf $(CURDIR)/debian/openswan/var/lock rm -rf $(CURDIR)/debian/openswan/var/run # fix some manpage issues mv $(CURDIR)/debian/openswan/usr/share/man/man3/ipsec_ipsec_strerror.3 $(CURDIR)/debian/openswan/usr/share/man/man3/ipsec_strerror.3 mv $(CURDIR)/debian/openswan/usr/share/man/man3/ipsec_ipsec_set_policy.3 $(CURDIR)/debian/openswan/usr/share/man/man3/ipsec_set_policy.3 find $(CURDIR)/debian/openswan/usr/share/man -name "ipsec_ipsec*" | xargs --no-run-if-empty rm # now we move the docs into seperate package mkdir -p "$(CURDIR)/debian/openswan-doc/usr/share/doc" mv $(CURDIR)/debian/openswan/usr/share/doc/openswan $(CURDIR)/debian/openswan-doc/usr/share/doc/openswan-doc #ls $(CURDIR)/debian/openswan/usr/share/doc/openswan dh_installdocs -popenswan -n dh_installchangelogs CHANGES # openswan-dbg depends on openswan so no need to ship doc twice rm -rf $(CURDIR)/debian/openswan-dbg/usr/share/doc/openswan-dbg # change the paths in the installed doc files (but only in regular # files, not in links to the outside of the build tree !) ( cd $(CURDIR)/debian/openswan/; \ for f in `grep "/usr/local/" --recursive --files-with-match *`; \ do \ if [ -f $$f -a ! -L $$f ]; then \ cp $$f $$f.old; \ sed 's/\/usr\/local\//\/usr\//' $$f.old > $$f; \ rm $$f.old; \ fi; \ done ) # but remove the doc/src dir, which just duplicates the HTML files rm -rf $(CURDIR)/debian/openswan/usr/share/doc/openswan/doc/src # and the index file in the main doc directory - it's replicated under # doc/ rm -f $(CURDIR)/debian/openswan/usr/share/doc/openswan/index.html # the logcheck ignore files install -D --mode=0600 $(CURDIR)/debian/logcheck.ignore.paranoid $(CURDIR)/debian/openswan/etc/logcheck/ignore.d.paranoid/openswan install -D --mode=0600 $(CURDIR)/debian/logcheck.ignore.server $(CURDIR)/debian/openswan/etc/logcheck/ignore.d.server/openswan install -D --mode=0600 $(CURDIR)/debian/logcheck.ignore.server $(CURDIR)/debian/openswan/etc/logcheck/ignore.d.workstation/openswan install -D --mode=0600 $(CURDIR)/debian/logcheck.violations.ignore $(CURDIR)/debian/openswan/etc/logcheck/violations.ignore.d/openswan # set permissions on ipsec.secrets chmod 600 $(CURDIR)/debian/openswan/etc/ipsec.secrets chmod 644 $(CURDIR)/debian/openswan/etc/ipsec.conf chmod 700 -R $(CURDIR)/debian/openswan/etc/ipsec.d/private/ # don't know why they come with +x set by default... chmod 644 $(CURDIR)/debian/openswan/etc/ipsec.d/policies/* chmod 644 $(CURDIR)/debian/openswan/etc/ipsec.d/examples/* # more lintian cleanups find $(CURDIR)/debian/openswan -name ".cvsignore" | xargs --no-run-if-empty rm -f find $(CURDIR)/debian/openswan -name ".gitignore" | xargs --no-run-if-empty rm -f find $(CURDIR)/debian/openswan -name ".svn" -a -type d | xargs --no-run-if-empty rm -rf # Empty directory rmdir $(CURDIR)/debian/openswan/usr/bin install-openswan-doc: DH_OPTIONS=-popenswan-doc install-openswan-doc: build dh_testdir dh_testroot dh_installdocs -popenswan-doc -n dh_installchangelogs CHANGES # more lintian cleanups find $(CURDIR)/debian/openswan-doc -name ".cvsignore" | xargs --no-run-if-empty rm -f find $(CURDIR)/debian/openswan-doc -name ".svn" -a -type d | xargs --no-run-if-empty rm -rf install-openswan-modules-source: DH_OPTIONS=-popenswan-modules-source install-openswan-modules-source: PKGDIR=$(CURDIR)/debian/openswan-modules-source install-openswan-modules-source: BUILDDIR=$(CURDIR)/debian/openswan-modules-source-build install-openswan-modules-source: patch dh_testdir dh_testroot dh_installdirs mkdir -p "$(BUILDDIR)/modules/openswan" mkdir -p "$(BUILDDIR)/modules/openswan/lib" mkdir -p "$(BUILDDIR)/modules/openswan/debian" mkdir -p "$(BUILDDIR)/modules/openswan/packaging" cp -r CHANGES CREDITS Makefile Makefile.top Makefile.inc Makefile.ver linux/ \ "$(BUILDDIR)/modules/openswan" cp -r lib/libcrypto "$(BUILDDIR)/modules/openswan/lib/" cp -r packaging/makefiles packaging/linus packaging/utils packaging/defaults/ \ "$(BUILDDIR)/modules/openswan/packaging/" find "$(BUILDDIR)/modules/openswan/lib/" -name "*.o" | xargs --no-run-if-empty rm install --mode=644 debian/openswan-modules-source.kernel-config "$(BUILDDIR)/modules/openswan/config-all.h" install --mode=755 debian/openswan-modules-source.rules "$(BUILDDIR)/modules/openswan/debian/rules" install --mode=644 debian/openswan-modules-source.control.in "$(BUILDDIR)/modules/openswan/debian/control.in" install --mode=644 debian/changelog "$(BUILDDIR)/modules/openswan/debian/" install --mode=644 debian/copyright "$(BUILDDIR)/modules/openswan/debian/" install --mode=644 debian/NEWS "$(BUILDDIR)/modules/openswan/debian/" install --mode=644 debian/README.Debian "$(BUILDDIR)/modules/openswan/debian/" tar -C $(BUILDDIR) -c modules/ | bzip2 -9 > \ "$(PKGDIR)/usr/src/openswan-modules.tar.bz2" dh_installdocs -popenswan-modules-source -n dh_installchangelogs CHANGES # more lintian cleanups find $(PKGDIR) -name ".cvsignore" | xargs --no-run-if-empty rm -f find $(PKGDIR) -name ".svn" -a -type d | xargs --no-run-if-empty rm -rf install-openswan-modules-dkms: DH_OPTIONS=-popenswan-modules-dkms install-openswan-modules-dkms: VERSION:=$(shell dpkg-parsechangelog | grep '^Version:' | cut -d' ' -f2 | cut -d: -f2 | cut -d- -f1) install-openswan-modules-dkms: patch dh_testdir dh_testroot dh_installdirs mkdir -p "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/lib" mkdir -p "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/debian" mkdir -p "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/packaging" cp -r Makefile Makefile.top Makefile.inc Makefile.ver linux/ \ "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)" cp -r lib/libcrypto "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/lib" cp -r packaging/makefiles packaging/linus packaging/utils packaging/defaults/ \ "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/packaging/" find "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/lib" -name "*.o" | xargs --no-run-if-empty rm install --mode=644 debian/openswan-modules-source.kernel-config "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/config-all.h" sed -e "s/#VERSION#/$(VERSION)/g" debian/dkms.conf.in > "$(CURDIR)/debian/openswan-modules-dkms/usr/src/openswan-$(VERSION)/dkms.conf" dh_installdocs -popenswan-modules-dkms -n dh_installchangelogs CHANGES # more lintian cleanups find $(CURDIR)/debian/openswan-modules-dkms -name ".cvsignore" | xargs --no-run-if-empty rm -f find $(CURDIR)/debian/openswan-modules-dkms -name ".svn" -a -type d | xargs --no-run-if-empty rm -rf # Ensure +x for scrips find $(CURDIR)/debian/openswan-modules-dkms -type f -name "*.sh" -o -name "*.pl" | xargs --no-run-if-empty chmod 755 # remove empty dir find $(CURDIR)/debian/openswan-modules-dkms -type d -name debian | xargs --no-run-if-empty rmdir # These are not executable scripts, more like "shell source" files find $(CURDIR)/debian/openswan-modules-dkms -name sshenv -o -name setup | xargs --no-run-if-empty chmod 644 binary-common: #dh_testversion 2 dh_testdir dh_testroot dh_installdebconf dh_link dh_strip --dbg-package=openswan-dbg dh_compress dh_fixperms -X etc/ipsec.conf -X etc/ipsec.secrets -X etc/ipsec.d dh_lintian # dh_makeshlibs dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb # Build architecture-independent files here. binary-indep: install-openswan-doc install-openswan-modules-source install-openswan-modules-dkms $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common # Build architecture-dependent files here. binary-arch: install-openswan $(MAKE) -f debian/rules DH_OPTIONS=-a binary-common # Any other binary targets build just one binary package at a time. #binary-%: build install # make -f debian/rules binary-common DH_OPTIONS=-p$* binary: binary-indep binary-arch .PHONY: clean binary-indep binary-arch