]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - zephyr/debian/rules
first cut at updated packaging
[1ts-debian.git] / zephyr / debian / rules
1 #!/usr/bin/make -f
2 # Sample debian/rules that uses debhelper. 
3 # GNU copyright 1997 by Joey Hess.
4 #
5 # This version is for a hypothetical package that builds an
6 # architecture-dependant package, as well as an architecture-independent
7 # package.
8
9 # Uncomment this to turn on verbose mode. 
10 #export DH_VERBOSE=1
11 VARIETALS=krb5
12 #VARIETALS=krb45 krb5
13 CFLAGS=-g -O
14
15 PACKAGES:=-plibzephyr4 -pzephyr-clients -pzephyr-server -plibzephyr-dev $(foreach i,$(VARIETALS),-plibzephyr4-$(i) -pzephyr-server-$(i))
16
17 # This has to be exported to make some magic below work.
18 export DH_OPTIONS
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
24
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)
28
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)
32 else
33   CONFIGURE_ROOT += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
34 endif
35
36 BUILD_VARIETALS=$(VARIETALS) no-krb
37 PKG_VERSION:=$(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')
38 PKG_DISTRO:=$(shell lsb_release -si)
39
40 STASH:=debian/autogoo-stash
41 STASH_H:=debian/autogoo-h-stash
42
43 stash: stash-stamp
44 stash-stamp:
45         -mkdir $(STASH)
46         mv -v m4 autom4te.cache aclocal.m4 config.guess config.sub configure install-sh ltmain.sh VERSION $(STASH)
47         -mkdir $(STASH_H)
48         mv -v h/config.h.in $(STASH_H)
49         touch stash-stamp
50
51 configure: configure-stamp
52 configure-stamp: stash-stamp
53         dh_testdir
54         # Add here commands to configure the package.
55         libtoolize -ic
56         autoreconf
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));)
60         touch configure-stamp
61
62 build: configure-stamp build-stamp
63 build-stamp:
64         dh_testdir
65
66         # Add here commands to compile the package.
67         set -e; \
68         for dir in $(VARIETALS) ; do  \
69                 $(MAKE) -C $$dir h/zephyr_version.h; $(MAKE) -C $$dir/lib all; $(MAKE) -C $$dir/server; \
70         done
71         $(MAKE) -C no-krb all
72
73         touch build-stamp
74
75 clean:
76         dh_testdir
77         dh_testroot
78         -rm -f build-stamp configure-stamp
79
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))); \
85         fi
86         -rm debian/libzephyr4-krb5.files debian/libzephyr4-krb45.files
87         -rm stash-stamp
88         -test -d $(STASH)/autom4te.cache && rm -rf autom4te.cache
89         -test -d $(STASH)/m4 && rm -rf m4
90         -test -d $(STASH) && mv $(STASH)/* .
91         -rmdir $(STASH)
92         -test -d $(STASH_H) && mv $(STASH_H)/* h
93         -rmdir $(STASH_H)
94
95         dh_clean -v -Xautom4te.cache
96
97 install: DH_OPTIONS=
98 install: build
99         dh_testdir
100         dh_testroot
101         dh_prep
102         -rm -rf debian/tmp-krb*
103         dh_installdirs
104
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; \
109         done
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; \
116         done
117
118 # Build architecture-independent files here.
119 # Pass -i to all debhelper commands in this target to reduce clutter.
120 binary-indep: build install
121
122 # Build architecture-dependent files here.
123 # Pass -a to all debhelper commands in this target to reduce clutter.
124 binary-arch: build install
125         dh_testdir
126         dh_testroot
127         set -e; \
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; \
131                 done; \
132         done
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; \
136                 done; \
137         done
138         for dir in $(VARIETALS); do \
139                 cp debian/libzephyr4.files debian/libzephyr4-$$dir.files; \
140         done
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; \
144         done
145         dh_installdebconf 
146         dh_installdocs
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; \
154         done
155         dh_installchangelogs 
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; \
160         done
161         dh_strip
162         dh_compress
163         dh_fixperms
164         dh_makeshlibs
165         # sigh
166         for dir in $(VARIETALS); do \
167                 cp debian/libzephyr4/DEBIAN/shlibs debian/libzephyr4-$$dir/DEBIAN/shlibs; \
168         done
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; \
176         done
177
178
179 binary: binary-indep binary-arch
180
181 .PHONY: autotools build clean binary-indep binary-arch binary install stash