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.
15 PACKAGES:=-plibzephyr4 -pzephyr-clients -pzephyr-server -plibzephyr-dev $(foreach i,$(VARIETALS),-plibzephyr4-$(i) -pzephyr-server-$(i))
17 # This has to be exported to make some magic below work.
19 CONFIGURE_ROOT=--prefix=/usr --mandir=\$${prefix}/share/man \
20 --infodir=\$${prefix}/share/info --sysconfdir=/etc --datadir=/etc \
21 --with-cares=/usr --with-hesiod=/usr --enable-cmu-zwgcplus
22 CONFIGURE_krb5=--with-krb5=/usr
23 CONFIGURE_krb45=--with-krb4=/usr --with-krb5=/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 CONFIGURE_ROOT += --build $(DEB_HOST_GNU_TYPE)
33 CONFIGURE_ROOT += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
36 BUILD_VARIETALS=$(VARIETALS) no-krb
37 PKG_VERSION:=$(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')
38 PKG_DISTRO:=$(shell lsb_release -si)
40 STASH:=debian/autogoo-stash
41 STASH_H:=debian/autogoo-h-stash
46 mv -v m4 autom4te.cache aclocal.m4 config.guess config.sub configure install-sh ltmain.sh VERSION $(STASH)
48 mv -v h/config.h.in $(STASH_H)
51 configure: configure-stamp
52 configure-stamp: stash-stamp
54 # Add here commands to configure the package.
57 echo "$(PKG_VERSION) ($(PKG_DISTRO))" > VERSION
58 mkdir -p $(BUILD_VARIETALS)
59 $(foreach VARIETY,$(BUILD_VARIETALS),(cd $(VARIETY) && CFLAGS="$(CFLAGS)" ../configure $(CONFIGURE_$(VARIETY)) $(CONFIGURE_ROOT));)
62 build: configure-stamp build-stamp
66 # Add here commands to compile the package.
68 for dir in $(VARIETALS) ; do \
69 $(MAKE) -C $$dir h/zephyr_version.h; $(MAKE) -C $$dir/lib all; $(MAKE) -C $$dir/server; \
78 -rm -f build-stamp configure-stamp
80 # Add here commands to clean up after the build process.
81 -rm -rf $(BUILD_VARIETALS) debian/tmp-krb*
82 -rm $(foreach v,$(VARIETALS),$(foreach s,files templates config postinst,debian/zephyr-server-$(v).$(s)))
83 -if test -n "$(filter-out krb5,$(VARIETALS))"; then \
84 rm $(foreach v,$(filter-out krb5,$(VARIETALS)),$(foreach s,docs init postrm,debian/zephyr-server-$(v).$(s))); \
86 -rm debian/libzephyr4-krb5.files debian/libzephyr4-krb45.files
88 -test -d $(STASH)/autom4te.cache && rm -rf autom4te.cache
89 -test -d $(STASH)/m4 && rm -rf m4
90 -test -d $(STASH) && mv $(STASH)/* .
92 -test -d $(STASH_H) && mv $(STASH_H)/* h
95 dh_clean -v -Xautom4te.cache
102 -rm -rf debian/tmp-krb*
105 # Add here commands to install the package into debian/tmp.
106 $(MAKE) -C no-krb DESTDIR=$(CURDIR)/debian/tmp install
107 for dir in $(VARIETALS); do \
108 $(MAKE) -C $$dir SUBDIRS="lib server" DESTDIR=$(CURDIR)/debian/tmp-$$dir install; \
110 mkdir -p debian/tmp/etc/zephyr/acl
111 set -x; for i in debian/acl/*; do install -c -m 644 -o root $$i debian/tmp/etc/zephyr/acl; done; set +x
112 install -c -m 644 debian/zephyr.vars debian/tmp/etc/zephyr
113 install -c -m 644 debian/default.subscriptions debian/tmp/etc/zephyr
114 for dir in $(VARIETALS); do \
115 cp -rp debian/tmp/etc/zephyr/acl debian/tmp-$$dir/etc/zephyr; \
118 # Build architecture-independent files here.
119 # Pass -i to all debhelper commands in this target to reduce clutter.
120 binary-indep: build install
122 # Build architecture-dependent files here.
123 # Pass -a to all debhelper commands in this target to reduce clutter.
124 binary-arch: build install
128 for file in files templates config postinst docs; do \
129 for dir in $(VARIETALS); do \
130 cp debian/zephyr-server.$$file debian/zephyr-server-$$dir.$$file; \
133 for file in docs init postrm; do \
134 for dir in $(filter-out krb5,$(VARIETALS)); do \
135 cp debian/zephyr-server-krb5.$$file debian/zephyr-server-$$dir.$$file; \
138 for dir in $(VARIETALS); do \
139 cp debian/libzephyr4.files debian/libzephyr4-$$dir.files; \
141 dh_movefiles -plibzephyr4 -pzephyr-clients -pzephyr-server -plibzephyr-dev
142 for dir in $(VARIETALS); do \
143 dh_movefiles --sourcedir=debian/tmp-$$dir -plibzephyr4-$$dir -pzephyr-server-$$dir; \
147 dh_installinit -pzephyr-clients --init-script=zhm --no-start
148 dh_installinit -pzephyr-server --init-script=zephyrd
149 for variety in $(VARIETALS); do \
150 dh_installinit -pzephyr-server-$$variety --init-script=zephyrd; \
151 mkdir -p debian/libzephyr4-$$variety/usr/share/lintian/overrides; \
152 sed -e "s/@VARIETY@/$$variety/" debian/soname-override \
153 > debian/libzephyr4-$$variety/usr/share/lintian/overrides/libzephyr4-$$variety; \
156 for dir in zephyr-clients libzephyr-dev \
157 libzephyr4 $(foreach i,$(VARIETALS),libzephyr4-$i) \
158 zephyr-server $(foreach i,$(VARIETALS),zepyr-server-$i); do \
159 find debian/$$i -type d -empty -delete; \
166 for dir in $(VARIETALS); do \
167 cp debian/libzephyr4/DEBIAN/shlibs debian/libzephyr4-$$dir/DEBIAN/shlibs; \
169 dh_shlibdeps $(PACKAGES)
170 dh_installdeb $(PACKAGES)
171 dh_gencontrol $(PACKAGES)
172 dh_md5sums $(PACKAGES)
173 dh_builddeb $(PACKAGES)
174 for dir in $(VARIETALS); do \
175 dh_builddeb --sourcedir=debian/tmp-$$dir -plibzephyr4-$$dir -pzephyr-server-$$dir; \
179 binary: binary-indep binary-arch
181 .PHONY: autotools build clean binary-indep binary-arch binary install stash