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 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
#!/usr/bin/make -f
#export DH_VERBOSE=1
#export DEB_BUILD_OPTIONS=nocheck
export HOME = $(CURDIR)/build/
export PYTHONWARNINGS=d
export PYTHONHASHSEED=random
export CFLAGS = $(shell dpkg-buildflags --get CFLAGS)
export CPPFLAGS = $(shell dpkg-buildflags --get CPPFLAGS)
export LDFLAGS = $(shell env DEB_LDFLAGS_MAINT_APPEND=-Wl,-z,now dpkg-buildflags --get LDFLAGS)
DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
ifeq ($(DEB_BUILD_ARCH),arm64)
export CFLAGS_noopt = $(patsubst -O2,-O0,$(CFLAGS))
else
export CFLAGS_noopt = $(patsubst -O2,-Og,$(CFLAGS))
endif
nproc = $(or $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))),1)
python2 = $(shell pyversions -r)
python2d = $(addsuffix -dbg,$(python2))
python_all = $(python2) $(python2d)
loop = echo -n $(1) | xargs -d ' ' -t -I {} env {}
pythonpath = $$(_py_=$(strip $(1)); _py_=$${_py_\#python}; ls -d $(CURDIR)/build/lib.*-$${_py_})
default_pythonpath = $(call pythonpath,$(shell pyversions -d))
version = $(shell dpkg-parsechangelog | grep ^Version | cut -d ' ' -f 2)
vigra_version = $(shell dpkg-query -Wf '$${Version}' libvigraimpex-dev | sed -e 's/[+]b[0-9]\+$$//')
# build and build-* targets
# =========================
.PHONY: build
build: build-arch build-indep
.PHONY: build-arch
build-arch: build/build-stamp
build/build-stamp: debian/rules
$(MAKE) -f debian/rules -j$(nproc) $(addprefix build/build-stamp-,$(python_all))
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
$(call loop, $(python_all)) debian/run-tests.py
endif
touch $(@)
build/cruft-stamp:
rm -Rf include/zlib*/ src/zlib*/ src/libpng*/ src/libtiff*/
rm -Rf include/vigra/
rm -Rf src/ga/
cd gamera/backport && rm -f ConfigParser.py optparse.py sets.py textwrap.py
mkdir -p $(dir $@)
touch $(@)
build/build-stamp-python%: build/cruft-stamp
python$(*) setup.py build --nowx
touch $(@)
build/build-stamp-python%-dbg: build/cruft-stamp
CFLAGS="$$CFLAGS_noopt" python$(*)-dbg setup.py build --nowx
touch $(@)
.PHONY: build-indep
# dpkg-buildpackage (<< 1.16.2) called the build target without Build-Depends
# installed. To work around this buggy behaviour, we build arch-independent
# stuff in binary-arch rather than here. See bug #374029.
# binary and binary-* targets
# ===========================
.PHONY: binary
binary: binary-arch binary-indep
build/install-stamp: build/build-stamp
$(call loop, $(python_all)) setup.py install --prefix=/usr --root=debian/tmp/ --nowx
sed -i -e '1 s,^#!.*,#!/usr/bin/python,' debian/tmp/usr/bin/*
rm -rf debian/tmp/usr/lib/python*/*-packages/gamera/src/
rm -f debian/tmp/usr/bin/gamera_post_install.py
touch $(@)
.PHONY: binary-arch
binary-arch: build/install-stamp
dh_testroot
dh_install -a -X.pyc --fail-missing
dh_installdocs -a
dh_installchangelogs -a
dh_python2 -a
dh_link -a
dh_compress -a
dh_fixperms -a
dh_strip -a --dbg-package=python-gamera-dbg
dh_shlibdeps -a
dh_installdeb -a
dh_gencontrol -a -- -Vvigra:Version=$(vigra_version)
dh_md5sums -a
dh_builddeb -a -- -Zxz
.PHONY: binary-indep
binary-indep: build/install-stamp build/doc-stamp doc/manpage/gamera_gui.1
dh_testroot
dh_installdirs -i
pngtopnm < gamera/pixmaps/icon.png | ppmtoxpm > debian/gamera-gui/usr/share/pixmaps/gamera-gui.xpm
dh_install -i -X.pyc --fail-missing
find debian/gamera-gui/ -name has_gui.py -delete
find debian/gamera-gui/ -print0 | grep -FzZ "gui/__init__.py" | xargs -0 -r rm
dh_installdocs -i
cd debian/gamera-doc/usr/share/doc/gamera-doc/html/ && \
$(CURDIR)/debian/symlink-helper ../src/ . && \
rdfind -makehardlinks true -makeresultsfile false .
dh_installchangelogs -i
dh_installmenu -i
dh_installman -i
dh_python2 -i
set -e; cd debian/python-gamera-dev/usr/include/; \
mv $(shell pyversions -d)/gamera .; \
rm -Rf python2.*/; \
for version in $(shell pyversions -r); do \
for suffix in "" _d; do \
mkdir -p $$version$$suffix; \
ln -sf ../gamera $$version$$suffix/gamera; \
done; \
done
dh_link -i
dh_compress -i -X.txt
dh_fixperms -i
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i -- -Zxz
doc/manpage/gamera_gui.1: build/build-stamp
mkdir -p doc/manpage/
ln -sf $(CURDIR)/debian/manpage-helper-1 doc/manpage/
ln -sf $(CURDIR)/debian/manpage-helper-2 doc/manpage/gamera_gui
cd doc/manpage/ && \
PYTHONPATH=$(default_pythonpath) \
help2man --version-string=$(version) --name='GUI for the Gamera framework' --no-info ./gamera_gui > gamera_gui.1
build/doc-stamp: build/build-stamp
cd doc && PYTHONPATH=$(default_pythonpath) python gendoc.py
touch $(@)
# clean target
# ============
.PHONY: clean
clean: debian/control
dh_clean
find -name '*.py[co]' -delete
rm -Rf doc/html/images/
rm -Rf doc/manpage/
rm -Rf build/
# vim:ts=4 sw=4 noet
|