File: rules

package info (click to toggle)
uruk 20160219-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,164 kB
  • ctags: 71
  • sloc: sh: 1,835; makefile: 151; xml: 51
file content (111 lines) | stat: -rwxr-xr-x 4,192 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/make -f

# Made with the aid of debmake, by Christoph Lameter,
# based on the sample debian/rules file for GNU hello by Ian Jackson.

# Copyright (C) 2003, 2004, 2005, 20011 Joost van Baal-Ilić
#
# This file is part of the Debian uruk package.  This script is free
# software; you can redistribute it and/or modify it under the terms
# of the GNU GPL, available on-line at
# http://www.gnu.org/copyleft/gpl.html .

# debmake includes deb-make(1).  We don't use dh_make: let's see if
# we can get rid of build-depending on debhelper (and on debmake too,
# when we're at it).

package=uruk
docdir = debian/$(package)/usr/share/doc/$(package)
BUILD_DATE := $(shell dpkg-parsechangelog --show-field Date)

#  DPKG_DEB_OPTS='-Zgzip' debuild --preserve-envvar DPKG_DEB_OPTS -uc -us
# yields
#  dpkg-deb -Zgzip --build [...]

define checkdir
	test -f debian/rules
endef

build: build-arch build-indep

build-arch:

build-indep:
	$(checkdir)
	./configure --prefix=/ --datarootdir=/usr/share \
          --sysconfdir=/etc --localstatedir=/var --libexecdir=/lib
	$(MAKE)
	touch build

clean:
	$(checkdir)
	rm -f build
	[ ! -f Makefile ] || $(MAKE) distclean
	rm -f `find . -name "*~"`
	rm -rf debian/$(package) debian/files* debian/substvars

binary-indep: checkroot build
	$(checkdir)
	rm -rf debian/$(package)
	install -d debian/$(package)
#       # /libexec/uruk/init/{autodetect-ips,enable-ipv6}
#       # should end up in /lib/uruk/init/
	$(MAKE) install prefix=$(CURDIR)/debian/$(package) \
          datarootdir=$(CURDIR)/debian/$(package)/usr/share \
          sysconfdir=$(CURDIR)/debian/$(package)/etc \
          localstatedir=$(CURDIR)/debian/$(package)/var \
          libexecdir=$(CURDIR)/debian/$(package)/lib
	mkdir -p debian/$(package)/etc/uruk
	mkdir -p debian/$(package)/etc/default
	mkdir -p debian/$(package)/etc/network/if-up.d
	mkdir -p debian/$(package)/usr/share/lintian/overrides
	cp -a debian/rc debian/$(package)/etc/uruk
	cp -a debian/ifup debian/$(package)/etc/network/if-up.d/uruk
	chmod a+x debian/$(package)/etc/network/if-up.d/uruk
#       # /libexec will contain uruk/lsb/*, not needed on Debian
	rm -r debian/$(package)/lib/uruk/lsb
	cp -a debian/lintian-overrides debian/$(package)/usr/share/lintian/overrides/$(package)
	mv $(CURDIR)/debian/$(package)/usr/share/doc/$(package)/examples/default debian/$(package)/etc/default/uruk
	rm $(CURDIR)/debian/$(package)/usr/share/doc/$(package)/COPYING
	rm $(CURDIR)/debian/$(package)/usr/share/doc/$(package)/ChangeLog
	rm $(CURDIR)/debian/$(package)/usr/share/doc/$(package)/uruk*.azm
	rm $(CURDIR)/debian/$(package)/usr/share/doc/$(package)/uruk*.ps
	rm $(CURDIR)/debian/$(package)/usr/share/doc/$(package)/uruk*.txt
	cp -a NEWS debian/copyright $(docdir)
	cp -a debian/changelog $(docdir)/changelog.Debian
	cp -a debian/NEWS $(docdir)/NEWS.Debian
	cp -a debian/README $(docdir)/README.Debian
	cp -a debian/TODO $(docdir)/TODO.Debian
	cp -a ChangeLog $(docdir)/changelog
	cd $(docdir) && gzip -9n changelog changelog.Debian ChangeLog.2003 NEWS.Debian
	gzip -r9n debian/$(package)/usr/share/man
	mkdir debian/$(package)/DEBIAN
#       # generate md5sums.  pathnames should not have leading /.
#       # conffiles should be excluded.  for now, assume conffiles are precisely
#       # the files in /etc/ .
	cd debian/$(package); \
          find . -type f ! -path './etc*' ! -regex '.*/DEBIAN/.*' -printf '%P\0' | xargs -r0 md5sum > DEBIAN/md5sums
#       # generate binary package control file
	dpkg-gencontrol -isp -Pdebian/$(package)
	cp -a debian/conffiles debian/$(package)/DEBIAN
	for f in postinst prerm postrm; do \
          cp -a debian/$$f debian/$(package)/DEBIAN; \
          chmod a+x debian/$(package)/DEBIAN/$$f; \
        done
	# for reproducable builds
	find debian/$(package) -newermt '$(BUILD_DATE)' -print0 | xargs -r0 touch --no-dereference --date='$(BUILD_DATE)'
	chown -R root.root debian/$(package)
	chmod -R go=rX debian/$(package)
	#
	dpkg-deb $$DPKG_DEB_OPTS --build debian/$(package) ..

binary-arch: checkroot build

binary: binary-indep binary-arch

checkroot:
	$(checkdir)
	test root = "`whoami`"

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