apache2: add package (#1040)
authorVishal Biswas <vshlbiswas@ymail.com>
Tue, 6 Jun 2017 08:20:51 +0000 (13:50 +0530)
committerFredrik Fornwall <fredrik@fornwall.net>
Tue, 6 Jun 2017 08:20:51 +0000 (10:20 +0200)
* apache2: add package

* apache2: create empty log dir

packages/apache2/Termux.layout [new file with mode: 0644]
packages/apache2/build.sh [new file with mode: 0644]

diff --git a/packages/apache2/Termux.layout b/packages/apache2/Termux.layout
new file mode 100644 (file)
index 0000000..33de7be
--- /dev/null
@@ -0,0 +1,25 @@
+
+# Termux layout
+<Layout Termux>
+    prefix:
+    exec_prefix:   ${prefix}
+    bindir:        ${exec_prefix}/bin
+    sbindir:       ${exec_prefix}/bin
+    libdir:        ${exec_prefix}/lib
+    libexecdir:    ${exec_prefix}/libexec/apache2
+    mandir:        ${exec_prefix}/share/man
+    sysconfdir:    ${prefix}/etc/apache2
+    datadir:       ${exec_prefix}/share/apache2
+    iconsdir:      ${datadir}/icons
+    htdocsdir:     ${prefix}/share/apache2/default-site/htdocs
+    manualdir:     ${htdocsdir}/manual
+    cgidir:        ${prefix}/lib/cgi-bin
+    includedir:    ${exec_prefix}/include/apache2
+    localstatedir: ${prefix}/var/lock/apache2
+    runtimedir:    ${prefix}/var/run/apache2
+    logfiledir:    ${prefix}/var/log/apache2
+    proxycachedir: ${prefix}/var/cache/apache2/proxy
+    infodir:       ${exec_prefix}/share/info
+    installbuilddir: ${prefix}/share/apache2/build
+    errordir:      ${datadir}/error
+</Layout>
diff --git a/packages/apache2/build.sh b/packages/apache2/build.sh
new file mode 100644 (file)
index 0000000..90c55f8
--- /dev/null
@@ -0,0 +1,114 @@
+TERMUX_PKG_HOMEPAGE=http://httpd.apache.org
+TERMUX_PKG_DESCRIPTION="Apache Web Server"
+TERMUX_PKG_VERSION=2.4.25
+TERMUX_PKG_SRCURL=https://www.apache.org/dist/httpd/httpd-$TERMUX_PKG_VERSION.tar.bz2
+TERMUX_PKG_SHA256=f87ec2df1c9fee3e6bfde3c8b855a3ddb7ca1ab20ca877bd0e2b6bf3f05c80b2
+TERMUX_PKG_DEPENDS="apr, apr-util, pcre, openssl, libcrypt, libandroid-support, libnghttp2, libexpat"
+TERMUX_PKG_CONFFILES="
+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/extra/proxy-html.conf
+etc/apache2/mime.types
+etc/apache2/magic
+"
+TERMUX_PKG_MAINTAINER="Vishal Biswas @vishalbiswas"
+# providing manual paths to libs because it picks up host libs on some systems
+TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
+--with-apr=$TERMUX_PREFIX
+--with-apr-util=$TERMUX_PREFIX
+--with-pcre=$TERMUX_PREFIX
+--enable-suexec
+--enable-layout=Termux
+--enable-so
+--enable-authnz-fcgi
+--enable-cache
+--enable-disk-cache
+--enable-mem-cache
+--enable-file-cache
+--enable-ssl
+--with-ssl
+--enable-deflate
+--enable-cgi
+--enable-cgid
+--enable-proxy
+--enable-proxy-connect
+--enable-proxy-http
+--enable-proxy-ftp
+--enable-dbd
+--enable-imagemap
+--enable-ident
+--enable-cern-meta
+--enable-http2
+--enable-mpms-shared=all
+--enable-modules=all
+--enable-mods-shared=all
+--disable-mods-static
+--with-port=8080
+--with-sslport=8443
+--enable-unixd
+--libexecdir=$TERMUX_PREFIX/libexec/apache2
+ac_cv_func_getpwnam=yes
+ac_cv_have_threadsafe_pollset=no
+"
+TERMUX_PKG_BUILD_IN_SRC=true
+TERMUX_PKG_RM_AFTER_INSTALL="share/apache2/manual etc/apache2/original share/man/man8/suexec.8 libexec/httpd.exp"
+TERMUX_PKG_INCLUDE_IN_DEVPACKAGE="share/apache2/build"
+TERMUX_PKG_EXTRA_MAKE_ARGS="-s"
+
+termux_step_pre_configure () {
+       # remove old files
+       rm -rf "$TERMUX_PREFIX"/{libexec,share,etc}/apache2
+       rm -rf "$TERMUX_PREFIX"/lib/cgi-bin
+
+       if [ $TERMUX_ARCH_BITS -eq 32 ]; then
+               export ap_cv_void_ptr_lt_long=4
+       else
+               export ap_cv_void_ptr_lt_long=8
+       fi
+
+       LDFLAGS="$LDFLAGS -llog -lapr-1 -laprutil-1"
+
+       # use custom layout
+       cat $TERMUX_PKG_BUILDER_DIR/Termux.layout > $TERMUX_PKG_SRCDIR/config.layout
+}
+
+termux_step_post_configure () {
+       # thanks to @JetBalsa
+       gcc -O2 -DCROSS_COMPILE $TERMUX_PKG_SRCDIR/server/gen_test_char.c -o $TERMUX_PKG_BUILDDIR/server/gen_test_char
+       touch -d "1 hour" $TERMUX_PKG_BUILDDIR/server/gen_test_char
+}
+
+termux_step_post_make_install () {
+       sed -e "s#/$TERMUX_PREFIX/libexec/apache2/#modules/#" \
+               -e 's|#\(LoadModule negotiation_module \)|\1|' \
+               -e 's|#\(LoadModule include_module \)|\1|' \
+               -e 's|#\(LoadModule userdir_module \)|\1|' \
+               -e 's|#\(LoadModule slotmem_shm_module \)|\1|' \
+               -e 's|#\(Include extra/httpd-multilang-errordoc.conf\)|\1|' \
+               -e 's|#\(Include extra/httpd-autoindex.conf\)|\1|' \
+               -e 's|#\(Include extra/httpd-languages.conf\)|\1|' \
+               -e 's|#\(Include extra/httpd-userdir.conf\)|\1|' \
+               -e 's|#\(Include extra/httpd-default.conf\)|\1|' \
+               -e 's|#\(Include extra/httpd-mpm.conf\)|\1|' \
+               -e 's|User daemon|#User daemon|' \
+               -e 's|Group daemon|#Group daemon|' \
+               -i "$TERMUX_PREFIX/etc/apache2/httpd.conf"
+}
+
+termux_step_post_massage () {
+       # sometimes it creates a $TERMUX_PREFIX/bin/sh -> /bin/sh
+       rm ${TERMUX_PKG_MASSAGEDIR}${TERMUX_PREFIX}/bin/sh || true
+
+       mkdir -p ${TERMUX_PKG_MASSAGEDIR}${TERMUX_PREFIX}/var/run/apache2
+       mkdir -p ${TERMUX_PKG_MASSAGEDIR}${TERMUX_PREFIX}/var/log/apache2
+}