view debian/rules @ 369:31295db432f5 noffle

[svn] added upstream compatbile patching
author godisch
date Tue, 01 Apr 2003 14:47:49 +0100
parents fa7a42b18bc8
children 38f082d6856a
line wrap: on
line source

#!/usr/bin/make -f
# $Id: rules 509 2003-04-01 13:47:49Z godisch $

BUILDDIR = debian/noffle
DEBDIR   = $(BUILDDIR)/DEBIAN
DOCDIR   = $(BUILDDIR)/usr/share/doc/noffle
SPOOLDIR = $(BUILDDIR)/var/spool/noffle
MANDIR   = $(BUILDDIR)/usr/share/man
testdir  = test -f src/noffle.c -a -f debian/rules
testroot = test x`whoami` = xroot

# FOR AUTOCONF 2.13 ONLY
ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
	CONFFLAGS += $(DEB_HOST_GNU_TYPE)
else
	CONFFLAGS += --host $(DEB_BUILD_GNU_TYPE) --build $(DEB_HOST_GNU_TYPE)
endif

# FOR AUTOCONF 2.52 AND NEWER ONLY
#ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
#	CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
#else
#	CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
#endif

CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif
export CFLAGS

ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
	STRIP_FLAG =
else
	STRIP_FLAG = -s
endif

clean:
	$(testdir)
	rm -f configure-stamp build-stamp debian/files debian/substvars
	-$(MAKE) -i distclean
	rm -rf debian/noffle
	-cat debian/patches/*.diff | patch -RNtp1 -r debian/rejected --no-backup-if-mismatch
	rm -f debian/rejected

configure-stamp: configure
	$(testdir)
	-cat debian/patches/*.diff | patch -Ntp1 -r debian/rejected --no-backup-if-mismatch
	./configure $(CONFFLAGS) --prefix=/usr --mandir=/usr/share/man \
		--with-configfile=/etc/news/noffle.conf \
		--with-usersfile=/etc/news/noffle.users --enable-auth=no
	touch configure-stamp

build: build-stamp
build-stamp: configure-stamp
	$(testdir)
	$(MAKE)
	touch build-stamp

binary: binary-arch

binary-indep:

binary-arch: build
	$(testdir)
	$(testroot)
	rm -rf debian/noffle

	# installing binaries
	install -o news -g news -m 6755 -D $(STRIP_FLAG) src/noffle $(BUILDDIR)/usr/bin/noffle
	install -o root -g root -m 0755 -D debian/noffle-cronfetch $(BUILDDIR)/usr/sbin/noffle-cronfetch

	# installing locking directory
	install -d -o root -g root -m 0755 $(BUILDDIR)/var/lock
	install -d -o news -g news -m 2755 $(BUILDDIR)/var/lock/noffle

	# installing spool directories
	install -d -o root -g root -m 0755 $(BUILDDIR)/var/spool
	install -d -o news -g news -m 2755 $(SPOOLDIR)/data $(SPOOLDIR)/outgoing $(SPOOLDIR)/overview $(SPOOLDIR)/requested
	ln -s ../../lock/noffle $(SPOOLDIR)/lock
	chown news:news $(SPOOLDIR)/lock

	# installing shared files
	install -D -o root -g root -m 0644 debian/linda        $(BUILDDIR)/usr/share/linda/overrides/noffle
	install -D -o root -g root -m 0644 debian/lintian      $(BUILDDIR)/usr/share/lintian/overrides/noffle
	install -D -o root -g root -m 0644 debian/conf.debian  $(BUILDDIR)/usr/share/noffle/conf.debian
	install -D -o root -g root -m 0644 noffle.conf.example $(BUILDDIR)/usr/share/noffle/noffle.conf
	install -D -o root -g root -m 0644 debian/slrn.sl      $(BUILDDIR)/usr/share/slrn/macros/noffle.sl
	install -D -o root -g root -m 0644 debian/gnus.el      $(BUILDDIR)/usr/share/emacs/site-lisp/gnus/noffle.el

	# installing manuals
	install -d -o root -g root -m 0755 $(MANDIR)/man1 $(MANDIR)/man5 $(MANDIR)/man8
	sed 's@/etc/noffle\.conf@/etc/news/noffle.conf@g' docs/noffle.1      > $(MANDIR)/man1/noffle.1
	sed 's@/etc/noffle\.conf@/etc/news/noffle.conf@g' docs/noffle.conf.5 > $(MANDIR)/man5/noffle.conf.5
	chown root:root $(MANDIR)/man1/noffle.1 $(MANDIR)/man5/noffle.conf.5
	chmod 0644      $(MANDIR)/man1/noffle.1 $(MANDIR)/man5/noffle.conf.5
	install    -o root -g root -m 0644 debian/noffle-cronfetch.8 $(MANDIR)/man8
	find $(MANDIR) -type f -print0 | xargs -0 gzip -9

	# installing documentation
	install -D -o root -g root -m 0644 ChangeLog        $(DOCDIR)/changelog
	install -D -o root -g root -m 0644 debian/changelog $(DOCDIR)/changelog.Debian
	install    -o root -g root -m 0644 debian/copyright debian/README.Debian AUTHORS NEWS TODO docs/FAQ docs/INTERNALS docs/NOTES $(DOCDIR)
	ln -s ../../noffle $(DOCDIR)/examples
	install -D -o root -g root -m 0644 debian/xinetd    $(DOCDIR)/examples/xinetd.conf
	find $(DOCDIR) -type f \( -size +8 -o -name 'changelog*' \) -print0 | xargs -0 gzip -9

	# installing config files
	install -d -o root -g root -m 0755 $(BUILDDIR)/etc/news $(BUILDDIR)/etc/default
	install -D -o root -g root -m 0644 debian/cron.d     $(BUILDDIR)/etc/cron.d/noffle
	install -D -o root -g root -m 0755 debian/cron.daily $(BUILDDIR)/etc/cron.daily/noffle
	install -D -o root -g root -m 0755 debian/init       $(BUILDDIR)/etc/init.d/noffle
	install -D -o root -g root -m 0644 debian/logcheck   $(BUILDDIR)/etc/logcheck/ignore.d.paranoid/noffle
	install -D -o root -g root -m 0644 debian/logcheck   $(BUILDDIR)/etc/logcheck/ignore.d.server/noffle
	install -D -o root -g root -m 0644 debian/logcheck   $(BUILDDIR)/etc/logcheck/ignore.d.workstation/noffle
	install -D -o root -g root -m 0755 debian/ip-up      $(BUILDDIR)/etc/ppp/ip-up.d/noffle
	install -D -o root -g root -m 0755 debian/ip-down    $(BUILDDIR)/etc/ppp/ip-down.d/noffle

	# installing packaging information
	install -d -o root -g root -m 0755 $(DEBDIR)
	install    -o root -g root -m 0644 debian/control $(DEBDIR)
	install    -o root -g root -m 0755 debian/config debian/preinst debian/postinst debian/prerm debian/postrm $(DEBDIR)
	cd $(BUILDDIR) && find usr -type f -print0 | xargs -0 md5sum | tee DEBIAN/md5sums
	cd $(BUILDDIR) && find ./etc -type f | cut -c 2- | tee DEBIAN/conffiles
	po2debconf debian/templates > $(DEBDIR)/templates
	chown root:root $(DEBDIR)/md5sums $(DEBDIR)/conffiles $(DEBDIR)/templates
	chmod 0644      $(DEBDIR)/md5sums $(DEBDIR)/conffiles $(DEBDIR)/templates

	# building Debian package
	dpkg-shlibdeps $(BUILDDIR)/usr/bin/noffle
	dpkg-gencontrol -isp -pnoffle -P$(BUILDDIR)
	dpkg --build $(BUILDDIR) ..
	# binary target finished

.PHONY: clean build binary binary-indep binary-arch