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 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
|
#!/usr/bin/make -f
# Turn on VERBOSE output
#export DH_VERBOSE=1
#enable dpatch
include /usr/share/dpatch/dpatch.make
# These are used for cross-compiling and for saving the configure script
# # from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_BUILD_ARCH_OS ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH_OS)
BUILDDIR := build-$(DEB_BUILD_ARCH)
CFLAGS := $(CFLAGS) -pipe -Wall -g
# hardening options
H_CFLAGS := -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -fstack-protector
H_LDFLAGS := -Wl,-z,relro
# API to min kernel map:
# 2.6.27: dup3, SOCK_CLOEXEC, epoll_create1
# 2.6.28: accept4
CONFFLAGS += ac_cv_prog_AWK=mawk apr_cv_sctp=no \
apr_cv_sock_cloexec=no \
apr_cv_epoll_create1=no \
apr_cv_dup3=no \
apr_cv_accept4=no
# apr_cv_mutex_robust_shared causes hangs in procmutex test on armel and alpha
# let's just disable this for squeeze
ifneq (,$(findstring armel,$(DEB_BUILD_ARCH)))
CONFFLAGS += apr_cv_mutex_robust_shared=no
endif
ifneq (,$(findstring alpha,$(DEB_BUILD_ARCH)))
CONFFLAGS += apr_cv_mutex_robust_shared=no
endif
# SH4 cannot use proc_pthread.
ifneq (,$(findstring sh4,$(DEB_BUILD_ARCH)))
CONFFLAGS += apr_cv_hasprocpthreadser=no ac_cv_define_PTHREAD_PROCESS_SHARED=no
endif
# Enable debug builds
ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
endif
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
MAKEFLAGS += -j$(NUMJOBS)
endif
ifeq (,$(findstring notest,$(DEB_BUILD_OPTIONS))$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
TEST_TARGET = test
else
TEST_TARGET =
endif
# disable tests on hurd until they are fixed (#530286)
ifeq (hurd, $(DEB_BUILD_ARCH_OS))
TEST_TARGET =
endif
SHELL=/bin/bash
$(BUILDDIR)/config.status: patch-stamp
dh_testdir
mkdir -p $(BUILDDIR)/docs
./buildconf
# we need to force the use of bash here. Otherwise, if apr is built with
# /bin/sh -> /bin/bash, the resulting libtool will not work on systems
# where /bin/sh -> /bin/dash
cd $(BUILDDIR) && CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" $(CONFFLAGS) CONFIG_SHELL=/bin/bash /bin/bash ../configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --enable-layout=Debian --includedir=\$${prefix}/usr/include/apr-1.0 --with-installbuilddir=\$${prefix}/usr/share/apr-1.0/build --enable-nonportable-atomics
# Determine whether upstream's configure gives the same definition of apr_ino_t as we had until 1.2.11-1
rm -f debian/ino_t_test
gcc -I$(CURDIR)/include -I$(BUILDDIR)/include `$(BUILDDIR)/apr-1-config --cppflags` -o debian/ino_t_test debian/ino_t_test.c
debian/ino_t_test
rm -f debian/ino_t_test
ifeq (hurd, $(DEB_BUILD_ARCH_OS))
# multicast not supported on Hurd
sed -i '/HAVE_STRUCT_IPMREQ/ d' $(BUILDDIR)/include/arch/unix/apr_private.h
endif
ifeq (linux, $(DEB_BUILD_ARCH_OS))
if grep -q APR_HAS_POSIXSEM_SERIALIZE.*0 $(BUILDDIR)/include/apr.h ;\
then \
echo "WARNING: This is Linux but configure did not detect POSIX semaphores." ;\
if [ "$(stat -c '%d' /dev/shm)" = "$(stat -c '%d' /dev)" ] ;\
then \
echo "ERROR: POSIX semaphores not usable and /dev/shm not mounted." ;\
echo "ERROR: Aborting." ;\
echo "HINT: If you are using pbuilder or cowbuilder, add /dev/shm to BINDMOUNTS" ;\
echo "HINT: in pbuilderrc" ;\
exit 1 ;\
fi ;\
fi
endif
build: patch-stamp build-stamp
build-stamp: $(BUILDDIR)/config.status
dh_testdir
$(MAKE) -C $(BUILDDIR) CFLAGS="$(H_CFLAGS)" LDFLAGS="$(H_LDFLAGS)"
$(MAKE) -C $(BUILDDIR) dox
touch $@
clean: unpatch
dh_testdir
dh_testroot
rm -f build-stamp test-stamp debian/ino_t_test
rm -f configure build/lt* build/libtool.m4 build-outputs.mk include/arch/unix/apr_private.h.in
rm -rf $(BUILDDIR)
dh_clean
test: test-stamp
# the testsockets test will fail on vservers (no 127.0.0.1) or if ipv6 is
# enabled in the kernel but not configured on any interface
IGNORE_TESTSOCK = $(shell IGN=false; \
/sbin/ifconfig|grep -q 127.0.0.1 || IGN=true; \
grep -q ipv6 /proc/net/protocols && ( /sbin/ifconfig|grep -q inet6 || IGN=true ) ; \
echo $$IGN )
test-stamp: build
dh_testdir
$(MAKE) -C $(BUILDDIR)/test all CFLAGS="$(H_CFLAGS)" LDFLAGS="$(H_LDFLAGS)"
cd $(BUILDDIR)/test && ./testall -v testsockets testsock || $(IGNORE_TESTSOCK)
cd $(BUILDDIR)/test && ( ulimit -S -s 8192 ; ./testall -v testatomic)
cd $(BUILDDIR)/test && ./testall -v -x testsockets testsock testatomic
touch $@
install: build $(TEST_TARGET)
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs -a
$(MAKE) -C $(BUILDDIR) install DESTDIR=$(CURDIR)/debian/tmp
binary-indep: build install
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs CHANGES
dh_installdocs
dh_install -a
dh_installman -plibapr1-dev debian/apr-1-config.1
dh_link
dh_strip --dbg-package=libapr1-dbg
dh_lintian
dh_compress
dh_fixperms
dh_makeshlibs -- -Idebian/symbols.$(DEB_BUILD_ARCH_OS)
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
|