diff -Nru apache2-2.2.22/debian/changelog apache2-2.2.22/debian/changelog --- apache2-2.2.22/debian/changelog 2012-11-08 22:56:35.000000000 +0000 +++ apache2-2.2.22/debian/changelog 2012-12-05 11:34:57.000000000 +0000 @@ -1,3 +1,12 @@ +apache2 (2.2.22-6ubuntu4) raring; urgency=low + + * Fix cross-building by passing DEB_{HOST,BUILD}_GNU_TYPE to configure. + * Skip module sanity check between MPMs if cross-building without the + kernel/binfmt support to run our target binaries on the build system. + * Backport several cross fixes from upstream as 086_svn_cross_compiles. + + -- Adam Conrad Wed, 05 Dec 2012 02:21:46 -0700 + apache2 (2.2.22-6ubuntu3) raring; urgency=low * SECURITY UPDATE: XSS vulnerability in mod_negotiation diff -Nru apache2-2.2.22/debian/patches/086_svn_cross_compiles apache2-2.2.22/debian/patches/086_svn_cross_compiles --- apache2-2.2.22/debian/patches/086_svn_cross_compiles 1970-01-01 00:00:00.000000000 +0000 +++ apache2-2.2.22/debian/patches/086_svn_cross_compiles 2012-12-05 12:02:16.000000000 +0000 @@ -0,0 +1,118 @@ +Description: Pull upstream fixes for autotools for cross-compiling +Author: Adam Conrad +Origin: upstream, http://svn.eu.apache.org/viewvc?view=revision&revision=1328445 +Origin: upstream, http://svn.eu.apache.org/viewvc?view=revision&revision=1327907 +Origin: upstream, http://svn.eu.apache.org/viewvc?view=revision&revision=1328390 +Origin: upstream, http://svn.eu.apache.org/viewvc?view=revision&revision=1328714 +Forwarded: not-needed + +Index: apache2-2.2.22/acinclude.m4 +=================================================================== +--- apache2-2.2.22.orig/acinclude.m4 2012-12-05 03:55:02.000000000 -0700 ++++ apache2-2.2.22/acinclude.m4 2012-12-05 03:55:02.000000000 -0700 +@@ -53,6 +53,8 @@ + APACHE_SUBST(CPPFLAGS) + APACHE_SUBST(CFLAGS) + APACHE_SUBST(CXXFLAGS) ++ APACHE_SUBST(CC_FOR_BUILD) ++ APACHE_SUBST(CFLAGS_FOR_BUILD) + APACHE_SUBST(LTFLAGS) + APACHE_SUBST(LDFLAGS) + APACHE_SUBST(LT_LDFLAGS) +@@ -573,7 +575,7 @@ + { + return sizeof(void *) < sizeof(long); + }], [ap_cv_void_ptr_lt_long=no], [ap_cv_void_ptr_lt_long=yes], +- [ap_cv_void_ptr_lt_long=yes])]) ++ [ap_cv_void_ptr_lt_long="cross compile - not checked"])]) + + if test "$ap_cv_void_ptr_lt_long" = "yes"; then + AC_MSG_ERROR([Size of "void *" is less than size of "long"]) +Index: apache2-2.2.22/configure +=================================================================== +--- apache2-2.2.22.orig/configure 2012-12-05 03:55:02.000000000 -0700 ++++ apache2-2.2.22/configure 2012-12-05 03:55:35.398580896 -0700 +@@ -629,6 +629,8 @@ + SH_LDFLAGS + LT_LDFLAGS + LTFLAGS ++CFLAGS_FOR_BUILD ++CC_FOR_BUILD + CXXFLAGS + CXX + other_targets +@@ -5296,6 +5298,12 @@ + ac_compiler_gnu=$ac_cv_c_compiler_gnu + + ++if test "x${build_alias}" != "x${host_alias}"; then ++ if test "x${CC_FOR_BUILD}" = "x"; then ++ CC_FOR_BUILD=cc ++ fi ++fi ++ + if test "x${cache_file}" = "x/dev/null"; then + # Likewise, ensure that CC and CPP are passed through to the pcre + # configure script iff caching is disabled (the autoconf 2.5x default). +@@ -7142,7 +7150,7 @@ + $as_echo_n "(cached) " >&6 + else + if test "$cross_compiling" = yes; then : +- ap_cv_void_ptr_lt_long=yes ++ ap_cv_void_ptr_lt_long="cross compile - not checked" + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ +@@ -18909,6 +18917,14 @@ + + + ++ APACHE_VAR_SUBST="$APACHE_VAR_SUBST CC_FOR_BUILD" ++ ++ ++ ++ APACHE_VAR_SUBST="$APACHE_VAR_SUBST CFLAGS_FOR_BUILD" ++ ++ ++ + APACHE_VAR_SUBST="$APACHE_VAR_SUBST LTFLAGS" + + +Index: apache2-2.2.22/server/Makefile.in +=================================================================== +--- apache2-2.2.22.orig/server/Makefile.in 2011-04-14 10:37:58.000000000 -0600 ++++ apache2-2.2.22/server/Makefile.in 2012-12-05 03:55:02.000000000 -0700 +@@ -21,9 +21,14 @@ + include $(top_builddir)/build/rules.mk + include $(top_srcdir)/build/library.mk + ++ifdef CC_FOR_BUILD ++gen_test_char: gen_test_char.c ++ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) -DCROSS_COMPILE -o $@ $< ++else + gen_test_char_OBJECTS = gen_test_char.lo + gen_test_char: $(gen_test_char_OBJECTS) + $(LINK) $(EXTRA_LDFLAGS) $(gen_test_char_OBJECTS) $(EXTRA_LIBS) ++endif + + test_char.h: gen_test_char + ./gen_test_char > test_char.h +Index: apache2-2.2.22/configure.in +=================================================================== +--- apache2-2.2.22.orig/configure.in 2012-12-05 03:55:02.000000000 -0700 ++++ apache2-2.2.22/configure.in 2012-12-05 03:55:02.000000000 -0700 +@@ -154,6 +154,14 @@ + AC_PROG_CC + AC_PROG_CPP + ++dnl In case of cross compilation we set CC_FOR_BUILD to cc unless ++dnl we got already CC_FOR_BUILD from environment. ++if test "x${build_alias}" != "x${host_alias}"; then ++ if test "x${CC_FOR_BUILD}" = "x"; then ++ CC_FOR_BUILD=cc ++ fi ++fi ++ + if test "x${cache_file}" = "x/dev/null"; then + # Likewise, ensure that CC and CPP are passed through to the pcre + # configure script iff caching is disabled (the autoconf 2.5x default). diff -Nru apache2-2.2.22/debian/patches/series apache2-2.2.22/debian/patches/series --- apache2-2.2.22/debian/patches/series 2012-11-06 19:10:30.000000000 +0000 +++ apache2-2.2.22/debian/patches/series 2012-12-05 11:35:56.000000000 +0000 @@ -30,3 +30,4 @@ #202_suexec-custom CVE-2012-2687.patch CVE-2012-4929.patch +086_svn_cross_compiles diff -Nru apache2-2.2.22/debian/rules apache2-2.2.22/debian/rules --- apache2-2.2.22/debian/rules 2012-07-16 07:59:04.000000000 +0000 +++ apache2-2.2.22/debian/rules 2012-12-05 12:40:35.000000000 +0000 @@ -36,10 +36,13 @@ INSTALL_DIR=debian/$(INSTALL_DIR_RELATIVE) LSB_RELEASE := $(shell lsb_release -i -s) DEFAULT_MPM=$(INSTALL_DIR)/worker +DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) MPMS=worker prefork event itk -AP2_COMMON_CONFARGS = --enable-layout=Debian --enable-so \ +AP2_COMMON_CONFARGS = --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \ + --enable-layout=Debian --enable-so \ --with-program-name=apache2 \ --with-ldap=yes --with-ldap-include=/usr/include \ --with-ldap-lib=/usr/lib \ @@ -144,7 +147,14 @@ $(AP2_COMMON_CONFARGS) --with-mpm=$* $(AP2_$(*)_CONFARGS) $(CONFFLAGS) \ CFLAGS="$(AP2_CFLAGS)" CPPFLAGS="$(AP2_CPPFLAGS)" LDFLAGS="$(AP2_LDFLAGS)" dh_auto_build -D "$(BUILD_DIR)/$*" - cd "$(BUILD_DIR)/$*" && ./apache2 -l |grep -v $* > mods.list + if [ "$(DEB_HOST_GNU_TYPE)" != "$(DEB_BUILD_GNU_TYPE)" ]; then \ + if ! (cd "$(BUILD_DIR)/worker" && ./apache2 -l >/dev/null 2>&1); then \ + touch $(BUILD_DIR)/cross-build-without-emulation; \ + fi; \ + fi + if [ ! -f "$(BUILD_DIR)/cross-build-without-emulation" ]; then \ + cd "$(BUILD_DIR)/$*" && ./apache2 -l | grep -v $* > mods.list; \ + fi # force one process since mkdir.sh used by 'make install' is not # reliable otherwise dh_auto_install -D "$(BUILD_DIR)/$*" --destdir="$(INSTALL_DIR)/$*" -- -j1 @@ -201,12 +211,16 @@ override_dh_install-arch: $(MAKE) $(BUILDMAKEFLAGS) -f $(CURDIR)/debian/rules $(patsubst %, mpm-build-%, $(MPMS)) install-dev - for mpm in $(filter-out worker, $(MPMS)) ; do \ - if ! diff -u $(BUILD_DIR)/$$mpm/mods.list $(BUILD_DIR)/worker/mods.list ; then \ - echo Different modules built into httpd binaries, will not proceed ;\ - exit 1 ;\ - fi \ - done + if [ -f "$(BUILD_DIR)/cross-build-without-emulation" ]; then \ + echo "WARNING: Cross-build without emulation: skipping module sanity check."; \ + else \ + for mpm in $(filter-out worker, $(MPMS)) ; do \ + if ! diff -u $(BUILD_DIR)/$$mpm/mods.list $(BUILD_DIR)/worker/mods.list ; then \ + echo Different modules built into httpd binaries, will not proceed ; \ + exit 1 ; \ + fi; \ + done; \ + fi cd debian && ln -s $(INSTALL_DIR_RELATIVE)/worker tmp #cleanup of death rm -rf $(DEFAULT_MPM)/etc/apache2/original