From 14f4f0bef0448d950cf1371de3a05f302a2779c8 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Wed, 1 Jan 2020 23:19:02 +0100 Subject: [PATCH 1/7] apache: bump to 2.4.41 - version bump - update license description - add PKG_BUILD_PARALLEL:=1 - remove two cross-compile patches and replace them with the cross-compile patch from buildroot (adds autoreconf to get this going) Signed-off-by: Sebastian Kemper --- net/apache/Makefile | 14 ++++-- net/apache/patches/001-Makefile_in.patch | 14 ------ net/apache/patches/001-cross-compile.patch | 57 ++++++++++++++++++++++ net/apache/patches/002-test_char_h.patch | 49 ------------------- 4 files changed, 67 insertions(+), 67 deletions(-) delete mode 100644 net/apache/patches/001-Makefile_in.patch create mode 100644 net/apache/patches/001-cross-compile.patch delete mode 100644 net/apache/patches/002-test_char_h.patch diff --git a/net/apache/Makefile b/net/apache/Makefile index 1dd22bdb8..234ffca29 100644 --- a/net/apache/Makefile +++ b/net/apache/Makefile @@ -8,25 +8,31 @@ include $(TOPDIR)/rules.mk PKG_NAME:=apache -PKG_VERSION:=2.4.37 -PKG_RELEASE:=2 +PKG_VERSION:=2.4.41 +PKG_RELEASE:=1 PKG_SOURCE_NAME:=httpd PKG_SOURCE:=$(PKG_SOURCE_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@APACHE/httpd/ -PKG_HASH:=3498dc5c6772fac2eb7307dc7963122ffe243b5e806e0be4fb51974ff759d726 +PKG_HASH:=133d48298fe5315ae9366a0ec66282fa4040efa5d566174481077ade7d18ea40 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_NAME)-$(PKG_VERSION) PKG_MAINTAINER:=Thomas Heil -PKG_LICENSE:=Apache License +PKG_LICENSE:=Apache-2.0 +PKG_LICENSE_FILES:=LICENSE + PKG_CPE_ID:=cpe:/a:apache:http_server +PKG_BUILD_PARALLEL:=1 + PKG_INSTALL:=1 PKG_CONFIG_DEPENDS:= \ CONFIG_APACHE_HTTP2 +PKG_FIXUP:=autoreconf + ADDITIONAL_MODULES:= ifeq ($(CONFIG_APACHE_HTTP2),y) ADDITIONAL_MODULES += --enable-http2 diff --git a/net/apache/patches/001-Makefile_in.patch b/net/apache/patches/001-Makefile_in.patch deleted file mode 100644 index 4daf14f44..000000000 --- a/net/apache/patches/001-Makefile_in.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- a/server/Makefile.in -+++ b/server/Makefile.in -@@ -29,7 +29,10 @@ gen_test_char: $(gen_test_char_OBJECTS) - $(LINK) $(EXTRA_LDFLAGS) $(gen_test_char_OBJECTS) $(EXTRA_LIBS) - - test_char.h: gen_test_char -- ./gen_test_char > test_char.h -+ true -+# ./gen_test_char > test_char.h -+# doesn't matter if you run it on the buildhost or on an wl500gd, -+# same output on both, so i just patched in the test_char.h :). - - util.lo: test_char.h - diff --git a/net/apache/patches/001-cross-compile.patch b/net/apache/patches/001-cross-compile.patch new file mode 100644 index 000000000..71b743db5 --- /dev/null +++ b/net/apache/patches/001-cross-compile.patch @@ -0,0 +1,57 @@ +Fix cross-compilation + +Fetched httpd-2.4.x-cross_compile.diff from upstream bugtracker: +https://issues.apache.org/bugzilla/show_bug.cgi?id=51257#c6 + +which is a bundle of upstream revisions: + http://svn.apache.org/viewvc?view=revision&revision=1327907 + http://svn.apache.org/viewvc?view=revision&revision=1328390 + http://svn.apache.org/viewvc?view=revision&revision=1328714 + +Signed-off-by: Bernd Kuhls + +--- a/server/Makefile.in ++++ b/server/Makefile.in +@@ -24,9 +24,14 @@ TARGETS = delete-exports $(LTLIBRARY_NAM + 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 +--- a/configure.in ++++ b/configure.in +@@ -206,6 +206,14 @@ AC_PROG_CPP + dnl Try to get c99 support for variadic macros + ifdef([AC_PROG_CC_C99], [AC_PROG_CC_C99]) + ++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). +--- a/acinclude.m4 ++++ b/acinclude.m4 +@@ -55,6 +55,8 @@ AC_DEFUN([APACHE_GEN_CONFIG_VARS],[ + 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) diff --git a/net/apache/patches/002-test_char_h.patch b/net/apache/patches/002-test_char_h.patch deleted file mode 100644 index ad07704bb..000000000 --- a/net/apache/patches/002-test_char_h.patch +++ /dev/null @@ -1,49 +0,0 @@ -Index: httpd-2.4.25/server/test_char.h -=================================================================== ---- /dev/null -+++ httpd-2.4.25/server/test_char.h -@@ -0,0 +1,23 @@ -+/* this file is automatically generated by gen_test_char, do not edit */ -+#define T_ESCAPE_SHELL_CMD (1) -+#define T_ESCAPE_PATH_SEGMENT (2) -+#define T_OS_ESCAPE_PATH (4) -+#define T_HTTP_TOKEN_STOP (8) -+#define T_ESCAPE_LOGITEM (16) -+#define T_ESCAPE_FORENSIC (32) -+ -+static const unsigned char test_char_table[256] = { -+ 32,62,62,62,62,62,62,62,62,62,63,62,62,62,62,62,62,62,62,62, -+ 62,62,62,62,62,62,62,62,62,62,62,62,14,0,23,6,1,38,1,1, -+ 9,9,1,0,8,0,0,10,0,0,0,0,0,0,0,0,0,0,40,15, -+ 15,8,15,15,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -+ 0,0,0,0,0,0,0,0,0,0,0,15,31,15,7,0,7,0,0,0, -+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -+ 0,0,0,15,39,15,1,62,54,54,54,54,54,54,54,54,54,54,54,54, -+ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, -+ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, -+ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, -+ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, -+ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54, -+ 54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54 -+}; -Index: httpd-2.4.25/server/util.c -=================================================================== ---- httpd-2.4.25.orig/server/util.c -+++ httpd-2.4.25/server/util.c -@@ -96,6 +96,16 @@ - #undef APLOG_MODULE_INDEX - #define APLOG_MODULE_INDEX AP_CORE_MODULE_INDEX - -+#define T_ESCAPE_SHELL_CMD (0x01) -+#define T_ESCAPE_PATH_SEGMENT (0x02) -+#define T_OS_ESCAPE_PATH (0x04) -+#define T_HTTP_TOKEN_STOP (0x08) -+#define T_ESCAPE_LOGITEM (0x10) -+#define T_ESCAPE_FORENSIC (0x20) -+#define T_ESCAPE_URLENCODED (0x40) -+#define T_HTTP_CTRLS (0x80) -+#define T_VCHAR_OBSTEXT (0x100) -+ - /* - * Examine a field value (such as a media-/content-type) string and return - * it sans any parameters; e.g., strip off any ';charset=foo' and the like. From 4e6bdd8a496bcf202f59e66bff1042512b49a972 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Wed, 1 Jan 2020 23:26:02 +0100 Subject: [PATCH 2/7] apache: break-out CONFIGURE_ARGS, add layout This gets rid of flags. For instance $(FPIC) shouldn't be forced onto applications (see [1]). And CONFIGURE_ARGS + CONFIGURE_VARS are broken out of Build/Configure. This way more arguments can be added easily in the future. The target is changed from apache to apache2 (which is used by upstream by default). the CONFIGURE_ARGS are changed where need to enable modules. This also renames one patch that fixes scoreboard location (the name 004-pidfile_fix.patch didn't describe what it's doing). Now with the OpenWrt layout in place 003-logdir_fix.patch can be removed. [1] https://wiki.gentoo.org/wiki/Project:Hardened/Position_Independent_Code_internals Signed-off-by: Sebastian Kemper --- net/apache/Makefile | 91 ++++++++++--------- net/apache/files/openwrt.layout | 24 +++++ net/apache/patches/003-logdir_fix.patch | 37 -------- .../patches/004-fix-scoreboard-location.patch | 11 +++ net/apache/patches/004-pidfile_fix.patch | 13 --- 5 files changed, 83 insertions(+), 93 deletions(-) create mode 100644 net/apache/files/openwrt.layout delete mode 100644 net/apache/patches/003-logdir_fix.patch create mode 100644 net/apache/patches/004-fix-scoreboard-location.patch delete mode 100644 net/apache/patches/004-pidfile_fix.patch diff --git a/net/apache/Makefile b/net/apache/Makefile index 234ffca29..0d7d35cac 100644 --- a/net/apache/Makefile +++ b/net/apache/Makefile @@ -83,20 +83,20 @@ $(call Package/apache/Default/description) endef define Package/apache/conffiles -/etc/apache/httpd.conf -/etc/apache/extra/httpd-autoindex.conf -/etc/apache/extra/httpd-dav.conf -/etc/apache/extra/httpd-default.conf -/etc/apache/extra/httpd-info.conf -/etc/apache/extra/httpd-languages.conf -/etc/apache/extra/httpd-manual.conf -/etc/apache/extra/httpd-mpm.conf -/etc/apache/extra/httpd-multilang-errordoc.conf -/etc/apache/extra/httpd-ssl.conf -/etc/apache/extra/httpd-userdir.conf -/etc/apache/extra/httpd-vhosts.conf -/etc/apache/magic -/etc/apache/mime.types +/etc/apache2/httpd.conf +/etc/apache2/extra/httpd-autoindex.conf +/etc/apache2/extra/httpd-dav.conf +/etc/apache2/extra/httpd-default.conf +/etc/apache2/extra/httpd-info.conf +/etc/apache2/extra/httpd-languages.conf +/etc/apache2/extra/httpd-manual.conf +/etc/apache2/extra/httpd-mpm.conf +/etc/apache2/extra/httpd-multilang-errordoc.conf +/etc/apache2/extra/httpd-ssl.conf +/etc/apache2/extra/httpd-userdir.conf +/etc/apache2/extra/httpd-vhosts.conf +/etc/apache2/magic +/etc/apache2/mime.types endef define Package/apache-icons @@ -111,35 +111,40 @@ $(call Package/apache/Default/description) This package contains the icons from Apache. endef -TARGET_CFLAGS += $(FPIC) -Wno-error -TARGET_CPPFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -TARGET_LDFLAGS += -lpthread - -define Build/Configure - $(call Build/Configure/Default, \ - --with-apr="$(STAGING_DIR)/usr/bin/apr-1-config" \ - --with-apr-util="$(STAGING_DIR)/usr/bin/apu-1-config" \ - --with-pcre="$(STAGING_DIR)/usr/bin/pcre-config" \ - $(ADDITIONAL_MODULES) \ - --enable-http \ - --with-crypto \ - --with-sqlit3="$(STAGING_DIR)/usr" \ - --with-openssl="$(STAGING_DIR)/usr" \ - --enable-ssl \ - --enable-proxy \ - --disable-md \ - --disable-disk-cache \ - --enable-maintainer-mode \ - --with-mpm=prefork \ - --with-mpm=worker \ - --enable-mime-magic \ - --without-suexec-bin \ - --sysconfdir=/etc/apache \ - ap_cv_void_ptr_lt_long=no \ - logfiledir="/var/log" \ - runtimedir="/var/run" \ - EXTRA_LIBS="-ldl -lpthread -lcrypto -lrt -lssl" \ - ) +CONFIGURE_ARGS+= \ + --datadir=/usr/share/apache2 \ + --disable-authnz-ldap \ + --disable-imagemap \ + --disable-ldap \ + --disable-luajit \ + --enable-authn-alias \ + --enable-authn-anon \ + --enable-cache \ + --enable-cgi \ + --enable-cgid \ + --enable-dbd \ + --enable-disk-cache \ + --enable-exception-hook \ + --enable-file-cache \ + --enable-layout=OpenWrt \ + --enable-mem-cache \ + --enable-mods-shared=all \ + --enable-mpms-shared=all \ + --enable-so \ + --libexecdir=/usr/lib/apache2 \ + --sysconfdir=/etc/apache2 \ + --with-apr-util="$(STAGING_DIR)/usr/bin/apu-1-config" \ + --with-apr="$(STAGING_DIR)/usr/bin/apr-1-config" \ + --with-mpm=prefork \ + --with-pcre="$(STAGING_DIR)/usr/bin/pcre-config" \ + --with-ssl + +CONFIGURE_VARS += \ + ap_cv_void_ptr_lt_long=no + +define Build/Prepare + $(call Build/Prepare/Default) + $(INSTALL_DATA) ./files/openwrt.layout $(PKG_BUILD_DIR)/config.layout endef define Build/InstallDev diff --git a/net/apache/files/openwrt.layout b/net/apache/files/openwrt.layout new file mode 100644 index 000000000..844c4f627 --- /dev/null +++ b/net/apache/files/openwrt.layout @@ -0,0 +1,24 @@ + + + prefix: /usr + exec_prefix: ${prefix} + bindir: ${prefix}/bin + sbindir: ${prefix}/sbin + libdir: ${prefix}/lib + libexecdir: ${prefix}/lib+ + mandir: ${prefix}/share/man + sysconfdir: /etc+ + datadir: ${prefix}/share+ + installbuilddir: ${datadir}/build + errordir: ${datadir}/error + iconsdir: ${datadir}/icons + htdocsdir: ${datadir}/htdocs + manualdir: /usr/share/doc/apache2/manual + cgidir: ${datadir}/cgi-bin + includedir: ${prefix}/include+ + localstatedir: /var + runtimedir: ${localstatedir}/run+ + logfiledir: ${localstatedir}/log+ + proxycachedir: ${localstatedir}/cache/apache2 + + diff --git a/net/apache/patches/003-logdir_fix.patch b/net/apache/patches/003-logdir_fix.patch deleted file mode 100644 index 19fcbf7d6..000000000 --- a/net/apache/patches/003-logdir_fix.patch +++ /dev/null @@ -1,37 +0,0 @@ -Index: httpd-2.4.25/build/mkconfNW.awk -=================================================================== ---- httpd-2.4.25.orig/build/mkconfNW.awk -+++ httpd-2.4.25/build/mkconfNW.awk -@@ -23,7 +23,7 @@ BEGIN { - A["sysconfdir"] = "conf" - A["iconsdir"] = "icons" - A["manualdir"] = "manual" -- A["runtimedir"] = "logs" -+ A["runtimedir"] = "log" - A["errordir"] = "error" - A["proxycachedir"] = "proxy" - -Index: httpd-2.4.25/config.layout -=================================================================== ---- httpd-2.4.25.orig/config.layout -+++ httpd-2.4.25/config.layout -@@ -28,8 +28,8 @@ - cgidir: ${datadir}/cgi-bin - includedir: ${prefix}/include - localstatedir: ${prefix} -- runtimedir: ${localstatedir}/logs -- logfiledir: ${localstatedir}/logs -+ runtimedir: ${localstatedir}/log -+ logfiledir: ${localstatedir}/log - proxycachedir: ${localstatedir}/proxy - - -@@ -174,7 +174,7 @@ - includedir: ${prefix}/include - localstatedir: /var${prefix} - runtimedir: ${localstatedir}/run -- logfiledir: ${localstatedir}/logs -+ logfiledir: ${localstatedir}/log - proxycachedir: ${localstatedir}/proxy - - diff --git a/net/apache/patches/004-fix-scoreboard-location.patch b/net/apache/patches/004-fix-scoreboard-location.patch new file mode 100644 index 000000000..09f2ff7a1 --- /dev/null +++ b/net/apache/patches/004-fix-scoreboard-location.patch @@ -0,0 +1,11 @@ +--- a/include/scoreboard.h ++++ b/include/scoreboard.h +@@ -40,7 +40,7 @@ extern "C" { + + /* Scoreboard file, if there is one */ + #ifndef DEFAULT_SCOREBOARD +-#define DEFAULT_SCOREBOARD "logs/apache_runtime_status" ++#define DEFAULT_SCOREBOARD "log/apache2/apache_runtime_status" + #endif + + /* Scoreboard info on a process is, for now, kept very brief --- diff --git a/net/apache/patches/004-pidfile_fix.patch b/net/apache/patches/004-pidfile_fix.patch deleted file mode 100644 index 647f821ad..000000000 --- a/net/apache/patches/004-pidfile_fix.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: httpd-2.4.25/include/scoreboard.h -=================================================================== ---- httpd-2.4.25.orig/include/scoreboard.h -+++ httpd-2.4.25/include/scoreboard.h -@@ -40,7 +40,7 @@ extern "C" { - - /* Scoreboard file, if there is one */ - #ifndef DEFAULT_SCOREBOARD --#define DEFAULT_SCOREBOARD "logs/apache_runtime_status" -+#define DEFAULT_SCOREBOARD "log/apache_runtime_status" - #endif - - /* Scoreboard info on a process is, for now, kept very brief --- From c8aba5113bbe90202c87bad9db9d4c72ccc6afa2 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Wed, 1 Jan 2020 23:46:21 +0100 Subject: [PATCH 3/7] apache: add extra packages + apache user This adds extra packages for certain modules (basically the ones that incur further dependencies), support files etc. This is pretty much follows Alpine's example. This updates the httpd.conf patch to _not_ uncomment MIMEMagicFile (because the module isn't loaded by default) and removes that changes that aren't needed anymore (because of the added module support). The patch now only changes the default user. Signed-off-by: Sebastian Kemper --- net/apache/Config.in | 11 - net/apache/Makefile | 247 ++++++++++++++++-- net/apache/patches/005-httpd_conf.patch | 60 +---- .../patches/010-reproducible-builds.patch | 14 +- 4 files changed, 232 insertions(+), 100 deletions(-) delete mode 100644 net/apache/Config.in diff --git a/net/apache/Config.in b/net/apache/Config.in deleted file mode 100644 index 5eb42b30a..000000000 --- a/net/apache/Config.in +++ /dev/null @@ -1,11 +0,0 @@ -menu "Configuration" - depends on PACKAGE_apache - -config APACHE_HTTP2 - bool - prompt "Enable HTTP2" - help - Enable HTTPS2 support. - default n - -endmenu diff --git a/net/apache/Makefile b/net/apache/Makefile index 0d7d35cac..908b7a67c 100644 --- a/net/apache/Makefile +++ b/net/apache/Makefile @@ -24,24 +24,30 @@ PKG_LICENSE_FILES:=LICENSE PKG_CPE_ID:=cpe:/a:apache:http_server -PKG_BUILD_PARALLEL:=1 +PKG_BUILD_DEPENDS:=openssl -PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 PKG_CONFIG_DEPENDS:= \ - CONFIG_APACHE_HTTP2 + CONFIG_PACKAGE_apache-mod-deflate \ + CONFIG_PACKAGE_apache-mod-http2 \ + CONFIG_PACKAGE_apache-mod-ldap \ + CONFIG_PACKAGE_apache-mod-lua \ + CONFIG_PACKAGE_apache-mod-md \ + CONFIG_PACKAGE_apache-mod-proxy \ + CONFIG_PACKAGE_apache-mod-proxy-html \ + CONFIG_PACKAGE_apache-mod-session-crypto \ + CONFIG_PACKAGE_apache-mod-suexec \ + CONFIG_PACKAGE_apache-mod-webdav \ + CONFIG_PACKAGE_apache-suexec PKG_FIXUP:=autoreconf -ADDITIONAL_MODULES:= -ifeq ($(CONFIG_APACHE_HTTP2),y) - ADDITIONAL_MODULES += --enable-http2 -endif -ifneq ($(CONFIG_APACHE_HTTP2),y) - ADDITIONAL_MODULES += --enable-http2=no -endif +PKG_INSTALL:=1 include $(INCLUDE_DIR)/package.mk +# without nls.mk mod_xml2enc might not find the iconv headers +include $(INCLUDE_DIR)/nls.mk define Package/apache/Default SECTION:=net @@ -63,7 +69,8 @@ endef define Package/apache $(call Package/apache/Default) - DEPENDS:=+libapr +libaprutil +libpcre +libopenssl +unixodbc +zlib +APACHE_HTTP2:libnghttp2 + USERID:=apache=377:apache=377 + DEPENDS:=+libapr +libaprutil +libpcre endef define Package/apache/description @@ -95,10 +102,37 @@ define Package/apache/conffiles /etc/apache2/extra/httpd-ssl.conf /etc/apache2/extra/httpd-userdir.conf /etc/apache2/extra/httpd-vhosts.conf +/etc/apache2/extra/proxy-html.conf /etc/apache2/magic /etc/apache2/mime.types endef +define Package/apache-ab +$(call Package/apache/Default) + TITLE:=Apache benchmark utility + DEPENDS:=apache +libopenssl +endef + +define Package/apache-ab/description +$(call Package/apache/Default/description) + +Apache server benchmarking utility. + +endef + +define Package/apache-error +$(call Package/apache/Default) + TITLE:=Error documents + DEPENDS:=apache +endef + +define Package/apache-error/description +$(call Package/apache/Default/description) + +Apache multi language custom error documents. + +endef + define Package/apache-icons $(call Package/apache/Default) TITLE:=Icons from Apache @@ -111,11 +145,49 @@ $(call Package/apache/Default/description) This package contains the icons from Apache. endef +define Package/apache-suexec +$(call Package/apache/Default) + TITLE:=Apache suEXEC + DEPENDS:=apache +endef + +define Package/apache-suexec/description +$(call Package/apache/Default/description) + +This package contains the suEXEC utility from Apache. + +endef + +define Package/apache-utils +$(call Package/apache/Default) + TITLE:=Apache utilities + DEPENDS:=apache +endef + +define Package/apache-utils/description +$(call Package/apache/Default/description) + +Apache utility programs for webservers. + +endef + +define Package/apache/install/mod + $(INSTALL_DIR) $(1)/usr/lib/apache2 + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/lib/apache2/mod_$(2).so \ + $(1)/usr/lib/apache2 +endef + CONFIGURE_ARGS+= \ + --$(if $(CONFIG_PACKAGE_apache-mod-deflate),en,dis)able-deflate \ + --$(if $(CONFIG_PACKAGE_apache-mod-http2),en,dis)able-http2 \ + --$(if $(CONFIG_PACKAGE_apache-mod-lua),en,dis)able-lua \ + --$(if $(CONFIG_PACKAGE_apache-mod-md),en,dis)able-md \ + --$(if $(CONFIG_PACKAGE_apache-mod-proxy),en,dis)able-proxy \ + --$(if $(CONFIG_PACKAGE_apache-mod-session-crypto),en,dis)able-session-crypto \ + --$(if $(CONFIG_PACKAGE_apache-mod-ssl),en,dis)able-ssl \ --datadir=/usr/share/apache2 \ - --disable-authnz-ldap \ --disable-imagemap \ - --disable-ldap \ --disable-luajit \ --enable-authn-alias \ --enable-authn-anon \ @@ -139,6 +211,62 @@ CONFIGURE_ARGS+= \ --with-pcre="$(STAGING_DIR)/usr/bin/pcre-config" \ --with-ssl +ifneq ($(CONFIG_PACKAGE_apache-mod-ldap),) +CONFIGURE_ARGS+= \ + --enable-authnz-ldap \ + --enable-ldap +else +CONFIGURE_ARGS+= \ + --disable-authnz-ldap \ + --disable-ldap +endif + +ifneq ($(CONFIG_PACKAGE_apache-mod-proxy),) +CONFIGURE_ARGS+= \ + --enable-proxy \ + --enable-proxy-connect \ + --enable-proxy-ftp \ + --enable-proxy-http +else +CONFIGURE_ARGS+= \ + --disable-proxy +endif + +ifneq ($(CONFIG_PACKAGE_apache-mod-proxy-html),) +CONFIGURE_ARGS+= \ + --enable-proxy-html \ + --enable-xml2enc \ + --with-libxml2="$(STAGING_DIR)/usr" +else +CONFIGURE_ARGS+= \ + --disable-proxy-html \ + --disable-xml2enc +endif + +ifneq ($(CONFIG_PACKAGE_apache-mod-suexec)$(CONFIG_PACKAGE_apache-suexec),) +CONFIGURE_ARGS+= \ + --enable-suexec \ + --with-suexec-bin=/usr/sbin/suexec \ + --with-suexec-caller=apache \ + --with-suexec-docroot=/var/www \ + --with-suexec-logfile=/var/log/apache2/suexec.log \ + --with-suexec-uidmin=99 \ + --with-suexec-gidmin=99 +else +CONFIGURE_ARGS+= \ + --disable-suexec +endif + +ifneq ($(CONFIG_PACKAGE_apache-mod-webdav),) +CONFIGURE_ARGS+= \ + --enable-dav \ + --enable-dav-fs \ + --enable-dav-lock +else +CONFIGURE_ARGS+= \ + --disable-dav +endif + CONFIGURE_VARS += \ ap_cv_void_ptr_lt_long=no @@ -175,16 +303,31 @@ define Package/apache/preinst endef define Package/apache/install - $(INSTALL_DIR) $(1)/usr/sbin - # we don't need apxs on the router, it's just for building apache modules. - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{ab,dbmmanage,htdbm,htdigest,htpasswd,httxt2dbm,logresolve} $(1)/usr/sbin/ - $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{apachectl,checkgid,envvars,envvars-std,htcacheclean,httpd,rotatelogs} $(1)/usr/sbin/ - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/httpd.exp $(1)/usr/lib/ - $(INSTALL_DIR) $(1)/usr/share - $(CP) $(PKG_INSTALL_DIR)/usr/share/{error,htdocs,cgi-bin,build} $(1)/usr/share/ - $(INSTALL_DIR) $(1)/etc/apache - $(CP) $(PKG_INSTALL_DIR)/etc/apache/{httpd.conf,magic,mime.types,extra} $(1)/etc/apache/ + $(INSTALL_DIR) $(1)/etc/apache2/extra + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/apache2/extra/* \ + $(1)/etc/apache2/extra + $(INSTALL_DATA) \ + $(PKG_INSTALL_DIR)/etc/apache2/{httpd.conf,magic,mime.types} \ + $(1)/etc/apache2 + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/apache.init $(1)/etc/init.d/apache + $(INSTALL_DIR) $(1)/usr/lib/apache2 + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/apache2/*.so \ + $(1)/usr/lib/apache2 + rm -f $(1)/usr/lib/apache2/mod_{*ldap,dav*,deflate,http2,lbmethod_*,lua,md,proxy*,proxy_html,session_crypto,ssl,suexec,xml2enc}.so + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/apache2/httpd.exp \ + $(1)/usr/lib/apache2 + $(INSTALL_DIR) $(1)/usr/share/apache2/{cgi-bin,htdocs} + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/apache2/cgi-bin/* \ + $(1)/usr/share/apache2/cgi-bin + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/apache2/htdocs/* \ + $(1)/usr/share/apache2/htdocs + $(INSTALL_DIR) $(1)/usr/{,s}bin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/bin/{dbmmanage,htdbm,htdigest,htpasswd,httxt2dbm,logresolve} \ + $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/{apachectl,httpd} \ + $(1)/usr/sbin endef define Package/apache/postrm @@ -194,10 +337,64 @@ define Package/apache/postrm with busybox's httpd." endef +define Package/apache-ab/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ab $(1)/usr/bin +endef + +define Package/apache-error/install + $(INSTALL_DIR) $(1)/usr/share/apache2/error + $(CP) $(PKG_INSTALL_DIR)/usr/share/apache2/error/* \ + $(1)/usr/share/apache2/error +endef + define Package/apache-icons/install - $(INSTALL_DIR) $(1)/usr/share - $(CP) $(PKG_INSTALL_DIR)/usr/share/icons $(1)/usr/share/ + $(INSTALL_DIR) $(1)/usr/share/apache2 + $(CP) $(PKG_INSTALL_DIR)/usr/share/apache2/icons \ + $(1)/usr/share/apache2 +endef + +define Package/apache-suexec/install + $(INSTALL_DIR) $(1)/usr/sbin + $(CP) $(PKG_INSTALL_DIR)/usr/sbin/suexec $(1)/usr/sbin +endef + +define Package/apache-utils/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) \ + $(PKG_INSTALL_DIR)/usr/sbin/{checkgid,envvars*,htcacheclean,rotatelogs} \ + $(1)/usr/sbin +endef + +define Package/apache/Module +define Package/apache-mod-$(1) +$(call Package/apache/Default) + TITLE:=$(2) module + DEPENDS:=apache $(patsubst +%,+PACKAGE_apache-mod-$(1):%,$(4)) +endef +define Package/apache-mod-$(1)/description +$(subst \n,$(newline),$(3)) +endef +define Package/apache-mod-$(1)/install +$(foreach m,$(5),$(call Package/apache/install/mod,$$(1),$(m));) +endef +$$(eval $$(call BuildPackage,apache-mod-$(1))) endef $(eval $(call BuildPackage,apache)) +$(eval $(call BuildPackage,apache-ab)) +$(eval $(call BuildPackage,apache-error)) $(eval $(call BuildPackage,apache-icons)) +$(eval $(call BuildPackage,apache-suexec)) +$(eval $(call BuildPackage,apache-utils)) +$(eval $(call Package/apache/Module,deflate,Deflate,Deflate support for the Apache HTTP server.,+zlib,deflate)) +$(eval $(call Package/apache/Module,http2,HTTP2,HTTP/2 transport layer for the Apache HTTP Server.,+libnghttp2 +libopenssl,http2)) +$(eval $(call Package/apache/Module,ldap,LDAP,LDAP authentication/authorization module for the Apache HTTP Server.,+libaprutil-ldap,authnz_ldap ldap)) +$(eval $(call Package/apache/Module,lua,Lua,Lua support for the Apache HTTP server.,+liblua,lua)) +$(eval $(call Package/apache/Module,md,Managed Domain handling,Managed Domain handling.,+libcurl +jansson +libopenssl,md)) +$(eval $(call Package/apache/Module,proxy,Proxy,Proxy modules for the Apache HTTP Server.,,proxy proxy_ajp proxy_balancer proxy_connect proxy_express proxy_fcgi proxy_fdpass proxy_ftp proxy_hcheck proxy_http proxy_scgi proxy_uwsgi proxy_wstunnel lbmethod_byrequests lbmethod_heartbeat lbmethod_bytraffic lbmethod_bybusyness)) +$(eval $(call Package/apache/Module,proxy-html,Proxy HTML,HTML and XML content filters for the Apache HTTP Server.,+apache-mod-proxy +libxml2,proxy_html xml2enc)) +$(eval $(call Package/apache/Module,session-crypto,Session crypto,Session encryption support for the Apache HTTP Server.,+libaprutil-crypto-openssl,session_crypto)) +$(eval $(call Package/apache/Module,ssl,SSL/TLS,SSL/TLS module for the Apache HTTP Server.,+libopenssl,ssl)) +$(eval $(call Package/apache/Module,suexec,suEXEC,suEXEC module for the Apache HTTP Server.,+apache-suexec,suexec)) +$(eval $(call Package/apache/Module,webdav,WebDAV,WebDAV support for the Apache HTTP Server.,,dav dav_fs dav_lock)) diff --git a/net/apache/patches/005-httpd_conf.patch b/net/apache/patches/005-httpd_conf.patch index 04a73a9e3..9de32fe8c 100644 --- a/net/apache/patches/005-httpd_conf.patch +++ b/net/apache/patches/005-httpd_conf.patch @@ -1,63 +1,13 @@ -Index: httpd-2.4.25/docs/conf/httpd.conf.in -=================================================================== ---- httpd-2.4.25.orig/docs/conf/httpd.conf.in -+++ httpd-2.4.25/docs/conf/httpd.conf.in -@@ -63,7 +63,6 @@ Listen @@Port@@ - # Example: - # LoadModule foo_module modules/mod_foo.so - # --@@LoadModule@@ - - - # -@@ -74,8 +73,8 @@ Listen @@Port@@ +--- a/docs/conf/httpd.conf.in ++++ b/docs/conf/httpd.conf.in +@@ -74,8 +74,8 @@ Listen @@Port@@ # It is usually good practice to create a dedicated user and group for # running httpd, as with most system services. # -User daemon -Group daemon -+User nobody -+Group nogroup ++User apache ++Group apache -@@ -188,7 +187,7 @@ ErrorLog "@rel_logfiledir@/error_log" - # Possible values include: debug, info, notice, warn, error, crit, - # alert, emerg. - # --LogLevel warn -+LogLevel debug - - - # -@@ -330,7 +329,7 @@ LogLevel warn - # contents of the file itself to determine its type. The MIMEMagicFile - # directive tells the module where the hint definitions are located. - # --#MIMEMagicFile @rel_sysconfdir@/magic -+MIMEMagicFile @rel_sysconfdir@/magic - - # - # Customizable error responses come in three flavors: -@@ -360,7 +359,7 @@ LogLevel warn - # Defaults: EnableMMAP On, EnableSendfile Off - # - #EnableMMAP off --#EnableSendfile on -+EnableSendfile off - - # Supplemental configuration - # -@@ -411,8 +410,8 @@ Include @rel_sysconfdir@/extra/proxy-htm - # starting without SSL on platforms with no /dev/random equivalent - # but a statically compiled-in mod_ssl. - # -- --SSLRandomSeed startup builtin --SSLRandomSeed connect builtin -- -+# -+#SSLRandomSeed startup builtin -+#SSLRandomSeed connect builtin -+# - diff --git a/net/apache/patches/010-reproducible-builds.patch b/net/apache/patches/010-reproducible-builds.patch index 0289da1cb..8d73efec8 100644 --- a/net/apache/patches/010-reproducible-builds.patch +++ b/net/apache/patches/010-reproducible-builds.patch @@ -5,10 +5,8 @@ Author: Jean-Michel Vourgère Forwarded: no Last-Update: 2015-08-11 -Index: apache2/server/buildmark.c -=================================================================== ---- apache2.orig/server/buildmark.c -+++ apache2/server/buildmark.c +--- a/server/buildmark.c ++++ b/server/buildmark.c @@ -17,11 +17,7 @@ #include "ap_config.h" #include "httpd.h" @@ -22,16 +20,14 @@ Index: apache2/server/buildmark.c AP_DECLARE(const char *) ap_get_server_built() { -Index: apache2/server/Makefile.in -=================================================================== ---- apache2.orig/server/Makefile.in -+++ apache2/server/Makefile.in +--- a/server/Makefile.in ++++ b/server/Makefile.in @@ -1,3 +1,4 @@ +export LC_ALL = C CLEAN_TARGETS = gen_test_char test_char.h \ ApacheCoreOS2.def httpd.exp export_files \ -@@ -85,8 +86,8 @@ httpd.exp: exports.c export_vars.h +@@ -87,8 +88,8 @@ httpd.exp: exports.c export_vars.h @echo "#! ." > $@ @echo "* This file was AUTOGENERATED at build time." >> $@ @echo "* Please do not edit by hand." >> $@ From 2d188fd37f1d571f7315075b4be6538c8a125caf Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Wed, 1 Jan 2020 23:56:28 +0100 Subject: [PATCH 4/7] apache: add simple init script Also preinst and postrm are removed. busybox's httpd isn't installed by default, so these gimmicks seem antiquated. Signed-off-by: Sebastian Kemper --- net/apache/Makefile | 14 +------------- net/apache/files/apache.init | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 net/apache/files/apache.init diff --git a/net/apache/Makefile b/net/apache/Makefile index 908b7a67c..bd8a39623 100644 --- a/net/apache/Makefile +++ b/net/apache/Makefile @@ -105,6 +105,7 @@ define Package/apache/conffiles /etc/apache2/extra/proxy-html.conf /etc/apache2/magic /etc/apache2/mime.types +/etc/init.d/apache endef define Package/apache-ab @@ -296,12 +297,6 @@ define Build/InstallDev $(1)/usr/share endef -define Package/apache/preinst - rm /usr/sbin/httpd - echo -e "You should take a look in the initscripts, busybox's httpd \n\ - uses some parameters which are maybe unsupported by apache." -endef - define Package/apache/install $(INSTALL_DIR) $(1)/etc/apache2/extra $(INSTALL_DATA) $(PKG_INSTALL_DIR)/etc/apache2/extra/* \ @@ -330,13 +325,6 @@ define Package/apache/install $(1)/usr/sbin endef -define Package/apache/postrm - rm -rf /usr/sbin/httpd - ln -s /bin/busybox /usr/sbin/httpd - echo -e "You may need to change your initscripts back for the use \n\ - with busybox's httpd." -endef - define Package/apache-ab/install $(INSTALL_DIR) $(1)/usr/bin $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ab $(1)/usr/bin diff --git a/net/apache/files/apache.init b/net/apache/files/apache.init new file mode 100644 index 000000000..a0136c841 --- /dev/null +++ b/net/apache/files/apache.init @@ -0,0 +1,20 @@ +#!/bin/sh /etc/rc.common + +START=99 + +reload() { + apachectl -k restart +} + +restart() { + apachectl -k restart +} + +start() { + mkdir -p /var/log/apache2 /var/run/apache2 + apachectl -k start +} + +stop() { + apachectl -k stop +} From 31e0d618e5d8e35264d827f4de46a8b4e2535122 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Wed, 1 Jan 2020 23:58:26 +0100 Subject: [PATCH 5/7] apache: update descriptions Taken from upstream website. Also remove parts that aren't up to date anymore. Signed-off-by: Sebastian Kemper --- net/apache/Makefile | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/net/apache/Makefile b/net/apache/Makefile index bd8a39623..a8356c34e 100644 --- a/net/apache/Makefile +++ b/net/apache/Makefile @@ -58,13 +58,9 @@ define Package/apache/Default endef define Package/apache/Default/description - The Apache Web Server is a powerful and flexible HTTP/1.1 compliant - web server. Originally designed as a replacement for the NCSA HTTP - Server, it has grown to be the most popular web server on the Internet. -endef - -define Package/apache/config - source "$(SOURCE)/Config.in" +The Apache HTTP Server Project is a collaborative software development +effort aimed at creating a robust, commercial-grade, featureful, and +freely-available source code implementation of an HTTP (Web) server. endef define Package/apache @@ -75,18 +71,9 @@ endef define Package/apache/description $(call Package/apache/Default/description) - . - This package contains the Apache web server and utility programs. - . - Take care that you don't include apache at the moment into your image - please select it only as module because busybox will override - /usr/sbin/httpd. It'll be solved soon. If you need to include this - package in the image anyway, remove httpd from busybox - (Base system --> Configuration --> Networking Utilities --> httpd). - Also you should take care for the initscripts, apache's httpd isn't - compatible with the one from busybox, so if you want to use apache - for running your webif, you'll need to change the parameters in the - scripts and configure the rest in /etc/httpd.conf. + +This package contains the Apache web server and utility programs. + endef define Package/apache/conffiles @@ -142,8 +129,9 @@ endef define Package/apache-icons/description $(call Package/apache/Default/description) - . - This package contains the icons from Apache. + +This package contains the icons from Apache. + endef define Package/apache-suexec From 39e68309e8279d68496f649140f6df8ce59a3efd Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Thu, 2 Jan 2020 00:00:41 +0100 Subject: [PATCH 6/7] apache: update InstallDev The package doesn't need to install _everything_ to staging. This commit reduces the amount of files that get copied over to staging. Currently there's no package depending on apache anyway. This adds sed scripts from buildroot (thanks!) to fix two files that are important for cross-compiling external modules. This has been tested and was confirmed to work with mod_gnutls taken as an example package. Signed-off-by: Sebastian Kemper --- net/apache/Makefile | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/net/apache/Makefile b/net/apache/Makefile index a8356c34e..6525a87a7 100644 --- a/net/apache/Makefile +++ b/net/apache/Makefile @@ -265,24 +265,21 @@ define Build/Prepare endef define Build/InstallDev - rm -rf $(PKG_INSTALL_DIR)/usr/man/ \ - $(PKG_INSTALL_DIR)/usr/share/manual/ - # if you need docs take a look into the build-dir :) - $(INSTALL_DIR) $(1)/etc - $(CP) $(PKG_INSTALL_DIR)/etc/* \ - $(1)/etc - $(INSTALL_DIR) $(1)/usr/include/apache - $(CP) $(PKG_INSTALL_DIR)/usr/include/* \ - $(1)/usr/include/apache - $(INSTALL_DIR) $(1)/usr/lib - $(CP) $(PKG_INSTALL_DIR)/usr/lib/httpd.exp \ - $(1)/usr/lib - $(INSTALL_DIR) $(1)/usr/sbin - $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* \ - $(1)/usr/sbin - $(INSTALL_DIR) $(1)/usr/share - $(CP) $(PKG_INSTALL_DIR)/usr/share/* \ - $(1)/usr/share + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/apxs $(1)/usr/bin + $(INSTALL_DIR) $(1)/usr/include/apache2 + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/apache2/* \ + $(1)/usr/include/apache2 + $(INSTALL_DIR) $(1)/usr/lib/apache2 + $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/apache2/httpd.exp \ + $(1)/usr/lib/apache2 + $(INSTALL_DIR) $(1)/usr/share/apache2/build + $(CP) $(PKG_INSTALL_DIR)/usr/share/apache2/build/* \ + $(1)/usr/share/apache2/build + $(SED) 's%/usr/share/apache2/build%$(STAGING_DIR)/usr/share/apache2/build%' \ + $(1)/usr/bin/apxs + $(SED) 's%^prefix =.*%prefix = $(STAGING_DIR)/usr%' \ + $(1)/usr/share/apache2/build/config_vars.mk endef define Package/apache/install From a1472254db1332a3138ef7305bdc9953cfa1b8c2 Mon Sep 17 00:00:00 2001 From: Sebastian Kemper Date: Sun, 12 Jan 2020 21:36:30 +0100 Subject: [PATCH 7/7] apache: add myself as maintainer Signed-off-by: Sebastian Kemper --- net/apache/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/apache/Makefile b/net/apache/Makefile index 6525a87a7..479872ff4 100644 --- a/net/apache/Makefile +++ b/net/apache/Makefile @@ -18,7 +18,8 @@ PKG_HASH:=133d48298fe5315ae9366a0ec66282fa4040efa5d566174481077ade7d18ea40 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_SOURCE_NAME)-$(PKG_VERSION) -PKG_MAINTAINER:=Thomas Heil +PKG_MAINTAINER:=Thomas Heil , \ + Sebastian Kemper PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE