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
|
#!/usr/bin/make -f
DEBVERS ?= $(shell dpkg-parsechangelog | sed -n -e 's/^Version: //p')
VERSION ?= $(shell echo '$(DEBVERS)' | sed -e 's/^[[:digit:]]*://' -e 's/[-].*//')
DEBFLAVOR ?= $(shell dpkg-parsechangelog | grep -E ^Distribution: | cut -d" " -f2)
DEBPKGNAME ?= $(shell dpkg-parsechangelog | grep -E ^Source: | cut -d" " -f2)
GIT_TAG ?= $(shell echo '$(VERSION)' | sed -e 's/~/_/')
DEBIAN_BRANCH ?= $(shell cat debian/gbp.conf | grep debian-branch | cut -d'=' -f2 | awk '{print $1}')
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
# Enables hardening flags.
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
# Python helper
-include /usr/share/python/python.mk
# All available python versions (python-support)
PYVERS := $(shell pyversions -rv)
# CFLAGS
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
build: build-all $(PYVERS:%=build-python%)
build: build-all-stamp
build-all: build-all-stamp
build-all-stamp:
dh_testdir
$(MAKE)
touch $@
$(PYVERS:%=build-python%): build-all-stamp $(PYVERS:%=build-python%-stamp)
build-python%-stamp:
CFLAGS="$(CFLAGS)" python$* setup.py build
touch $@
clean:
dh_testdir
dh_testroot
rm -f build-stamp portlistingparse.o build-python*-stamp
$(MAKE) clean
dh_clean
install: build install-prereq install-all $(PYVERS:%=install-python%)
install-prereq:
dh_testdir
dh_testroot
dh_prep
install-all: install-all-stamp
install-all-stamp: install-prereq
$(MAKE) install PREFIX=$(CURDIR)/debian/miniupnpc INSTALLDIRLIB=$(CURDIR)/debian/miniupnpc/usr/lib/$(DEB_HOST_MULTIARCH)
# Move the library in its corresponding separate package folder.
mkdir -p $(CURDIR)/debian/libminiupnpc10/usr
mv $(CURDIR)/debian/miniupnpc/usr/lib $(CURDIR)/debian/libminiupnpc10/usr
# Move the include files
mkdir -p $(CURDIR)/debian/libminiupnpc-dev/usr/lib
mv $(CURDIR)/debian/miniupnpc/usr/include $(CURDIR)/debian/libminiupnpc-dev/usr
mkdir -p $(CURDIR)/debian/libminiupnpc-dev/usr/lib/$(DEB_HOST_MULTIARCH)
mv $(CURDIR)/debian/libminiupnpc10/usr/lib/$(DEB_HOST_MULTIARCH)/libminiupnpc.so $(CURDIR)/debian/libminiupnpc-dev/usr/lib/$(DEB_HOST_MULTIARCH)
mv $(CURDIR)/debian/libminiupnpc10/usr/lib/$(DEB_HOST_MULTIARCH)/libminiupnpc.a $(CURDIR)/debian/libminiupnpc-dev/usr/lib/$(DEB_HOST_MULTIARCH)
$(PYVERS:%=install-python%): $(PYVERS:%=install-python%-stamp)
install-python%-stamp: install-all-stamp
python$* setup.py install --root=$(CURDIR)/debian/python-miniupnpc --no-compile $(py_setup_install_args)
binary-indep: build install
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs Changelog.txt
dh_installdocs
dh_installman
dh_python2
dh_strip
dh_compress
dh_fixperms
dh_makeshlibs -V -- -c4
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
############################################
### Below is to manage upstream Git repo ###
### and is not used during package build ###
############################################
gen-orig-xz:
git tag -v $(GIT_TAG) || true
if [ ! -f ../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ] ; then \
git archive --prefix=$(DEBPKGNAME)-$(VERSION)/ $(GIT_TAG) | xz >../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ; \
fi
[ ! -e ../build-area ] && mkdir ../build-area || true
[ ! -e ../build-area/$(DEBPKGNAME)_$(VERSION).orig.tar.xz ] && cp ../$(DEBPKGNAME)_$(VERSION).orig.tar.xz ../build-area
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure build-arch build-indep gen-orig-xz
|