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
|
#!/usr/bin/make -f
# -*- makefile -*-
# export DH_VERBOSE=1
# %:
# dh $@
include /usr/share/dpkg/architecture.mk
-include /usr/share/dpkg/buildtools.mk
STRIP ?= strip
export SOURCE_DATE_EPOCH = $(shell date -d "$$(dpkg-parsechangelog --count 1 -SDate)" +%s)
# Package name
PACKAGE_NAME = taggrepper
# Install program
INSTALL = install
INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644
INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755
INSTALL_SCRIPT = $(INSTALL) -p -o root -g root -m 755
INSTALL_DIR = $(INSTALL) -p -d -o root -g root -m 755
# The installation directory
PACKAGE_DIR = debian/$(PACKAGE_NAME)
CFLAGS ?= -g $(shell dpkg-buildflags --get CFLAGS) $(shell dpkg-buildflags --get CPPFLAGS)
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
endif
LDFLAGS += -Wl,-z,defs $(shell dpkg-buildflags --get LDFLAGS)
ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
else
CROSS= --build $(DEB_BUILD_GNU_TYPE)
endif
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
INSTALL_PROGRAM += -s
endif
config.status: configure
$(checkdir)
ifneq "$(wildcard /usr/share/misc/config.sub)" ""
cp -f /usr/share/misc/config.sub config.sub
endif
ifneq "$(wildcard /usr/share/misc/config.guess)" ""
cp -f /usr/share/misc/config.guess config.guess
endif
./configure $(CROSS) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: config.status
$(checkdir)
$(MAKE)
touch $@
clean: checkroot
$(checkdir)
rm -f build-stamp
[ ! -f Makefile ] || $(MAKE) distclean
rm -f config.sub config.guess
rm -rf $(PACKAGE_DIR) debian/files debian/substvars config.log
install: checkroot build
$(checkdir)
$(MAKE) DESTDIR=$(CURDIR)/$(PACKAGE_DIR) install
# fix directory permissions
find '$(PACKAGE_DIR)' -type d -print0 | xargs -0r chmod 0755
# Build architecture-independent files here.
binary-indep: checkroot build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: checkroot build install
$(checkdir)
$(INSTALL_DIR) $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/
$(INSTALL_FILE) -m 644 README $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/
$(INSTALL_FILE) -m 644 ChangeLog $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/changelog
$(INSTALL_FILE) -m 644 debian/changelog $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/changelog.Debian
for i in $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/changelog*;do \
gzip -9nv $$i; \
done;
$(INSTALL_FILE) -m 644 debian/copyright $(PACKAGE_DIR)/usr/share/doc/$(PACKAGE_NAME)/copyright
$(INSTALL_DIR) $(PACKAGE_DIR)/usr/share/man/man1
$(INSTALL_FILE) -m 644 doc/$(PACKAGE_NAME).1 $(PACKAGE_DIR)/usr/share/man/man1
gzip -9nv $(PACKAGE_DIR)/usr/share/man/*/*
# Strip binaries
ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
$(STRIP) -R.note -R.comment $(PACKAGE_DIR)/usr/bin/*
endif
dpkg-shlibdeps $(PACKAGE_DIR)/usr/bin/taggrepper
$(INSTALL_DIR) $(PACKAGE_DIR)/DEBIAN
cd $(PACKAGE_DIR) && find * -type f ! -regex '^DEBIAN/.*' -print0 | LC_ALL=C sort -z | xargs -r0 md5sum > DEBIAN/md5sums
dpkg-gencontrol -p$(PACKAGE_NAME) -P$(PACKAGE_DIR)
find $(PACKAGE_DIR) -newermt "@$$SOURCE_DATE_EPOCH" -print0 | \
xargs -0r touch --no-dereference --date="@$$SOURCE_DATE_EPOCH"
dpkg-deb --build $(PACKAGE_DIR) ..
binary: binary-indep binary-arch
define checkdir
test -f src/taggrepper.c && test -f debian/rules
endef
checkroot:
$(checkdir)
test root = "`whoami`"
.PHONY: build clean binary-indep binary-arch binary install
|