2 # Based on the sample debian/rules that uses debhelper.
3 # GNU copyright 1997 by Joey Hess.
5 # Use quilt to manage patches.
6 include /usr/share/quilt/quilt.make
8 # Uncomment this to turn on verbose mode.
11 # This has to be exported to make some magic below work.
14 # Tell Autoconf the correct system types.
15 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
16 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
17 ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
18 SYSTEM = --build $(DEB_HOST_GNU_TYPE)
20 SYSTEM = --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
23 # Determine whether we're building with optimization. This doesn't really
24 # work at the moment due to upstream problems.
25 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
26 DEBIAN_OPT_FLAGS = --disable-optimize --disable-lwp-optimize
27 DEBIAN_KERN_FLAGS = --disable-kernel-optimize
33 SYS_NAME := $(shell sh debian/sysname)
36 srcpkg = openafs-modules-source
38 # These packages have lintian overrides.
39 LINTIAN_PACKAGES = openafs-dbserver openafs-client openafs-fileserver
41 # The /usr/share/doc directory for these packages should be a symlink to
42 # /usr/share/doc/openafs-client. Any package on this list must depend on
44 DOC_PACKAGES = libpam-openafs-kaserver openafs-dbserver openafs-fileserver \
47 # These variable is used only by get-orig-source, which will normally only be
50 DEBVERS = @VERSION@.dfsg1
51 UPSTREAM = /afs/grand.central.org/software/openafs/$(VERSION)
53 # Download the upstream source, merge in the doc tarball, and do the
54 # repackaging that we have to do for DFSG reasons. This assumes AFS is
55 # mounted, as it's generally only used by the package maintainers.
57 cp $(UPSTREAM)/openafs-$(VERSION)-src.tar.bz2 .
58 tar xjf openafs-$(VERSION)-src.tar.bz2
59 rm openafs-$(VERSION)-src.tar.bz2
60 cp $(UPSTREAM)/openafs-$(VERSION)-doc.tar.bz2 .
61 tar xjf openafs-$(VERSION)-doc.tar.bz2
62 rm openafs-$(VERSION)-doc.tar.bz2
63 rm -r openafs-$(VERSION)/src/packaging/MacOS
64 rm -r openafs-$(VERSION)/src/platform/DARWIN
65 rm -r openafs-$(VERSION)/src/WINNT
66 rm openafs-$(VERSION)/src/afs/sysctl.h
67 rm openafs-$(VERSION)/src/util/fstab.c
68 mv openafs-$(VERSION) openafs_$(DEBVERS).orig
69 tar cf openafs_$(DEBVERS).orig.tar openafs_$(DEBVERS).orig
70 rm -r openafs_$(DEBVERS).orig
71 gzip -9 openafs_$(DEBVERS).orig.tar
73 configure: configure-stamp
74 configure-stamp: patch
75 @if test x"$(SYS_NAME)" = x"UNKNOWN" ; then exit 1 ; fi
78 afslogsdir=/var/log/openafs afslocaldir=/var/lib/openafs/local \
80 --with-afs-sysname=$(SYS_NAME) --disable-kernel-module \
81 --prefix=/usr --mandir=\$${prefix}/share/man \
82 --sysconfdir=/etc --libexecdir=/usr/lib \
83 --localstatedir=/var/lib --with-krb5-conf=/usr/bin/krb5-config \
84 --enable-supergroups --enable-largefile-fileserver \
85 --enable-bos-new-config \
86 --enable-debug --enable-lwp-debug \
87 $(DEBIAN_OPT_FLAGS) $(SYSTEM)
88 chmod a+x src/libafs/make_kbuild_makefile.pl
91 build: build-arch build-indep
92 build-arch: configure-stamp build-stamp
96 mkdir -p $(CURDIR)/debian/tmp
97 $(MAKE) install_nolibafs DESTDIR=$(CURDIR)/debian/tmp
98 chmod +x debian/afs-rootvol debian/afs-newcell
104 rm -f build-stamp configure-stamp install-stamp
105 [ ! -f Makefile ] || $(MAKE) distclean
108 install: install-stamp
109 install-stamp: DH_OPTIONS=
110 install-stamp: build-stamp
116 set -e; for pkg in $(LINTIAN_PACKAGES) ; do \
117 install -d debian/$$pkg/usr/share/lintian/overrides; \
118 install -m 644 -c debian/$$pkg.lintian \
119 debian/$$pkg/usr/share/lintian/overrides/$$pkg; \
121 set -e; for pkg in $(DOC_PACKAGES) ; do \
122 ln -s openafs-client debian/$$pkg/usr/share/doc/$$pkg; \
125 mv debian/openafs-client/usr/bin/pagsh \
126 debian/openafs-client/usr/bin/pagsh.openafs
127 mv debian/openafs-client/usr/share/man/man1/pagsh.1 \
128 debian/openafs-client/usr/share/man/man1/pagsh.openafs.1
129 mv debian/openafs-client/usr/bin/up \
130 debian/openafs-client/usr/bin/afs-up
131 mv debian/openafs-client/usr/share/man/man1/up.1 \
132 debian/openafs-client/usr/share/man/man1/afs-up.1
134 install -m 644 -c debian/tmp/usr/lib/pam_afs.so.1 \
135 debian/libpam-openafs-kaserver/lib/security/pam_afs.so
136 install -m 644 -c debian/tmp/usr/lib/pam_afs.krb.so.1 \
137 debian/libpam-openafs-kaserver/lib/security/pam_afs.krb.so
139 install -d debian/openafs-dbserver/usr/share/man/man8
140 ( cd debian && pod2man --section 8 --center "Debian GNU/Linux" \
142 >debian/openafs-dbserver/usr/share/man/man8/afs-rootvol.8
143 ( cd debian && pod2man --section 8 --center "Debian GNU/Linux" \
145 >debian/openafs-dbserver/usr/share/man/man8/afs-newcell.8
149 # Rules for building the openafs-modules-source package.
153 -rm -rf debian/$(srcpkg) debian/substvars
154 install -d debian/$(srcpkg)/usr/src/modules/$(package)
155 find . \( -name \*.o -o -path ./debian -o -path \*/.svn \
156 -o -path ./src/WINNT -o -path ./doc -o -path ./obj \
157 -o -path ./$(SYS_NAME) -o -path ./.pc \) -prune -o -print | \
158 cpio -admp debian/$(srcpkg)/usr/src/modules/$(package)
159 mkdir -p debian/$(srcpkg)/usr/src/modules/$(package)/debian
160 cp debian/changelog debian/copyright debian/module/* \
161 debian/$(srcpkg)/usr/src/modules/$(package)/debian/
162 chmod 755 debian/$(srcpkg)/usr/src/modules/$(package)/debian/rules
163 rm -f debian/$(srcpkg)/usr/src/modules/$(package)/*-stamp
164 cd debian/$(srcpkg)/usr/src/modules/$(package) && \
166 -cd debian/$(srcpkg)/usr/src/modules/$(package) && \
167 rm -rf src/libafs/rx src/libafs/afs src/libafs/afsint
168 chown -R root.src debian/$(srcpkg)
169 find debian/$(srcpkg) -type d | xargs chmod 755
170 find debian/$(srcpkg) -type f -perm -100 | xargs chmod 755
171 find debian/$(srcpkg) -type f -not -perm -100 | xargs chmod 644
172 chmod 775 debian/$(srcpkg)/usr/src/modules
173 cd debian/$(srcpkg)/usr/src && \
174 tar cf $(package).tar modules && \
176 gzip -9 debian/$(srcpkg)/usr/src/$(package).tar
177 chmod 644 debian/$(srcpkg)/usr/src/$(package).tar.gz
179 # Build architecture-independent files here. Pass -i to all debhelper
180 # commands in this target to reduce clutter.
182 # Also install debian/openafs-client.NEWS in the openafs-modules-source
184 binary-indep: DH_OPTIONS=-i
185 binary-indep: install-stamp binary-source
188 dh_installchangelogs NEWS
189 install -m 644 debian/openafs-client.NEWS \
190 debian/$(srcpkg)/usr/share/doc/$(srcpkg)/NEWS.Debian
191 dh_installdocs -XAdminReference -XQuickStartWindows -Xwinnotes
201 # Build architecture-dependent files here. Pass -a to all debhelper commands
202 # in this target to reduce clutter.
204 # We would like to install debugging information for everything, but currently
205 # OpenAFS's makefiles strip all binaries when installed except for the
206 # fileserver and the volserver. This is fixed in OpenAFS's development
207 # branch. Until that's released, only retain debugging information for the
208 # fileserver and the volserver.
209 binary-arch: DH_OPTIONS=-a
210 binary-arch: install-stamp
213 dh_installchangelogs NEWS
216 DH_OPTIONS= dh_installinit -popenafs-client -r -- defaults 25 18
217 DH_OPTIONS= dh_installinit -popenafs-fileserver -r
219 dh_strip --dbg-package=openafs-dbg
222 chmod 700 debian/openafs-client/var/cache/openafs
223 chmod 700 debian/openafs-dbserver/var/lib/openafs/db
224 chmod 700 debian/openafs-fileserver/etc/openafs/server
232 binary: binary-indep binary-arch
234 .PHONY: binary binary-arch binary-indep binary-source build build-arch
235 .PHONY: build-indep clean configure install