2 # Sample debian/rules that uses debhelper.
3 # GNU copyright 1997 by Joey Hess.
5 # This version is for a hypothetical package that builds an
6 # architecture-dependant package, as well as an architecture-independent
9 # Uncomment this to turn on verbose mode.
12 #VARIETALS=krb krb45 krb5
14 PACKAGES:=-plibzephyr4 -pzephyr-clients -pzephyr-server -plibzephyr-dev $(foreach i,$(VARIETALS),-plibzephyr4-$(i) -pzephyr-server-$(i))
16 # This has to be exported to make some magic below work.
18 CONFIGURE_ROOT=--prefix=/usr --mandir=\$${prefix}/share/man \
19 --infodir=\$${prefix}/share/info --sysconfdir=/etc --datadir=/etc \
20 --with-ares=/usr --with-hesiod=/usr --enable-cmu-zwgcplus
21 CONFIGURE_krb5=--with-krb5=/usr
22 CONFIGURE_krb45=--with-krb4=/usr --with-krb5=/usr
23 CONFIGURE_krb=--with-krb4=/usr
25 # see /usr/share/doc/autotools-dev/README.Debian.gz
26 export DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
27 export DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
29 # FOR AUTOCONF 2.52 AND NEWER ONLY
30 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
31 confflags += --build $(DEB_HOST_GNU_TYPE)
33 confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
37 # The autotools target adds forced build-time dependencies on
38 # autotools-dev (for /usr/share/misc/config.*) and devscripts (for dch)
39 # It's also a .PHONY make target.
42 chmod u+x config.guess
43 OLDDATESUB=`./config.sub -t | tr -d -` ;\
44 OLDDATEGUESS=`./config.guess -t | tr -d -` ;\
45 NEWDATESUB=`/usr/share/misc/config.sub -t | tr -d -` ;\
46 NEWDATEGUESS=`/usr/share/misc/config.guess -t | tr -d -` ;\
47 if [ $$OLDDATESUB -lt $$NEWDATESUB -o \
48 $$OLDDATEGUESS -lt $$NEWDATEGUESS ]; then \
49 dch -a -p "GNU config automated update: config.sub\
50 ($$OLDDATESUB to $$NEWDATESUB), config.guess\
51 ($$OLDDATEGUESS to $$NEWDATEGUESS)" ;\
52 cp -f /usr/share/misc/config.sub config.sub ;\
53 cp -f /usr/share/misc/config.guess config.guess ;\
54 echo WARNING: GNU config scripts updated from master copies 1>&2 ;\
57 configure: configure-stamp autotools
60 # Add here commands to configure the package.
61 for i in $(foreach i,$(VARIETALS),"$i:$(CONFIGURE_$i)"); do \
64 (cd $$1 && CFLAGS="-g -O" ../configure $$2 $(CONFIGURE_ROOT)); \
67 cd no-krb && CFLAGS="-g -O" ../configure $(CONFIGURE_ROOT)
70 build: configure-stamp build-stamp
74 # Add here commands to compile the package.
76 for dir in $(VARIETALS) ; do \
77 $(MAKE) -C $$dir/lib; $(MAKE) -C $$dir/server; \
86 -rm -f build-stamp configure-stamp
88 # Add here commands to clean up after the build process.
89 -rm -rf $(VARIETALS) no-krb debian/tmp-krb*
90 -rm debian/zephyr-server-krb.files
91 -rm debian/zephyr-server-krb.templates
92 -rm debian/zephyr-server-krb.config
93 -rm debian/zephyr-server-krb.postinst
94 -rm debian/zephyr-server-krb5.*
95 -rm debian/zephyr-server-krb45.*
96 -rm debian/libzephyr4-krb.files debian/libzephyr4-krb5.files debian/libzephyr4-krb45.files
105 -rm -rf debian/tmp-krb*
108 # Add here commands to install the package into debian/tmp.
109 $(MAKE) -C no-krb DESTDIR=$(CURDIR)/debian/tmp install
110 for dir in $(VARIETALS); do \
111 $(MAKE) -C $$dir SUBDIRS="lib server" DESTDIR=$(CURDIR)/debian/tmp-$$dir install; \
113 mkdir -p debian/tmp/etc/zephyr/acl
114 set -x; for i in debian/acl/*; do install -c -m 644 -o root $$i debian/tmp/etc/zephyr/acl; done; set +x
115 install -c -m 644 debian/zephyr.vars debian/tmp/etc/zephyr
116 install -c -m 644 debian/default.subscriptions debian/tmp/etc/zephyr
117 for dir in $(VARIETALS); do \
118 cp -rp debian/tmp/etc/zephyr/acl debian/tmp-$$dir/etc/zephyr; \
121 # Build architecture-independent files here.
122 # Pass -i to all debhelper commands in this target to reduce clutter.
123 binary-indep: build install
125 # Build architecture-dependent files here.
126 # Pass -a to all debhelper commands in this target to reduce clutter.
127 binary-arch: build install
131 for file in files templates config postinst docs; do \
132 for dir in $(VARIETALS); do \
133 cp debian/zephyr-server.$$file debian/zephyr-server-$$dir.$$file; \
136 for file in README.Debian docs init postrm; do \
137 for dir in $(filter-out krb,$(VARIETALS)); do \
138 cp debian/zephyr-server-krb.$$file debian/zephyr-server-$$dir.$$file; \
141 for dir in $(VARIETALS); do \
142 cp debian/libzephyr4.files debian/libzephyr4-$$dir.files; \
144 dh_movefiles -plibzephyr4 -pzephyr-clients -pzephyr-server -plibzephyr-dev
145 for dir in $(VARIETALS); do \
146 dh_movefiles --sourcedir=debian/tmp-$$dir -plibzephyr4-$$dir -pzephyr-server-$$dir; \
150 dh_installinit -pzephyr-clients --init-script=zhm --no-start
151 dh_installinit -pzephyr-server --init-script=zephyrd
152 for dir in $(VARIETALS); do \
153 dh_installinit -pzephyr-server-$$dir --init-script=zephyrd; \
161 for dir in $(VARIETALS); do \
162 cp debian/libzephyr4/DEBIAN/shlibs debian/libzephyr4-$$dir/DEBIAN/shlibs; \
164 dh_shlibdeps $(PACKAGES)
165 dh_installdeb $(PACKAGES)
166 dh_gencontrol $(PACKAGES)
167 dh_md5sums $(PACKAGES)
168 dh_builddeb $(PACKAGES)
169 for dir in $(VARIETALS); do \
170 dh_builddeb --sourcedir=debian/tmp-$$dir -plibzephyr4-$$dir -pzephyr-server-$$dir; \
174 binary: binary-indep binary-arch
176 .PHONY: autotools build clean binary-indep binary-arch binary install