1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
|
#! /usr/bin/make -f
## debian/rules for delo
## by Gergely Nagy <algernon@debian.org>
PACKAGE = delo
PKGDIR = $(CURDIR)/debian/$(PACKAGE)
build: patch build-stamp
build-stamp:
$(testdir)
$(MAKE) -C loader
$(MAKE) -C delo
touch build-stamp
clean: clean1 unpatch
rm -rf debian/patched
clean1:
$(testdir)
$(testroot)
rm -f build-stamp patch-stamp debian/files debian/$(PACKAGE).substvars
-$(MAKE) -C loader clean
-$(MAKE) -C delo clean
install: build
$(testdir)
$(testroot)
rm -rf debian/files debian/$(PACKAGE).substvars $(PKGDIR)
install -d $(PKGDIR)/boot
install -d $(PKGDIR)/sbin
install -d $(PKGDIR)/usr/sbin
install -d $(PKGDIR)/usr/share/doc/$(PACKAGE)
install -d $(PKGDIR)/usr/share/man/man5
install -d $(PKGDIR)/usr/share/man/man8
install -m 0644 loader/delo.2nd.raw $(PKGDIR)/boot/delo.2nd
install -m 0755 delo/delo $(PKGDIR)/sbin
install -m 0644 README $(PKGDIR)/usr/share/doc/$(PACKAGE)/
install -m 0644 TODO $(PKGDIR)/usr/share/doc/$(PACKAGE)/
# Build architecture-dependent files here.
delo: build install
$(testdir)
$(testroot)
## Install things that only exist in the debian packaged version of delo
install -m 0755 debian/local/deloconfig $(PKGDIR)/usr/sbin
install -m 0644 debian/manpages/delo.8 $(PKGDIR)/usr/share/man/man8
install -m 0644 debian/manpages/deloconfig.8 $(PKGDIR)/usr/share/man/man8
install -m 0644 debian/manpages/delo.conf.5 $(PKGDIR)/usr/share/man/man5
## Install changelogs
install -m 0644 debian/changelog $(PKGDIR)/usr/share/doc/$(PACKAGE)/changelog.Debian
install -m 0644 debian/copyright $(PKGDIR)/usr/share/doc/$(PACKAGE)/copyright
## Strip binaries
strip --remove-section=.note --remove-section=.comment \
$(PKGDIR)/sbin/delo
## Compress files
gzip -9 $(PKGDIR)/usr/share/doc/$(PACKAGE)/changelog.Debian
gzip -9 $(PKGDIR)/usr/share/man/man5/delo.conf.5
gzip -9 $(PKGDIR)/usr/share/man/man8/delo.8
gzip -9 $(PKGDIR)/usr/share/man/man8/deloconfig.8
## Fix permissions
chown -R root:root $(PKGDIR)/
find $(PKGDIR) -type d | xargs chmod 0755
find $(PKGDIR) -type f | xargs chmod a-sw
find $(PKGDIR) -type f | xargs chmod u+w
## Install files into DEBIAN/
install -d $(PKGDIR)/DEBIAN
install -m 0755 debian/$(PACKAGE).postinst $(PKGDIR)/DEBIAN/postinst
install -m 0755 debian/$(PACKAGE).prerm $(PKGDIR)/DEBIAN/prerm
## Compute ${shlibs:Depends}
dpkg-shlibdeps -Tdebian/$(PACKAGE).substvars -dDepends \
$(PKGDIR)/sbin/delo
## Generate DEBIAN/control
dpkg-gencontrol -isp -p$(PACKAGE) -Tdebian/$(PACKAGE).substvars \
-P$(PKGDIR)
## Generate DEBIAN/md5sums
cd $(PKGDIR) >/dev/null ;\
find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums
## Build the binary deb package
dpkg --build $(PKGDIR) ..
binary-indep:
binary-arch: delo
binary: binary-indep binary-arch
patch: patch-stamp
patch-stamp:
test -d debian/patched || install -d debian/patched
@echo "Patches applied in the Debian version of $(PACKAGE):" > $@T
@for patch in `cat debian/patches/00list`; do \
stamp=debian/patched/$$patch.dpatch; \
patch=debian/patches/$$patch.dpatch; \
test -x $$patch || chmod +x $$patch; \
if test -f $$stamp; then \
echo "$$patch already applied."; \
echo -e "\n$$patch:" >> $@T; \
sed -n 's/^## *DP: */ /p' $$patch >> $@T; \
else \
echo -n "applying patch $$patch..."; \
if $$patch -patch >$$stamp.new 2>&1; then \
mv $$stamp.new $$stamp; \
touch $$stamp; \
echo -e "\n$$patch:" >> $@T; \
sed -n 's/^## *DP: */ /p' $$patch >> $@T; \
echo " ok."; \
else \
echo " failed."; \
exit 1; \
fi; \
fi; \
done
mv -f $@T $@
unpatch:
@for patch in `tac debian/patches/00list`; do \
stamp=debian/patched/$$patch.dpatch; \
patch=debian/patches/$$patch.dpatch; \
test -x $$patch || chmod +x $$patch; \
if test -f $$stamp; then \
echo -n "reverting patch $$patch..."; \
if $$patch -unpatch 2>&1 >/dev/null; then \
rm -f $$stamp; \
echo " ok."; \
else \
echo " failed."; \
exit 1; \
fi; \
fi; \
done
rm -f patch-stamp
## Some handy macros
define testdir
test -e debian/control || ( echo "debian/control not found"; exit 1 )
endef
define testroot
test "x`whoami`" = "xroot" || ( echo "You must run this as root!"; exit 1 )
endef
.PHONY: build clean binary-indep binary-arch binary install delo \
patch clean1 unpatch
|