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
|
#! /usr/bin/make -f
## Written by Gergely Nagy <algernon@debian.org>
## This is under GPL v2.
PACKAGE = dadadodo
PKGDIR = ${CURDIR}/debian/${PACKAGE}
CFLAGS = -Wall -O2
ifneq (,$(findstring debug,${DEB_BUILD_OPTIONS}))
CFLAGS += -g
endif
build: patch
test -e debian/control
$(MAKE) CFLAGS="${CFLAGS}"
clean: unpatch
test -e debian/control && test "x`whoami`" = "xroot"
rm -rf debian/${PACKAGE}.substvars ${PKGDIR} debian/files debian/patched
$(MAKE) clean
install: build
test -e debian/control
install -d ${PKGDIR}/usr/share/doc/${PACKAGE} \
${PKGDIR}/usr/bin ${PKGDIR}/usr/share/man/man1
install -m 0644 dodotodo ${PKGDIR}/usr/share/doc/${PACKAGE}/TODO
install -m 0644 README ${PKGDIR}/usr/share/doc/${PACKAGE}/
install -m 0755 dadadodo ${PKGDIR}/usr/bin
binary-dadadodo: install
test -e debian/control && test "x`whoami`" = "xroot"
## Install debian-specific stuff
# Like README.Debian...
install -m 0644 debian/local/README.Debian \
${PKGDIR}/usr/share/doc/${PACKAGE}
# ..the changelogs..
install -m 0644 debian/changelog \
${PKGDIR}/usr/share/doc/${PACKAGE}/changelog.Debian
# ..the copyright file..
cat debian/copyright patch-stamp >${PKGDIR}/usr/share/doc/${PACKAGE}/copyright
# ..a manual page
gzip -9fc debian/local/dadadodo.1 >${PKGDIR}/usr/share/man/man1/dadadodo.1.gz
## Strip binaries
ifeq (,$(findstring nostrip,${DEB_BUILD_OPTIONS}))
strip --remove-section=.comment --remove-section=.note \
${PKGDIR}/usr/bin/dadadodo
endif
## Compress the changelog
gzip -9f ${PKGDIR}/usr/share/doc/${PACKAGE}/changelog.Debian
## Fix permissions
find ${PKGDIR} -print0 2>/dev/null | xargs -0r chown \
--no-dereference 0.0
find ${PKGDIR} ! -type l -print 0 2>/dev/null | xargs -0r \
chmod go=rX,u+rw,a-s
## Generate ${shlibs:Depends}
dpkg-shlibdeps -Tdebian/${PACKAGE}.substvars -dDepends \
${PKGDIR}/usr/bin/dadadodo
## Create DEBIAN/
install -d ${PKGDIR}/DEBIAN
## Generate DEBIAN/md5sums
cd ${PKGDIR} >/dev/null ;\
find * -type f ! -regex '^DEBIAN/.*' -print0 | xargs -r0 md5sum > DEBIAN/md5sums
## Generate DEBIAN/control
dpkg-gencontrol -isp -p${PACKAGE} -Tdebian/${PACKAGE}.substvars \
-P${PKGDIR}
## Build the binary package
dpkg --build ${PKGDIR} ..
binary-indep:
binary-arch: binary-dadadodo
binary: binary-indep binary-arch
## Below here is the realm of Deep Magic
patch: patch-stamp
patch-stamp:
test -d debian/patched || install -d debian/patched
@echo "Patches applied in the Debian version of ${PACKAGE}:" > $@T
@for entry in `cat debian/patches/00list`; do \
stamp=debian/patched/$$entry.dpatch; \
patch=debian/patches/$$entry.dpatch; \
test -x $$patch || chmod +x $$patch; \
if test -f $$stamp; then \
echo "$$patch already applied."; \
printf "\n$$patch " >> $@T; \
sed -n "s/^## $$entry.dpatch by \(.*\)/(\1)/p" $$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; \
printf "\n$$patch " >> $@T; \
sed -n "s/^## $$entry.dpatch by \(.*\)/(\1)/p" $$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
.PHONY: binary binary-arch binary-indep clean build install binary-dadadodo \
patch unpatch
|