summaryrefslogtreecommitdiffstats
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules91
1 files changed, 91 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..ecdaa61
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,91 @@
+#!/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
+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 cr $*/bin/libtdb.a $*/bin/default/common/*.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 $*; ${WAF} test
+
+$(call py-targets, install): %/install: %/stamp-build
+ @echo "=== running install in $* ==="
+ cd $*; ${WAF} install --destdir=${DESTDIR}
+ cp $*/bin/libtdb.a ${DESTDIR}/usr/lib/${DEB_HOST_MULTIARCH}/
+override_dh_auto_install: $(call py-targets, install)
+ mv ${DESTDIR}/usr/bin/tdbbackup \
+ ${DESTDIR}/usr/bin/tdbbackup.tdbtools
+ mv ${DESTDIR}/usr/share/man/man8/tdbbackup.8 \
+ ${DESTDIR}/usr/share/man/man8/tdbbackup.tdbtools.8
+ #HACK alert: fix up wrong markers in the common include file
+ sed -i 's/^_PUBLIC_ //' ${DESTDIR}/usr/include/tdb.h
+ # ..and remove the #define itself
+ patch --batch ${DESTDIR}/usr/include/tdb.h debian/header-remove-_PUBLIC_-define.patch
+
+clean:
+ dh_clean bld/
+
+get-packaged-orig-source:
+ ./debian/build-orig.sh