view debian/rules @ 307:a6e66cc358e8 noffle

[svn] output md5sums and conffiles
author godisch
date Mon, 17 Feb 2003 17:11:14 +0000
parents 00766bc86962
children 1439f5692d18
line wrap: on
line source

#!/usr/bin/make -f
# $Id: rules 441 2003-02-17 17:11:14Z godisch $

#export MAINT_BUILD=1

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
INSTALL  = install -o root -g root

# 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
#ifneq ($(MAINT_BUILD),1)
#	# ---------- prevent automake etc. from being called
#	# if you have changed anything, set MAINT_BUILD to 1
#	touch configure.in && \
#	touch Makefile.am docs/Makefile.am src/Makefile.am packages/Makefile.am packages/redhat/Makefile.am && \
#	touch aclocal.m4   && \
#	touch Makefile.in docs/Makefile.in src/Makefile.in packages/Makefile.in packages/redhat/Makefile.in && \
#	touch configure    && \
#	touch stamp-h.in config.h.in
#	# ---------- endif
#else
#	aclocal
#	autoconf
#	autoheader
#	automake
#	-rm -f config.log
#endif
	-$(MAKE) -i distclean
	-rm -rf debian/noffle

configure: configure-stamp
configure-stamp:
	$(testdir)
	./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
	$(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) -m 0755 -D debian/noffle-cronfetch $(BUILDDIR)/usr/sbin/noffle-cronfetch

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

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

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

	# installing manuals
	$(INSTALL) -d $(MANDIR)/man1 $(MANDIR)/man5
	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) -m 0644 -D debian/noffle-cronfetch.8 $(MANDIR)/man8/noffle-cronfetch.8
	find $(MANDIR) -type f -print0 | xargs -0 gzip -9

	# installing documentation
	$(INSTALL) -d $(DOCDIR)
	$(INSTALL) -m 0644 AUTHORS NEWS TODO docs/FAQ docs/INTERNALS docs/NOTES $(DOCDIR)
	find $(DOCDIR) -type f -size +8 -print0 | xargs -0 gzip -9
	$(INSTALL) -m 0644 -D debian/changelog $(DOCDIR)/changelog.Debian
	$(INSTALL) -m 0644 -D ChangeLog $(DOCDIR)/changelog
	gzip -9 $(DOCDIR)/changelog $(DOCDIR)/changelog.Debian
	$(INSTALL) -m 0644 debian/copyright $(DOCDIR)
	$(INSTALL) -m 0644 debian/README.Debian $(DOCDIR)
	ln -s ../../noffle $(DOCDIR)/examples

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

	# installing packaging information
	$(INSTALL) -d $(DEBDIR)
	$(INSTALL) -m 0755 debian/config   $(DEBDIR)
	$(INSTALL) -m 0644 debian/control  $(DEBDIR)
	$(INSTALL) -m 0755 debian/postinst $(DEBDIR)
	$(INSTALL) -m 0755 debian/postrm   $(DEBDIR)
	$(INSTALL) -m 0755 debian/preinst  $(DEBDIR)
	$(INSTALL) -m 0755 debian/prerm    $(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
	debconf-mergetemplate debian/templates.?? 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 configure build binary binary-indep binary-arch