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
|
#!/usr/bin/make -f
SHELL = /bin/sh -e
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -g -Wall
export DPKG_GENSYMBOLS_CHECK_LEVEL = 4
# Fast version of dpkg/architecture.mk defining all vars in one go
ifeq (${DEB_HOST_MULTIARCH},)
$(foreach d, $(shell dpkg-architecture | sed 's/=/?=/'), $(eval export $d))
endif
include /usr/share/dpkg/buildtools.mk
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk
V := $(if $(filter terse, ${DEB_BUILD_OPTIONS}),,1)
WAF := PYTHONHASHSEED=1 ./buildtools/bin/waf \
$(patsubst parallel=%,-j%,$(filter parallel=%,${DEB_BUILD_OPTIONS}))
ifeq (linux,${DEB_HOST_ARCH_OS})
# for cross-build or build with foreign python binary (it is _gnu0_i386-gnu on hurd)
export _PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata__${DEB_HOST_ARCH_OS}_${DEB_HOST_MULTIARCH}
endif
# All supported installed python versions we build for
export PY3VERSIONS := $(or ${PY3VERSIONS}, $(shell py3versions -i))
DESTDIR := ${CURDIR}/debian/tmp
build-arch build-indep build \
install-arch install-indep install \
binary-arch binary-indep binary \
: %:
dh $@
# Build in bld/pyNN/ subdirs (named after python version),
# Since wafsamba can't build things in a named subdir,
# we have to copy (link) whole source dir into each build subdir.
.NOTPARALLEL: # don't run commands at this level in parallel
py-targets = $(patsubst %, bld/%/$(strip $1), ${PY3VERSIONS})
override_dh_auto_configure: $(call py-targets, stamp-config)
$(call py-targets, stamp-config): %/stamp-config:
@echo "=== running configure in $* ==="
mkdir -p $*
cp -al $$(ls -1 | egrep -v '^(bld|debian)$$') $*
cd $*; \
CC="${CC}" CPP="${CPP}" LD="${LD}" PKGCONFIG="${PKG_CONFIG}" \
CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" \
PYTHON=$(notdir $*) PYTHON_CONFIG=${DEB_HOST_MULTIARCH}-$(notdir $*)-config \
${WAF} -j1 -C configure \
--prefix=/usr \
--libdir=/usr/lib/${DEB_HOST_MULTIARCH} \
--disable-rpath --disable-rpath-install \
--bundled-libraries=NONE \
touch $@
override_dh_auto_build: $(call py-targets, stamp-build)
$(call py-targets, stamp-build): %/stamp-build: %/stamp-config
@echo "=== running build in $* ==="
cd $*; ${WAF} $(if $V,-v) build
# Waf should be doing this..
ar rc $*/bin/libtalloc.a $*/bin/default/talloc*.o
# the testsuite does not test python bindings so there's no reason to test all pyversions
override_dh_auto_test: \
$(if $(filter nocheck,${DEB_BUILD_OPTIONS}), , $(firstword $(call py-targets, test)))
$(call py-targets, test): %/test: %/stamp-build
echo "=== running test in $* ==="
cd $*; LD_LIBRARY_PATH=bin/shared ./bin/talloc_testsuite
$(call py-targets, install): %/install: %/stamp-build
@echo "=== running install in $* ==="
cd $*; ${WAF} install --destdir=${DESTDIR}
cp $*/bin/libtalloc.a ${DESTDIR}/usr/lib/${DEB_HOST_MULTIARCH}/
override_dh_auto_install: $(call py-targets, install)
#HACK alert: fix up wrong markers in the common include file
sed -i 's/^_PUBLIC_ //' \
${DESTDIR}/usr/include/talloc.h \
${DESTDIR}/usr/include/pytalloc.h
# ..and remove the #define itself
patch --batch ${DESTDIR}/usr/include/talloc.h debian/header-remove-_PUBLIC_-define.patch
override_dh_makeshlibs:
dh_makeshlibs -plibtalloc2 -- -c4
for pv in ${PY3VERSIONS}; do \
suff=$$(${DEB_HOST_MULTIARCH}-$$pv-config --extension-suffix | tr _ -); \
SUFF=$$(echo "$${suff%.so}" | tr a-z- A-Z_)_${DEB_VERSION_UPSTREAM}; \
echo "libpytalloc-util$${suff}.2 python3-talloc #MINVER#"; \
echo " PYTALLOC_UTIL$${SUFF}@PYTALLOC_UTIL$${SUFF} ${DEB_VERSION_UPSTREAM}"; \
cat debian/python3-talloc.symbols.in; \
done > debian/python3-talloc.symbols
dh_makeshlibs -ppython3-talloc -X/talloc.cpython -- -c3
rm debian/python3-talloc.symbols
clean:
dh_clean bld/
get-packaged-orig-source:
./debian/build-orig.sh
|