This is my first attempt at building inn2 two times from the same source with no duplication of debian/rules and of the debhelper config files. I do not like much the src_files stuff, but it's shorter than embedding lndir in the package like I did for udev and udev-udeb.
Please let me know if you have ideas about how to make this simpler and/or more elegant. The complete package will be available in a few hours at http://www.bofh.it/~md/debian/ (please test if it you can, I do not have yet a news server running unstable). #!/usr/bin/make -f SHELL+= -e QUILT_STAMPFN := .stamp-patched include /usr/share/quilt/quilt.make D-std := $(CURDIR)/debian/inn2 D-lfs := $(CURDIR)/debian/inn2-lfs D = $(D-$*) B = $(CURDIR)/build-$* ############################################################################## # this code deals with building a second inn2-lfs package from the same # source, but only on 32 bit architectures # Ideally new future 32 bit architectures should not bother with inn2-lfs # and just enable LFS by default. DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) ifeq ($(DEB_HOST_ARCH),amd64) FLAVORS := std else ifeq ($(DEB_HOST_ARCH),ia64) FLAVORS := std else ifeq ($(DEB_HOST_ARCH),ppc64) FLAVORS := std else ifeq ($(DEB_HOST_ARCH),s390x) FLAVORS := std else FLAVORS := std lfs endif std_configure_flags = lfs_configure_flags = --enable-largefiles std_dh_clean_opts = -pinn2 -pinn2-inews -p inn2-dev lfs_dh_clean_opts = -pinn2-lfs std_dh_movefiles_opts = -pinn2 -pinn2-inews -p inn2-dev lfs_dh_movefiles_opts = -pinn2-lfs -pinn2-lfs-inews -p inn2-lfs-dev ifeq ($(FLAVORS),std) no_package := --no-package=inn2-lfs endif # the upstream source needs to be copied in the flavor-specific build dirs src_files := $(shell find . -maxdepth 1 \ -and -not -name . -and -not -name debian -and -not -name .pc \ -and -not -name 'build-*' -and -not -name '.stamp-*') ############################################################################## DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) CROSS := --build $(DEB_HOST_GNU_TYPE) else CROSS := --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) endif clean: unpatch rm -rf .stamp-* build-* [ ! -f Makefile.global ] || $(MAKE) distclean # delete the cloned debhelper configuration find debian -maxdepth 1 -type l -and -name 'inn2-lfs*' -print0 \ | xargs --no-run-if-empty -0 rm # delete packages which are not in control but are built anyway rm -rf debian/inn2-lfs-dev/ debian/inn2-lfs-inews/ dh_clean debian/po/templates.pot: debian/inn2.templates debconf-updatepo configure: $(addprefix .stamp-configure-, $(FLAVORS)) .stamp-configure-%: $(QUILT_STAMPFN) dh_testdir mkdir -p $B for dir in $(src_files); do cp -ldpR $$dir $B; done cd $B && \ _PATH_PERL=/usr/bin/perl \ ac_cv_path__PATH_AWK=awk \ ac_cv_path__PATH_EGREP=egrep \ ac_cv_path__PATH_SED=sed \ ac_cv_path__PATH_SORT=sort \ ac_cv_path__PATH_UUX=uux \ ac_cv_path_PATH_GPGV=/usr/bin/gpgv \ ac_cv_path_GETFTP=wget \ ac_cv_search_dbm_open=-ldb \ LDFLAGS="$(LDFLAGS) -Wl,--as-needed" \ ./configure \ --with-perl \ --enable-ipv6 \ --prefix=/usr/lib/news \ --mandir=/usr/share/man \ --includedir=/usr/include/inn \ --with-db-dir=/var/lib/news \ --with-etc-dir=/etc/news \ --with-filter-dir=/etc/news/filter \ --with-lib-dir=/usr/lib/news \ --with-log-dir=/var/log/news \ --with-run-dir=/var/run/news \ --with-spool-dir=/var/spool/news \ --with-tmp-dir=/var/spool/news/incoming/tmp \ --with-berkeleydb=/usr \ --with-kerberos=/usr \ --with-sendmail=/usr/sbin/sendmail \ $($*_configure_flags) $(CROSS) cd $B && \ mkdir ssl/ ssl/nnrpd/ && \ cd ssl/ && \ ln -s ../Makefile.global ../include ../storage ../history . && \ cd nnrpd/ && ln -s ../../nnrpd/* . touch $@ build: $(addprefix .stamp-build-, $(FLAVORS)) #debian/po/templates.pot .stamp-build-%: .stamp-configure-% dh_testdir cd $B && $(MAKE) cd $B/ssl/nnrpd/ && $(MAKE) \ SSLLIB='-L/usr/lib -lssl -lcrypto -ldl' SSLINC='-DHAVE_SSL=1' touch $@ install1-%: .stamp-build-% dh_testdir dh_testroot dh_clean -k $($*_dh_clean_opts) cd $B && $(MAKE) install DESTDIR=$D sh -e extra/dh_cloneconf inn2 inn2-lfs dh_movefiles $($*_dh_movefiles_opts) --sourcedir=$(subst $(CURDIR)/,,$D) # move back this one mv $D-dev/usr/share/man/man3/uwildmat.3 $D/usr/share/man/man3/ # remove assorted crap and # make sure we don't ship active, active.times, newsgroups in place! cd $D/etc/news/filter && rm -f *.py *.tcl rm -rf $D/usr/lib/news/bin/simpleftp $D/usr/share/man/man1/simpleftp.1\ $D/usr/lib/news/doc/ $D/var/lib/news/* \ $D/usr/include/ mv $D/usr/share/man/man1/startinnfeed.1 \ $D/usr/share/man/man8/startinnfeed.8 cp $B/ssl/nnrpd/nnrpd $D/usr/lib/news/bin/nnrpd-ssl install -m 755 extra/buildinnkeyring extra/ginpaths2 \ $D/usr/lib/news/bin/ install -m 755 contrib/showtoken.in $D/usr/lib/news/bin/showtoken install -m 755 extra/bunbatch $D-inews/usr/lib/news/bin/rnews.libexec/ install -m 644 extra/send-uucp.cf $D/etc/news/ mkdir $D/var/log/news/path install2: $(addprefix install1-, $(FLAVORS)) dh_link dh_installchangelogs NEWS dh_installdocs dh_installexamples dh_installinit --noscripts --init-script=inn2 dh_installcron dh_installdebconf dh_installlogcheck dh_compress dh_fixperms \ -Xusr/lib/news/bin/inndstart -Xusr/lib/news/bin/startinnfeed # some files are not writeable when installed by make install dh_strip install3-%: install2 chown root:news $D-inews/etc/news/passwd.nntp chmod 640 $D-inews/etc/news/passwd.nntp chmod -x $D/usr/lib/news/bin/control/*.pl chmod +rw \ $D/usr/lib/news/bin/inndstart \ $D/usr/lib/news/bin/startinnfeed chown news:uucp $D-inews/usr/lib/news/bin/rnews chmod 4755 $D-inews/usr/lib/news/bin/rnews chown -R news:news $D/var/spool/news/ $D/var/lib/news/ \ $D/var/run/news/ $D/var/log/news/ chmod -R g+w $D/var/spool/news/ $D/var/lib/news/ \ $D/var/run/news/ $D/var/log/news/ install4-std: install3-std # lfs-specific: rename some files installed by debhelper install4-lfs: install3-lfs for file in /etc/logcheck/ignore.d.server/inn2 /etc/logcheck/violations.ignore.d/inn2 /etc/cron.d/inn2; do \ mv $(D-lfs)$$file-lfs $(D-lfs)$$file; \ done install5: $(addprefix install4-, $(FLAVORS)) dh_installdeb dh_md5sums dh_shlibdeps dh_gencontrol $(no_package) -- \ -VPERLAPI=$$(perl -MConfig -e 'print "perlapi-$$Config{version}"') dh_builddeb $(no_package) binary-arch: install5 binary: binary-arch .PHONY: clean configure build binary-arch binary install% extra/dh_cloneconf: #!/bin/sh -e IN="$1" OUT="$2" for file in debian/$IN.* debian/$IN*.files; do case "$file" in *.log) continue ;; esac [ -h $file ] && continue base=${file##*/} newfile=$(echo $file | sed -re "s#/$IN#/$OUT#") [ -e $newfile ] || ln -s $base $newfile done -- ciao, Marco
signature.asc
Description: Digital signature