summaryrefslogtreecommitdiffstats
path: root/debian/patches
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches')
-rw-r--r--debian/patches/debug_testpoll_failure.patch16
-rw-r--r--debian/patches/dont_override_external_buildflags19
-rw-r--r--debian/patches/fix-apr.pc.patch20
-rw-r--r--debian/patches/fix-atomics-some-more.patch190
-rw-r--r--debian/patches/fix-atomics.patch89
-rw-r--r--debian/patches/fix_apr-config.patch20
-rw-r--r--debian/patches/fix_doxygen.patch69
-rw-r--r--debian/patches/hurd_path_max.patch19
-rw-r--r--debian/patches/hurd_shm_flock.patch53
-rw-r--r--debian/patches/libtoolize_check.patch27
-rw-r--r--debian/patches/omit_extra_libs.patch18
-rw-r--r--debian/patches/python3-hashbang.patch8
-rw-r--r--debian/patches/series14
-rw-r--r--debian/patches/ship_find_apr.m4.patch25
-rw-r--r--debian/patches/use_fcntl_locking.patch22
15 files changed, 609 insertions, 0 deletions
diff --git a/debian/patches/debug_testpoll_failure.patch b/debian/patches/debug_testpoll_failure.patch
new file mode 100644
index 0000000..721e030
--- /dev/null
+++ b/debian/patches/debug_testpoll_failure.patch
@@ -0,0 +1,16 @@
+# reproducible.debian.net gave strange test error on build:
+# testpoll : Line 876: apr_pollcb_poll() didn't sleep
+# FAILED 1 of 23
+# add some debug output
+--- apr.orig/test/testpoll.c
++++ apr/test/testpoll.c
+@@ -908,6 +908,9 @@ static void justsleep(abts_case *tc, voi
+ rv = apr_pollcb_poll(pollcb, apr_time_from_msec(200), NULL, NULL);
+ t2 = apr_time_now();
+ ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));
++ if ((t2 - t1) <= apr_time_from_msec(100))
++ abts_log_message("pollset method: %d t1: %ld t2: %ld rv: %d\n",
++ i, (long)t1, (long)t2, rv);
+ ABTS_ASSERT(tc,
+ "apr_pollcb_poll() didn't sleep",
+ (t2 - t1) > apr_time_from_msec(100));
diff --git a/debian/patches/dont_override_external_buildflags b/debian/patches/dont_override_external_buildflags
new file mode 100644
index 0000000..0d02577
--- /dev/null
+++ b/debian/patches/dont_override_external_buildflags
@@ -0,0 +1,19 @@
+# Don't force apr-using projects to use the compile flags used during
+# apr's compilation.
+--- apr.orig/build/apr_rules.mk.in
++++ apr/build/apr_rules.mk.in
+@@ -42,10 +42,10 @@ LIBTOOL=@LIBTOOL@
+ # compilation and linking flags that are supposed to be set only by the user.
+ # configure adds to them for tests, but we restore them at the end.
+ #
+-CFLAGS=@CFLAGS@
+-CPPFLAGS=@CPPFLAGS@
+-LDFLAGS=@LDFLAGS@
+-LIBS=@LIBS@
++CFLAGS?=@CFLAGS@
++CPPFLAGS?=@CPPFLAGS@
++LDFLAGS?=@LDFLAGS@
++LIBS?=@LIBS@
+ DEFS=@DEFS@
+
+ # anything added to the standard flags by configure is moved to EXTRA_*
diff --git a/debian/patches/fix-apr.pc.patch b/debian/patches/fix-apr.pc.patch
new file mode 100644
index 0000000..890b514
--- /dev/null
+++ b/debian/patches/fix-apr.pc.patch
@@ -0,0 +1,20 @@
+From: <tfheen@debian.org>
+Subject: No description.
+
+---
+ apr.pc.in | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+Index: apr/apr.pc.in
+===================================================================
+--- apr.orig/apr.pc.in
++++ apr/apr.pc.in
+@@ -7,5 +7,6 @@
+ Name: APR
+ Description: The Apache Portable Runtime library
+ Version: @APR_DOTTED_VERSION@
+-Libs: -L${libdir} -l@APR_LIBNAME@ @EXTRA_LIBS@
+-Cflags: @EXTRA_CPPFLAGS@ @EXTRA_CFLAGS@ -I${includedir}
++Libs: -L${libdir} -l@APR_LIBNAME@
++Libs.private: @EXTRA_LIBS@
++Cflags: @EXTRA_CPPFLAGS@ -I${includedir}
diff --git a/debian/patches/fix-atomics-some-more.patch b/debian/patches/fix-atomics-some-more.patch
new file mode 100644
index 0000000..786a9c3
--- /dev/null
+++ b/debian/patches/fix-atomics-some-more.patch
@@ -0,0 +1,190 @@
+# upstream trunk r1907541, r1907637, r1907642, r1907677, r1907678
+--- apr.orig/atomic/unix/mutex64.c
++++ apr/atomic/unix/mutex64.c
+@@ -96,7 +96,14 @@ apr_status_t apr__atomic_generic64_init(
+
+ APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem)
+ {
+- return *mem;
++ apr_uint64_t cur_value;
++ DECLARE_MUTEX_LOCKED(mutex, mem);
++
++ cur_value = *mem;
++
++ MUTEX_UNLOCK(mutex);
++
++ return cur_value;
+ }
+
+ APR_DECLARE(void) apr_atomic_set64(volatile apr_uint64_t *mem, apr_uint64_t val)
+--- apr.orig/atomic/unix/builtins.c
++++ apr/atomic/unix/builtins.c
+@@ -18,10 +18,11 @@
+
+ #ifdef USE_ATOMICS_BUILTINS
+
+-#if defined(__arm__) || defined(__powerpc__) || defined(__powerpc64__)
+-#define WEAK_MEMORY_ORDERING 1
+-#else
++#if defined(__i386__) || defined(__x86_64__) \
++ || defined(__s390__) || defined(__s390x__)
+ #define WEAK_MEMORY_ORDERING 0
++#else
++#define WEAK_MEMORY_ORDERING 1
+ #endif
+
+ APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
+--- apr.orig/atomic/unix/builtins64.c
++++ apr/atomic/unix/builtins64.c
+@@ -18,17 +18,18 @@
+
+ #ifdef USE_ATOMICS_BUILTINS64
+
+-#if defined(__arm__) || defined(__powerpc__) || defined(__powerpc64__)
+-#define WEAK_MEMORY_ORDERING 1
+-#else
++#if defined(__i386__) || defined(__x86_64__) \
++ || defined(__s390__) || defined(__s390x__)
+ #define WEAK_MEMORY_ORDERING 0
++#else
++#define WEAK_MEMORY_ORDERING 1
+ #endif
+
+ APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem)
+ {
+ #if HAVE__ATOMIC_BUILTINS64
+ return __atomic_load_n(mem, __ATOMIC_SEQ_CST);
+-#elif WEAK_MEMORY_ORDERING
++#elif WEAK_MEMORY_ORDERING || APR_SIZEOF_VOIDP < 8
+ /* No __sync_load() available => apr_atomic_add64(mem, 0) */
+ return __sync_fetch_and_add(mem, 0);
+ #else
+@@ -40,7 +41,7 @@ APR_DECLARE(void) apr_atomic_set64(volat
+ {
+ #if HAVE__ATOMIC_BUILTINS64
+ __atomic_store_n(mem, val, __ATOMIC_SEQ_CST);
+-#elif WEAK_MEMORY_ORDERING
++#elif WEAK_MEMORY_ORDERING || APR_SIZEOF_VOIDP < 8
+ /* No __sync_store() available => apr_atomic_xchg64(mem, val) */
+ __sync_synchronize();
+ __sync_lock_test_and_set(mem, val);
+--- apr.orig/configure.in
++++ apr/configure.in
+@@ -552,31 +552,35 @@ AC_CACHE_CHECK([whether the compiler pro
+ [AC_TRY_RUN([
+ #if HAVE_STDINT_H
+ #include <stdint.h>
++typedef uint64_t u64_t;
++#else
++typedef unsigned long long u64_t;
+ #endif
+ int main(int argc, const char *const *argv)
+ {
+-#if HAVE_STDINT_H
+- uint64_t val = 1010, tmp, *mem = &val;
+-#else
+- unsigned long long val = 1010, tmp, *mem = &val;
+-#endif
++ struct {
++ char pad0;
++ u64_t val;
++ } s;
++ u64_t *mem = &s.val, tmp;
+
+- if (__sync_fetch_and_add(&val, 1010) != 1010 || val != 2020)
++ s.val = 1010;
++ if (__sync_fetch_and_add(&s.val, 1010) != 1010 || s.val != 2020)
+ return 1;
+
+- tmp = val;
+- if (__sync_fetch_and_sub(mem, 1010) != tmp || val != 1010)
++ tmp = s.val;
++ if (__sync_fetch_and_sub(mem, 1010) != tmp || s.val != 1010)
+ return 1;
+
+- if (__sync_sub_and_fetch(&val, 1010) != 0 || val != 0)
++ if (__sync_sub_and_fetch(&s.val, 1010) != 0 || s.val != 0)
+ return 1;
+
+ tmp = 3030;
+- if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || val != tmp)
++ if (__sync_val_compare_and_swap(mem, 0, tmp) != 0 || s.val != tmp)
+ return 1;
+
+ __sync_synchronize();
+- if (__sync_lock_test_and_set(&val, 4040) != 3030)
++ if (__sync_lock_test_and_set(&s.val, 4040) != 3030)
+ return 1;
+
+ return 0;
+@@ -586,31 +590,45 @@ AC_CACHE_CHECK([whether the compiler pro
+ [AC_TRY_RUN([
+ #if HAVE_STDINT_H
+ #include <stdint.h>
++typedef uint64_t u64_t;
++#else
++typedef unsigned long long u64_t;
+ #endif
++static int test_always_lock_free(volatile u64_t *val)
++{
++ return __atomic_always_lock_free(sizeof(*val), val);
++}
+ int main(int argc, const char *const *argv)
+ {
+-#if HAVE_STDINT_H
+- uint64_t val = 1010, tmp, *mem = &val;
+-#else
+- unsigned long long val = 1010, tmp, *mem = &val;
+-#endif
++ struct {
++ char pad0;
++ u64_t val;
++ char pad1;
++ u64_t tmp;
++ } s;
++ u64_t *mem = &s.val;
++
++ /* check if alignment matters (no fallback to libatomic) */
++ if (!test_always_lock_free(&s.val))
++ return 1;
+
+- if (__atomic_fetch_add(&val, 1010, __ATOMIC_SEQ_CST) != 1010 || val != 2020)
++ s.val = 1010;
++ if (__atomic_fetch_add(&s.val, 1010, __ATOMIC_SEQ_CST) != 1010 || s.val != 2020)
+ return 1;
+
+- tmp = val;
+- if (__atomic_fetch_sub(mem, 1010, __ATOMIC_SEQ_CST) != tmp || val != 1010)
++ s.tmp = s.val;
++ if (__atomic_fetch_sub(mem, 1010, __ATOMIC_SEQ_CST) != s.tmp || s.val != 1010)
+ return 1;
+
+- if (__atomic_sub_fetch(&val, 1010, __ATOMIC_SEQ_CST) != 0 || val != 0)
++ if (__atomic_sub_fetch(&s.val, 1010, __ATOMIC_SEQ_CST) != 0 || s.val != 0)
+ return 1;
+
+- tmp = val;
+- if (!__atomic_compare_exchange_n(mem, &tmp, 3030, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
+- || tmp != 0)
++ s.tmp = s.val;
++ if (!__atomic_compare_exchange_n(mem, &s.tmp, 3030, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)
++ || s.tmp != 0)
+ return 1;
+
+- if (__atomic_exchange_n(&val, 4040, __ATOMIC_SEQ_CST) != 3030)
++ if (__atomic_exchange_n(&s.val, 4040, __ATOMIC_SEQ_CST) != 3030)
+ return 1;
+
+ return 0;
+--- apr.orig/test/testatomic.c
++++ apr/test/testatomic.c
+@@ -662,6 +662,9 @@ static void test_atomics_threaded64(abts
+ pthread_setconcurrency(8);
+ #endif
+
++ mutex_locks64 = 0;
++ apr_atomic_set64(&atomic_ops64, 0);
++
+ rv = apr_thread_mutex_create(&thread_lock64, APR_THREAD_MUTEX_DEFAULT, p);
+ APR_ASSERT_SUCCESS(tc, "Could not create lock", rv);
+
diff --git a/debian/patches/fix-atomics.patch b/debian/patches/fix-atomics.patch
new file mode 100644
index 0000000..2c519e7
--- /dev/null
+++ b/debian/patches/fix-atomics.patch
@@ -0,0 +1,89 @@
+# upstream trunk commits r1907442, r1907441
+--- apr.orig/atomic/unix/builtins.c
++++ apr/atomic/unix/builtins.c
+@@ -26,7 +26,11 @@
+
+ APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p)
+ {
++#if defined (NEED_ATOMICS_GENERIC64)
++ return apr__atomic_generic64_init(p);
++#else
+ return APR_SUCCESS;
++#endif
+ }
+
+ APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem)
+--- apr.orig/atomic/unix/builtins64.c
++++ apr/atomic/unix/builtins64.c
+@@ -26,7 +26,7 @@
+
+ APR_DECLARE(apr_uint64_t) apr_atomic_read64(volatile apr_uint64_t *mem)
+ {
+-#if HAVE__ATOMIC_BUILTINS
++#if HAVE__ATOMIC_BUILTINS64
+ return __atomic_load_n(mem, __ATOMIC_SEQ_CST);
+ #elif WEAK_MEMORY_ORDERING
+ /* No __sync_load() available => apr_atomic_add64(mem, 0) */
+@@ -38,7 +38,7 @@ APR_DECLARE(apr_uint64_t) apr_atomic_rea
+
+ APR_DECLARE(void) apr_atomic_set64(volatile apr_uint64_t *mem, apr_uint64_t val)
+ {
+-#if HAVE__ATOMIC_BUILTINS
++#if HAVE__ATOMIC_BUILTINS64
+ __atomic_store_n(mem, val, __ATOMIC_SEQ_CST);
+ #elif WEAK_MEMORY_ORDERING
+ /* No __sync_store() available => apr_atomic_xchg64(mem, val) */
+@@ -51,7 +51,7 @@ APR_DECLARE(void) apr_atomic_set64(volat
+
+ APR_DECLARE(apr_uint64_t) apr_atomic_add64(volatile apr_uint64_t *mem, apr_uint64_t val)
+ {
+-#if HAVE__ATOMIC_BUILTINS
++#if HAVE__ATOMIC_BUILTINS64
+ return __atomic_fetch_add(mem, val, __ATOMIC_SEQ_CST);
+ #else
+ return __sync_fetch_and_add(mem, val);
+@@ -60,7 +60,7 @@ APR_DECLARE(apr_uint64_t) apr_atomic_add
+
+ APR_DECLARE(void) apr_atomic_sub64(volatile apr_uint64_t *mem, apr_uint64_t val)
+ {
+-#if HAVE__ATOMIC_BUILTINS
++#if HAVE__ATOMIC_BUILTINS64
+ __atomic_fetch_sub(mem, val, __ATOMIC_SEQ_CST);
+ #else
+ __sync_fetch_and_sub(mem, val);
+@@ -69,7 +69,7 @@ APR_DECLARE(void) apr_atomic_sub64(volat
+
+ APR_DECLARE(apr_uint64_t) apr_atomic_inc64(volatile apr_uint64_t *mem)
+ {
+-#if HAVE__ATOMIC_BUILTINS
++#if HAVE__ATOMIC_BUILTINS64
+ return __atomic_fetch_add(mem, 1, __ATOMIC_SEQ_CST);
+ #else
+ return __sync_fetch_and_add(mem, 1);
+@@ -78,7 +78,7 @@ APR_DECLARE(apr_uint64_t) apr_atomic_inc
+
+ APR_DECLARE(int) apr_atomic_dec64(volatile apr_uint64_t *mem)
+ {
+-#if HAVE__ATOMIC_BUILTINS
++#if HAVE__ATOMIC_BUILTINS64
+ return __atomic_sub_fetch(mem, 1, __ATOMIC_SEQ_CST);
+ #else
+ return __sync_sub_and_fetch(mem, 1);
+@@ -88,7 +88,7 @@ APR_DECLARE(int) apr_atomic_dec64(volati
+ APR_DECLARE(apr_uint64_t) apr_atomic_cas64(volatile apr_uint64_t *mem, apr_uint64_t val,
+ apr_uint64_t cmp)
+ {
+-#if HAVE__ATOMIC_BUILTINS
++#if HAVE__ATOMIC_BUILTINS64
+ __atomic_compare_exchange_n(mem, &cmp, val, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+ return cmp;
+ #else
+@@ -98,7 +98,7 @@ APR_DECLARE(apr_uint64_t) apr_atomic_cas
+
+ APR_DECLARE(apr_uint64_t) apr_atomic_xchg64(volatile apr_uint64_t *mem, apr_uint64_t val)
+ {
+-#if HAVE__ATOMIC_BUILTINS
++#if HAVE__ATOMIC_BUILTINS64
+ return __atomic_exchange_n(mem, val, __ATOMIC_SEQ_CST);
+ #else
+ __sync_synchronize();
diff --git a/debian/patches/fix_apr-config.patch b/debian/patches/fix_apr-config.patch
new file mode 100644
index 0000000..9736001
--- /dev/null
+++ b/debian/patches/fix_apr-config.patch
@@ -0,0 +1,20 @@
+From: <tfheen@debian.org>
+Subject: No description.
+
+---
+ apr-config.in | 8 ++------
+ 1 file changed, 2 insertions(+), 6 deletions(-)
+
+Index: apr/apr-config.in
+===================================================================
+--- apr.orig/apr-config.in
++++ apr/apr-config.in
+@@ -39,7 +39,7 @@
+ LIBS="@EXTRA_LIBS@"
+ EXTRA_INCLUDES="@EXTRA_INCLUDES@"
+ SHLIBPATH_VAR="@shlibpath_var@"
+-APR_SOURCE_DIR="@apr_srcdir@"
++APR_SOURCE_DIR="$(cd @installbuilddir@/.. ; pwd)"
+ APR_BUILD_DIR="@apr_builddir@"
+ APR_SO_EXT="@so_ext@"
+ APR_LIB_TARGET="@export_lib_target@"
diff --git a/debian/patches/fix_doxygen.patch b/debian/patches/fix_doxygen.patch
new file mode 100644
index 0000000..cba7489
--- /dev/null
+++ b/debian/patches/fix_doxygen.patch
@@ -0,0 +1,69 @@
+From: Stefan Fritsch <sf@debian.org>
+Subject: Fix generation of docs for out-of-tree builds and newer doxygen versions
+
+---
+ docs/doxygen.conf | 2 +-
+ include/apr.h.in | 24 ++++++++++++------------
+ 2 files changed, 13 insertions(+), 13 deletions(-)
+
+--- apr.orig/docs/doxygen.conf
++++ apr/docs/doxygen.conf
+@@ -1,6 +1,6 @@
+ PROJECT_NAME="Apache Portable Runtime"
+
+-INPUT=.
++INPUT=../../include include
+ QUIET=YES
+ RECURSIVE=YES
+ FILE_PATTERNS=*.h
+--- apr.orig/include/apr.h.in
++++ apr/include/apr.h.in
+@@ -464,11 +464,11 @@ typedef apr_uint32_t apr_uin
+ /**
+ * Thread callbacks from APR functions must be declared with APR_THREAD_FUNC,
+ * so that they follow the platform's calling convention.
+- * <PRE>
+- *
++ */
++/**
++ * @code
+ * void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data);
+- *
+- * </PRE>
++ * @endcode
+ */
+ #define APR_THREAD_FUNC @apr_thread_func@
+
+@@ -502,11 +502,11 @@ typedef apr_uint32_t apr_uin
+ * APR_DECLARE_NONSTD(), as they must follow the C language calling convention.
+ * @see APR_DECLARE @see APR_DECLARE_DATA
+ * @remark Both the declaration and implementations must use the same macro.
+- * <PRE>
+- *
++ */
++/**
++ * @code
+ * APR_DECLARE_NONSTD(rettype) apr_func(args, ...);
+- *
+- * </PRE>
++ * @endcode
+ */
+ #define APR_DECLARE_NONSTD(type) type
+
+@@ -517,12 +517,12 @@ typedef apr_uint32_t apr_uin
+ * @remark Note that the declaration and implementations use different forms,
+ * but both must include the macro.
+ *
+- * <PRE>
+- *
++ */
++/**
++ * @code
+ * extern APR_DECLARE_DATA type apr_variable;\n
+ * APR_DECLARE_DATA type apr_variable = value;
+- *
+- * </PRE>
++ * @endcode
+ */
+ #define APR_DECLARE_DATA
+
diff --git a/debian/patches/hurd_path_max.patch b/debian/patches/hurd_path_max.patch
new file mode 100644
index 0000000..b333eb6
--- /dev/null
+++ b/debian/patches/hurd_path_max.patch
@@ -0,0 +1,19 @@
+From: Stefan Fritsch <sf@debian.org>
+Subject: #349418
+
+---
+ include/apr.h.in | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- apr.orig/include/apr.h.in
++++ apr/include/apr.h.in
+@@ -629,7 +629,8 @@ typedef int apr_wait_t;
+ #elif defined(_POSIX_PATH_MAX)
+ #define APR_PATH_MAX _POSIX_PATH_MAX
+ #else
+-#error no decision has been made on APR_PATH_MAX for your platform
++#warning no decision has been made on APR_PATH_MAX for your platform
++#define APR_PATH_MAX 4096
+ #endif
+
+ #define APR_DSOPATH "@shlibpath_var@"
diff --git a/debian/patches/hurd_shm_flock.patch b/debian/patches/hurd_shm_flock.patch
new file mode 100644
index 0000000..5f1919f
--- /dev/null
+++ b/debian/patches/hurd_shm_flock.patch
@@ -0,0 +1,53 @@
+From: Pino Toscano <pino@debian.org>
+Bug: #656880
+
+# * hurd_shm_flock.diff
+# This patch disables all the methods for shared memory and file locking
+# found by the configure checks, forcing the only working ones.
+# This patch should stay Debian-specific, as it is not that suitable for
+# upstream inclusion. (As you can guess, ideally all of those
+# non-working methods should be ideally fixed in Hurd...)
+
+--- apr.orig/configure.in
++++ apr/configure.in
+@@ -1375,6 +1375,13 @@ case $host in
+ APR_DECISION_OVERRIDE(USE_SHMEM_SHMGET_ANON)
+ ;;
+ esac
++case $host_os in
++ gnu* )
++ haveshmgetanon="0"
++ havemmapanon="0"
++ APR_DECISION_OVERRIDE(USE_SHMEM_MMAP_ZERO)
++ ;;
++esac
+ APR_END_DECISION
+ AC_DEFINE_UNQUOTED($ac_decision)
+
+@@ -1452,6 +1459,13 @@ case $host in
+ APR_DECISION_OVERRIDE(USE_SHMEM_SHMGET)
+ ;;
+ esac
++case $host_os in
++ gnu* )
++ havemmapshm="0"
++ haveshmget="0"
++ APR_DECISION_OVERRIDE(USE_SHMEM_MMAP_TMP)
++ ;;
++esac
+ APR_END_DECISION
+ AC_DEFINE_UNQUOTED($ac_decision)
+
+@@ -2511,6 +2525,12 @@ esac
+ if test "x$apr_lock_method" != "x"; then
+ APR_DECISION_FORCE($apr_lock_method)
+ fi
++case $host_os in
++ gnu* )
++ hasfcntlser="0"
++ APR_DECISION_OVERRIDE(USE_FLOCK_SERIALIZE)
++ ;;
++esac
+ APR_END_DECISION
+ AC_DEFINE_UNQUOTED($ac_decision)
+
diff --git a/debian/patches/libtoolize_check.patch b/debian/patches/libtoolize_check.patch
new file mode 100644
index 0000000..d1dd558
--- /dev/null
+++ b/debian/patches/libtoolize_check.patch
@@ -0,0 +1,27 @@
+From: Helmut Grohne <helmut@subdivi.de>
+Subject: check for libtoolize rather than libtool
+Last-Update: 2014-09-19
+
+libtool is now in package libtool-bin, but apr only needs libtoolize.
+
+--- apr.orig/build/buildcheck.sh
++++ apr/build/buildcheck.sh
+@@ -39,13 +39,13 @@ fi
+ # ltmain.sh (GNU libtool 1.1361 2004/01/02 23:10:52) 1.5a
+ # output is multiline from 1.5 onwards
+
+-# Require libtool 1.4 or newer
+-if test -z "$libtool"; then
+- libtool=`build/PrintPath glibtool1 glibtool libtool libtool15 libtool14`
++# Require libtoolize 1.4 or newer
++if test -z "$libtoolize"; then
++ libtoolize=`build/PrintPath glibtoolize1 glibtoolize libtoolize libtoolize15 libtoolize14`
+ fi
+-lt_pversion=`$libtool --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
++lt_pversion=`$libtoolize --version 2>/dev/null|sed -e 's/([^)]*)//g;s/^[^0-9]*//;s/[- ].*//g;q'`
+ if test -z "$lt_pversion"; then
+- echo "buildconf: libtool not found."
++ echo "buildconf: libtoolize not found."
+ echo " You need libtool version 1.4 or newer installed"
+ echo " to build APR from SVN."
+ res=1
diff --git a/debian/patches/omit_extra_libs.patch b/debian/patches/omit_extra_libs.patch
new file mode 100644
index 0000000..c8baa12
--- /dev/null
+++ b/debian/patches/omit_extra_libs.patch
@@ -0,0 +1,18 @@
+From: Stefan Fritsch <sf@debian.org>
+Subject: #463399
+
+---
+ apr-config.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- apr.orig/apr-config.in
++++ apr/apr-config.in
+@@ -36,7 +36,7 @@ SHELL="@SHELL@"
+ CPPFLAGS="@EXTRA_CPPFLAGS@"
+ CFLAGS="@EXTRA_CFLAGS@"
+ LDFLAGS="@EXTRA_LDFLAGS@"
+-LIBS="@EXTRA_LIBS@"
++LIBS=""
+ EXTRA_INCLUDES="@EXTRA_INCLUDES@"
+ SHLIBPATH_VAR="@shlibpath_var@"
+ APR_SOURCE_DIR="$(cd @installbuilddir@/.. ; pwd)"
diff --git a/debian/patches/python3-hashbang.patch b/debian/patches/python3-hashbang.patch
new file mode 100644
index 0000000..2456e62
--- /dev/null
+++ b/debian/patches/python3-hashbang.patch
@@ -0,0 +1,8 @@
+--- apr.orig/build/gen-build.py
++++ apr/build/gen-build.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/python3
+ #
+ # USAGE: gen-build.py TYPE
+ #
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..a8badec
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,14 @@
+fix_apr-config.patch
+ship_find_apr.m4.patch
+fix-apr.pc.patch
+hurd_path_max.patch
+fix_doxygen.patch
+omit_extra_libs.patch
+hurd_shm_flock.patch
+dont_override_external_buildflags
+libtoolize_check.patch
+debug_testpoll_failure.patch
+use_fcntl_locking.patch
+python3-hashbang.patch
+fix-atomics.patch
+fix-atomics-some-more.patch
diff --git a/debian/patches/ship_find_apr.m4.patch b/debian/patches/ship_find_apr.m4.patch
new file mode 100644
index 0000000..6d5067f
--- /dev/null
+++ b/debian/patches/ship_find_apr.m4.patch
@@ -0,0 +1,25 @@
+From: Tollef Fog Heen <tfheen@err.no>
+Subject: Install a set of random build files too
+
+---
+ Makefile.in | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+--- apr.orig/Makefile.in
++++ apr/Makefile.in
+@@ -94,6 +94,15 @@ install: $(TARGETS)
+ done
+ $(INSTALL_DATA) build/apr_rules.out $(DESTDIR)$(installbuilddir)/apr_rules.mk
+ $(INSTALL) -m 755 apr-config.out $(DESTDIR)$(bindir)/$(APR_CONFIG)
++
++ if [ ! -d $(DESTDIR)$(installbuilddir) ]; then \
++ $(top_srcdir)/build/mkdir.sh $(DESTDIR)$(installbuilddir); \
++ fi
++ for file in install.sh gen-build.py get-version.sh ; do \
++ $(LIBTOOL) --mode=install cp $(top_srcdir)/build/$$file \
++ $(DESTDIR)$(installbuilddir)/$$file ; \
++ done
++
+ @if [ $(INSTALL_SUBDIRS) != "none" ]; then \
+ for i in $(INSTALL_SUBDIRS); do \
+ ( cd $$i ; $(MAKE) DESTDIR=$(DESTDIR) install ); \
diff --git a/debian/patches/use_fcntl_locking.patch b/debian/patches/use_fcntl_locking.patch
new file mode 100644
index 0000000..cedb611
--- /dev/null
+++ b/debian/patches/use_fcntl_locking.patch
@@ -0,0 +1,22 @@
+# use flock for apr_file_lock/_unlock()
+# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=752872
+--- apr.orig/file_io/unix/flock.c
++++ apr/file_io/unix/flock.c
+@@ -27,7 +27,7 @@ APR_DECLARE(apr_status_t) apr_file_lock(
+ {
+ int rc;
+
+-#if defined(HAVE_FCNTL_H)
++#if 0 && defined(HAVE_FCNTL_H)
+ {
+ struct flock l = { 0 };
+ int fc;
+@@ -86,7 +86,7 @@ APR_DECLARE(apr_status_t) apr_file_unloc
+ {
+ int rc;
+
+-#if defined(HAVE_FCNTL_H)
++#if 0 && defined(HAVE_FCNTL_H)
+ {
+ struct flock l = { 0 };
+