summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: a4db6f8bca231d0434d1e5891d8f83f3a9c249e8 (plain)
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
#!/usr/bin/make -f

#export DH_VERBOSE=1

# for ppc64 on Ubuntu
export DEB_GCC_NO_O3=1

SHELL    := /bin/bash
BUILDDIR := debian/build

include /usr/share/dpkg/architecture.mk

# configure takes ages to test for all db versions. Provide the installed
# version to speed things up.
DB_VERSION = $(shell dpkg-query -W -f '$${Version}' libdb-dev | \
	       perl -pe 's/^(?:[^:]*:)?(\d+)[.](\d+)[.].*/$$1$$2/')

# The 'build' target needs special handling because there there is a directory
# named 'build'.
.PHONY: build
# The build target must not be empty.  Sadly because of how make
# works, we have do duplicate the target in this case.
build:
	dh $@ -B$(BUILDDIR)

%:
	dh $@ -B$(BUILDDIR)

#
# configure
#
CONFFLAGS := LTFLAGS=--no-silent \
	     --host=$(DEB_HOST_GNU_TYPE) \
	     --build=$(DEB_BUILD_GNU_TYPE) \
	     --with-apr=/usr/bin/apr-1-config \
	     --enable-layout=Debian \
	     --includedir=/usr/include/apr-1.0 \
	     --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
	     --with-ldap=yes \
	     --with-dbm=db$(DB_VERSION) \
	     --with-sqlite3 \
	     --with-pgsql=/usr \
	     --with-gdbm \
	     --without-sqlite2 \
	     --with-berkeley-db \
	     --with-mysql=/usr \
	     --with-odbc=/usr \
	     --with-openssl=/usr \
	     --with-crypto \
	     ac_cv_prog_AWK=mawk

# files that are modified by buildconf and need to be restored during clean
SAVE_FILES := configure build/apr_common.m4

ifeq ($(DEB_HOST_ARCH),i386)
	CONFFLAGS += apr_lock_method=USE_PROC_PTHREAD_SERIALIZE
else
	CONFFLAGS += ac_cv_func_pthread_mutexattr_setpshared=no \
		     ac_cv_func_sem_open=no
endif

override_dh_auto_configure:
	mkdir -p $(BUILDDIR)/docs
	for f in $(SAVE_FILES) ; do [ -e $$f.dr-orig ] || cp -p $$f $$f.dr-orig ; done
	./buildconf --with-apr=$(shell apr-1-config --srcdir)
	cd $(BUILDDIR) && $(CURDIR)/configure $(CONFFLAGS)

#
# build
#

# get cflags from apr-config but remove -O2
export DEB_CFLAGS_MAINT_PREPEND := $(shell apr-1-config --cflags |perl -p -e 's!-O.( |$$)!!')
export DEB_LDFLAGS_MAINT_PREPEND := $(shell apr-1-config --ldflags)

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
  MAKEARGS := -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
endif

override_dh_auto_build:
	dh_auto_build -B$(BUILDDIR)
	$(MAKE) $(MAKEARGS) -C $(BUILDDIR) dox

#
# test
#

ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
	$(MAKE) -C $(BUILDDIR)/test $(MAKEARGS) all
	$(MAKE) -C $(BUILDDIR)/test -j1 check

else
override_dh_auto_test:

endif

#
# install
#
override_dh_auto_install:
	dh_auto_install --destdir=debian/tmp
	perl -p -i -e "s,^dependency_libs=.*,dependency_libs=''," debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libaprutil-1.la
	# Remove the buildpath: https://reproducible-builds.org/docs/build-path/
	perl -p -i -e "s,$(CURDIR),BUILDPATH," debian/tmp/usr/bin/apu-1-config

# The -X option causes the internal-use-only driver libs to be ignored
override_dh_makeshlibs:
	dh_makeshlibs -Xapr-util-1 -- -Idebian/symbols.$(DEB_HOST_ARCH_OS)

override_dh_auto_clean:
	dh_auto_clean
	rm -rf $(BUILDDIR)
	for f in $(SAVE_FILES) ; do [ ! -e $$f.dr-orig ] || mv $$f.dr-orig $$f ; done