#! /usr/bin/make -f ## debian/rules for POP3Lite ## Copyright (C) 2000, 2001 Gergely Nagy <8@free.bsd.hu> ## ## This file is part of POP3Lite. ## ## POP3Lite is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. ## ## POP3Lite is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## ## $Id: rules,v 1.32.2.6 2001/06/14 09:50:31 algernon Exp $ ## (See the end of this file for some notes) SHELL = /bin/bash export DH_COMPAT = 2 DEBHELPER_OPTIONS = -p$@ -Pdebian/$(DEB_HOST_ARCH)/$@ MISC_MODULES := alias,apop,capa,disable,expire,filelog,homebox,iplog,sabotage,userconf,vhost MISC_DOCS := $(shell echo "$(MISC_MODULES)" | tr [:lower:] [:upper:]) PWD := $(CURDIR) define chkarch case "$(DEB_HOST_ARCH)" in \ hurd-*) \ echo hurd-i386 \ ;; \ *) \ echo other \ ;; \ esac endef DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) override TARGET := $(shell $(chkarch)) include debian/rules.$(TARGET) CFLAGS = -DDEBIAN -O2 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) CFLAGS += -g endif # bootstrap - for building from CVS snapshots bootstrap: build-deb/$(DEB_HOST_ARCH)/bootstrap-stamp build-deb/$(DEB_HOST_ARCH)/bootstrap-stamp: # Don't run bootstrap.mk, for it may cause serious problems # -$(MAKE) -f bootstrap.mk update install -d build-deb/$(DEB_HOST_ARCH) touch $@ # config - run configure config: bootstrap build-deb/$(DEB_HOST_ARCH)/config-stamp build-deb/$(DEB_HOST_ARCH)/config-stamp: dh_testdir cd build-deb/$(DEB_HOST_ARCH) && \ $(ARCH_FLAGS) CFLAGS="$(CFLAGS)" \ ../../configure \ --with-layout=fhs \ --disable-debugging \ --disable-static \ --with-builtin-modules=$(BUILTIN_MODULES) \ --build=$(DEB_BUILD_GNU_TYPE) \ --host=$(DEB_HOST_GNU_TYPE) $(ARCH_CONFIG) touch $@ # build - build the package build: config build-deb/$(DEB_HOST_ARCH)/build-stamp build-deb/$(DEB_HOST_ARCH)/build-stamp: dh_testdir $(MAKE) -C build-deb/$(DEB_HOST_ARCH) all $(MAKE) -C build-deb/$(DEB_HOST_ARCH)/doc dvi touch $@ # clean - remove build directories clean: dh_testdir dh_testroot # Info file needs to be regenerated, as it has a hard-coded # reference to /usr/local/etc/pop3lite.conf which needs to be changed... -$(MAKE) -C build-deb/$(DEB_HOST_ARCH) distclean rm -f doc/pop3lite-admin.info rm -Rf build-deb/$(DEB_HOST_ARCH) -rmdir --ignore-fail-on-non-empty build-deb @for m in $(shell dh_listpackages); do \ echo "dh_clean -p$$m -Pdebian/$(DEB_HOST_ARCH)/$$m" ;\ dh_clean -p$$m -Pdebian/$(DEB_HOST_ARCH)/$$m ;\ done rm -Rf debian/$(DEB_HOST_ARCH) # install - install the package to debian//pop3lite install: build dh_testdir dh_testroot @for m in $(shell dh_listpackages); do \ echo "dh_clean -k -Pdebian/$(DEB_HOST_ARCH)/$$m -p$$m" ;\ dh_clean -k -Pdebian/$(DEB_HOST_ARCH)/$$m -p$$m ;\ echo "dh_installdirs -Pdebian/$(DEB_HOST_ARCH)/$$m -p$$m" ;\ dh_installdirs -Pdebian/$(DEB_HOST_ARCH)/$$m -p$$m ;\ done $(MAKE) -C build-deb/$(DEB_HOST_ARCH) \ install DESTDIR=$(PWD)/debian/$(DEB_HOST_ARCH)/pop3lite # Keep only shared objects & .la files find debian/$(DEB_HOST_ARCH)/pop3lite/usr/lib/pop3lite \ \! -name '*.so' \! -name '*.la' -type f | xargs rm -f # Copy default Debian configuration cp debian/pop3lite.conf \ debian/$(DEB_HOST_ARCH)/pop3lite/etc/ cp debian/pop3lite-start.conf \ debian/$(DEB_HOST_ARCH)/pop3lite/etc/ # Copy PAM config file - enable when pam service name is set to pop3! # cp debian/pop3lite.pam \ # debian/$(DEB_HOST_ARCH)/pop3lite/etc/pam.d/pop3 # Copy the various modules to the various packages mv debian/$(DEB_HOST_ARCH)/pop3lite/usr/lib/pop3lite/{$(MISC_MODULES)}.* \ debian/$(DEB_HOST_ARCH)/libpop3lite-misc/usr/lib/pop3lite/ # The PostgreSQL module is disabled until it is in non-us # mv debian/$(DEB_HOST_ARCH)/pop3lite/usr/lib/pop3lite/sqlconf.* \ # debian/$(DEB_HOST_ARCH)/libpop3lite-sqlconf/usr/lib/pop3lite/ || true # Headers go to pop3lite-dev mv debian/$(DEB_HOST_ARCH)/pop3lite/usr/include/* \ debian/$(DEB_HOST_ARCH)/pop3lite-dev/usr/include # Docs to their places mv debian/$(DEB_HOST_ARCH)/pop3lite/usr/share/doc/pop3lite/modules/{$(MISC_DOCS)} \ debian/$(DEB_HOST_ARCH)/libpop3lite-misc/usr/share/doc/libpop3lite-misc/modules # mv debian/$(DEB_HOST_ARCH)/pop3lite/usr/share/doc/pop3lite/modules/SQLCONF \ # debian/$(DEB_HOST_ARCH)/libpop3lite-sqlconf/usr/share/doc/libpop3lite-sqlconf/modules || true # Links to pop3lite's doc dir # ln -s ../../libpop3lite-sqlconf/modules/SQLCONF \ # debian/$(DEB_HOST_ARCH)/libpop3lite-sqlconf/usr/share/doc/pop3lite/modules/ || true ln -s ../../libpop3lite-misc/modules/{$(MISC_DOCS)} \ debian/$(DEB_HOST_ARCH)/libpop3lite-misc/usr/share/doc/pop3lite/modules/ # Remove GPL, FDL, ChangeLog & info files rm -rf debian/$(DEB_HOST_ARCH)/pop3lite/usr/share/doc/pop3lite/COPYING{.DOC,}{.gz,} \ debian/$(DEB_HOST_ARCH)/pop3lite/usr/share/doc/pop3lite/ChangeLog{.gz,} \ debian/$(DEB_HOST_ARCH)/pop3lite/usr/share/info \ debian/$(DEB_HOST_ARCH)/pop3lite/usr/{include,lib} # Add the FDL # This is better than mving around... cp COPYING.DOC debian/$(DEB_HOST_ARCH)/pop3lite/usr/share/doc/pop3lite/FDL # Install the DVI manuals cp build-deb/$(DEB_HOST_ARCH)/doc/pop3lite-admin.dvi \ debian/$(DEB_HOST_ARCH)/pop3lite/usr/share/doc/pop3lite/pop3lite-admin.dvi # cp build-deb/$(DEB_HOST_ARCH)/doc/pop3lite-hacker.dvi \ # debian/$(DEB_HOST_ARCH)/pop3lite-dev/usr/share/doc/pop3lite-dev/pop3lite-hacker.dvi # Install the doc-base control files cp debian/pop3lite-admin \ debian/$(DEB_HOST_ARCH)/pop3lite/usr/share/doc-base/pop3lite-admin # cp debian/pop3lite-hacker \ # debian/$(DEB_HOST_ARCH)/pop3lite-dev/usr/share/doc-base/pop3lite-hacker # these build the various packages libpop3lite-misc pop3lite-dev pop3lite: install dh_testdir dh_testroot dh_installdebconf $(DEBHELPER_OPTIONS) dh_installdocs $(DEBHELPER_OPTIONS) # dh_installexamples $(DEBHELPER_OPTIONS) # dh_installmenu $(DEBHELPER_OPTIONS) # dh_installlogrotate $(DEBHELPER_OPTIONS) # dh_installemacsen $(DEBHELPER_OPTIONS) dh_installpam $(DEBHELPER_OPTIONS) dh_installinit $(DEBHELPER_OPTIONS) # dh_installcron $(DEBHELPER_OPTIONS) # dh_installmanpages $(DEBHELPER_OPTIONS) dh_installinfo $(DEBHELPER_OPTIONS) # dh_undocumented $(DEBHELPER_OPTIONS) dh_installchangelogs ChangeLog $(DEBHELPER_OPTIONS) dh_link $(DEBHELPER_OPTIONS) dh_strip $(DEBHELPER_OPTIONS) dh_compress $(DEBHELPER_OPTIONS) dh_fixperms $(DEBHELPER_OPTIONS) # dh_suidregister $(DEBHELPER_OPTIONS) # dh_makeshlibs $(DEBHELPER_OPTIONS) dh_installdeb $(DEBHELPER_OPTIONS) # dh_perl $(DEBHELPER_OPTIONS) dh_shlibdeps $(DEBHELPER_OPTIONS) dh_gencontrol $(DEBHELPER_OPTIONS) dh_md5sums $(DEBHELPER_OPTIONS) dh_builddeb $(DEBHELPER_OPTIONS) # binary-arch, binary-indep, binary - targets required by DP binary-arch: pop3lite libpop3lite-misc # libpop3lite-sqlconf binary-indep: pop3lite-dev binary: binary-indep binary-arch # rebuild - rebuild from (almost) pristine sources rebuild: clean binary .PHONY: build clean binary-indep binary-arch binary install rebuild \ libpop3lite-misc libpop3lite-sqlconf pop3lite-dev pop3lite \ bootstrap config ## ## Some notes & rationale: ## First of all, every sane person might ask that why do I build ## POP3Lite in a separate directory for each architecture. The answer ## is simple: I want to be able to build for multiple architectures ## at the same time (eg. cross-compile for the HURD). ## ## The second question might be that why the hell I install those ## things into debian/$(DEB_HOST_ARCH)/ instead of the ## default debian/. Simple. If I'd use debian/, ## then the Hurd and GNU/Linux-i386 build would conflict. They'd ## install their files and overwrite the other one's. I don't want ## that. I want to run two dpkg-buildpackages at the same time. ## ## I'm crazy. I know that, you don't have to tell me :) ## ## Oh! And I *love* obscure Makefiles. ##