]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - zephyr/debian/rules
resurrect zephyr 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=krb krb45 krb5
13
14 PACKAGES:=-plibzephyr4 -pzephyr-clients -pzephyr-server -plibzephyr-dev $(foreach i,$(VARIETALS),-plibzephyr4-$(i) -pzephyr-server-$(i))
15
16 # This has to be exported to make some magic below work.
17 export DH_OPTIONS
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
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   confflags += --build $(DEB_HOST_GNU_TYPE)
32 else
33   confflags += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
34 endif
35
36
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.
40 autotools:
41         chmod u+x config.sub
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 ;\
55         fi
56
57 configure: configure-stamp autotools
58 configure-stamp:
59         dh_testdir
60         # Add here commands to configure the package.
61         for i in $(foreach i,$(VARIETALS),"$i:$(CONFIGURE_$i)"); do \
62                 IFS=: ; set $$i ; \
63                 mkdir $$1 || true;  \
64                 (cd $$1 && CFLAGS="-g -O" ../configure $$2 $(CONFIGURE_ROOT)); \
65         done
66         -mkdir no-krb
67         cd no-krb && CFLAGS="-g -O" ../configure $(CONFIGURE_ROOT)
68         touch configure-stamp
69
70 build: configure-stamp build-stamp
71 build-stamp:
72         dh_testdir
73
74         # Add here commands to compile the package.
75         set -e; \
76         for dir in $(VARIETALS) ; do  \
77                 $(MAKE) -C $$dir/lib; $(MAKE) -C $$dir/server; \
78         done
79         $(MAKE) -C no-krb
80
81         touch build-stamp
82
83 clean:
84         dh_testdir
85         dh_testroot
86         -rm -f build-stamp configure-stamp
87
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
97
98         dh_clean
99
100 install: DH_OPTIONS=
101 install: build
102         dh_testdir
103         dh_testroot
104         dh_clean -k
105         -rm -rf debian/tmp-krb*
106         dh_installdirs
107
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; \
112         done
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; \
119         done
120         
121 # Build architecture-independent files here.
122 # Pass -i to all debhelper commands in this target to reduce clutter.
123 binary-indep: build install
124
125 # Build architecture-dependent files here.
126 # Pass -a to all debhelper commands in this target to reduce clutter.
127 binary-arch: build install
128         dh_testdir
129         dh_testroot
130         set -e; \
131         for file in files templates postinst docs; do \
132                 for dir in $(VARIETALS); do \
133                         cp debian/zephyr-server.$$file debian/zephyr-server-$$dir.$$file; \
134                 done; \
135         done
136         for file in config; do \
137                 for dir in $(filter-out krb5,$(VARIETALS)); do \
138                         cp debian/zephyr-server.$$file debian/zephyr-server-$$dir.$$file; \
139                 done; \
140         done
141         for file in README.Debian docs init postrm; do \
142                 for dir in $(filter-out krb,$(VARIETALS)); do \
143                         cp debian/zephyr-server-krb.$$file debian/zephyr-server-$$dir.$$file; \
144                 done; \
145         done
146         for dir in $(VARIETALS); do \
147                 cp debian/libzephyr4.files debian/libzephyr4-$$dir.files; \
148         done
149         dh_movefiles  -plibzephyr4 -pzephyr-clients -pzephyr-server -plibzephyr-dev
150         for dir in $(VARIETALS); do \
151                 dh_movefiles --sourcedir=debian/tmp-$$dir -plibzephyr4-$$dir -pzephyr-server-$$dir; \
152         done
153         dh_installdebconf 
154         dh_installdocs
155         dh_installinit -pzephyr-clients --init-script=zhm --no-start
156         dh_installinit -pzephyr-server --init-script=zephyrd
157         for dir in $(VARIETALS); do \
158                 dh_installinit -pzephyr-server-$$dir --init-script=zephyrd; \
159         done
160         dh_installchangelogs 
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