# $Id$ PNAME="apache2" PVER="2.4.27" PBUILD="r2" PCAT="net-www" DESCRIPTION="The Apache HTTP web server." HOMEPAGE="http://httpd.apache.org/" # systemd is required by mod_systemd # perl is required for serveral tools like apxs, dbmmanage DEPEND=">= virtual/glibc >= dev-libs/apr-1.5 >= dev-libs/apr-util-1.5 >= dev-libs/libxml2-2.9 >= dev-libs/expat-2.1 >= dev-libs/libpcre-8.37 >= dev-libs/openssl-1.0.2 >= dev-db/db-6.1 >= dev-lang/perl-5.22 >= sys-libs/libuuid-2.26 >= sys-libs/zlib-1.2" ALX_DEV_DEPEND=">= dev-libs/libxml2-dev-2.9 >= dev-libs/expat-dev-2.1 >= dev-libs/libpcre-dev-8.37 >= dev-libs/openssl-dev-1.0.2 >= dev-db/db-dev-6.1 >= sys-libs/libuuid-dev-2.26 >= sys-libs/zlib-dev-1.2" SDEPEND="${ALX_DEV_DEPEND}" PROVIDE="virtual/httpd" SRCFILE="httpd-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/httpd-${PVER}" SVC_REV=1.2 LOG_REV=1.2 sminclude mtools systemd SRC_URI=( http://www.apache.org/dist/httpd/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/${PNAME}-2.4.3-magellan-layout.patch mirror://${PNAME}/${PNAME}-2.2.4-magellan-vendor.patch mirror://${PNAME}/${PNAME}-2.2.8-default-user.patch mirror://${PNAME}/${PNAME}-2.4.16-default-server-root.patch mirror://${PNAME}/${PNAME}-2.4.3-default-mpm-settings.patch mirror://${PNAME}/${PNAME}-2.2.9-default-dav-settings.patch mirror://${PNAME}/${PNAME}-2.4.3-default-ssl-settings.patch mirror://${PNAME}/${PNAME}-2.4.3-default-httpd-config-2.patch mirror://${PNAME}/${PNAME}-2.2.4-apxs-httpd-config-2.patch mirror://${PNAME}/${PNAME}-2.4.3-mod_systemd.patch mirror://${PNAME}/apache2.service-${SVC_REV} mirror://${PNAME}/apache2.tmpfilesd mirror://${PNAME}/apache2.logrotate-${LOG_REV} mirror://${PNAME}/gentestcrt.sh ) UP2DATE="updatecmd http://www.apache.org/dist/httpd/ | grep httpd- | lasttarball" pkg_setup() { preinstall } src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # add our own layout # renewed patch using /run mpatch ${PNAME}-2.4.3-magellan-layout.patch || die # report version description with 'Magellan' instead of 'UNIX' mpatch ${PNAME}-2.2.4-magellan-vendor.patch || die # use 'apache' as http-user instead of daemon mpatch ${PNAME}-2.2.8-default-user.patch || die # fixes the default server root in the httpd.conf # defaults to $(prefix) but $(libdir)/apache2 is safer mpatch ${PNAME}-2.4.16-default-server-root.patch || die # fixes the default pid- and lockfile # try to be compatible with apache1 and apache2 installations # -> the pidfile should be named apache2.pid # also all other unneeded mpm settings are removed mpatch ${PNAME}-2.4.3-default-mpm-settings.patch || die # use same sane default dav settings that match our layout mpatch ${PNAME}-2.2.9-default-dav-settings.patch || die # fixes the default ssl pathes mpatch ${PNAME}-2.4.3-default-ssl-settings.patch || die # use modules.d instead of extra directory for addons # and renamed the config files without the 'httpd-' prefix # and now load mpm.conf and default.conf mpatch ${PNAME}-2.4.3-default-httpd-config-2.patch || die # fixes apxs to not use progname.conf but httpd.conf as httpd config # and fixes to modules path relative to server root also mpatch ${PNAME}-2.2.4-apxs-httpd-config-2.patch || die # add systemd support mpatch ${PNAME}-2.4.3-mod_systemd.patch || die } src_compile() { cd ${SRCDIR} # beware! mconfigure overwrite our layout pathes! mconfigure \ --libexecdir=/usr/$(mlibdir)/apache2/modules \ --includedir=/usr/include/apache2 \ --datadir=/var/www \ --sysconfdir=/etc/apache2 \ --localstatedir=/var \ --enable-layout=Magellan \ --with-program-name=apache2 \ --with-port=80 \ --enable-so \ --enable-modules=all \ --enable-mods-shared=all \ --enable-suexec \ --with-suexec-safepath='/usr/local/bin:/usr/bin:/bin' \ --with-suexec-logfile=/var/log/apache2/suexec_log \ --with-suexec-bin=/usr/sbin/suexec \ --with-suexec-userdir=public_html \ --with-suexec-caller=apache \ --with-suexec-docroot=/var/www \ --with-suexec-uidmin=1000 \ --with-suexec-gidmin=100 \ --with-suexec-umask=077 \ --with-ssl=/usr \ --enable-ssl \ --enable-deflate \ --with-gdbm \ --with-mpm=prefork \ --with-pcre \ --with-pcre=/usr \ --with-perl=/usr/bin/perl \ --with-expat=/usr \ --with-z=/usr \ --with-apr=/usr \ --with-apr-util=/usr \ || die # include/ap_config_auto.h is created by configure and # --with-program-name renames http.conf to the given program name, # but we want to use httpd.conf instead of apache2.conf sed -i 's:apache2\.conf:httpd.conf:' include/ap_config_auto.h || die # fix up the server root, default is $prefix but we want /usr/lib/apache2 sed -i "s:^\(#define HTTPD_ROOT \).*:\1\"/usr/$(mlibdir)/apache2\":" include/ap_config_auto.h || die # multilib build fixes, like this one: # /usr/lib64/apr-1/build/libtool --silent --mode=link x86_64-pc-linux-gnu-gcc -pthread -L/usr/lib -o htpasswd htpasswd.lo -lm -L/usr/lib64 -lpcre /usr/lib64/libaprutil-1.la -ldb -lexpat /usr/lib64/libapr-1.la -luuid -lrt -lcrypt -lpthread -ldl # /usr/bin/ld: skipping incompatible /usr/lib/libm.so when searching for -lm # /usr/bin/ld: skipping incompatible /usr/lib/libm.a when searching for -lm # /usr/lib/libexpat.so: could not read symbols: File in wrong format sed -i "s:/usr/lib$:/usr/$(mlibdir):" build/config_vars.mk || die mmake || die } src_install() { cd ${SRCDIR} mmake DESTDIR=${BINDIR} install || die minstalldocs ABOUT* CHANGES LICENSE NOTICE README* ROADMAP VERSIONING || die # fix permissions of suexec mchown root:apache /usr/sbin/suexec || die mchmod 4710 /usr/sbin/suexec || die # create some needed dirs mkeepdir /etc/apache2/ssl || die mkeepdir /var/lib/apache || die mchown apache:apache /var/lib/apache || die mkeepdir /var/lib/dav || die mchown apache:apache /var/lib/dav || die mkeepdir /var/log/apache2 || die mchown apache:apache /var/log/apache2 || die mkeepdir /var/cache/apache2/proxy || die mchown apache:apache /var/cache/apache2/proxy || die # install certificate helper minstallexec -s gentestcrt.sh /usr/sbin/gentestcrt || die # install logrotate config minstalllog apache2.logrotate-${LOG_REV} apache2 || die # install systemd unit and files minstallunit apache2.service-${SVC_REV} apache2.service || die minstalltmp apache2.tmpfilesd apache2.conf || die # rename apache2.conf mv ${BINDIR}/etc/apache2/{apache2,httpd}.conf || die # rename extra dir to modules.d and remove the 'httpd-' # prefix from every module configuration file mv ${BINDIR}/etc/apache2/{extra,modules.d} || die local i for i in ${BINDIR}/etc/apache2/modules.d/* do if [[ ${i/httpd-/} != ${i} ]] then mv ${i} ${i/httpd-/} || die ${i} fi done # prune backup files if [[ -d ${BINDIR}/etc/apache2/original ]] then rm -r ${BINDIR}/etc/apache2/original || die fi # add /var/www to CONFIG_PROTECT minstalldir /etc/env.d || die echo "CONFIG_PROTECT=\"/var/www\"" > ${BINDIR}/etc/env.d/30apache2 || die echo "CONFIG_PROTECT_MASK=\"/var/www/manual\"" >> ${BINDIR}/etc/env.d/30apache2 || die } preinstall() { # adding apache user mgroupadd -o "-g 81" apache museradd -o "-u 81 -g apache -d /var/lib/apache -s /bin/false" apache } postinstall() { # taken from gentoo - generate a test ssl certificate if [[ ! -e ${MROOT}/etc/apache2/ssl/server.crt ]] then [[ -d ${MROOT}/etc/apache2/ssl ]] && install -d ${MROOT}/etc/apache2/ssl cd ${MROOT}/etc/apache2/ssl echo echo "Generating self-signed test certificate in ${MROOT}/etc/apache2/ssl ..." echo yes "" 2> /dev/null | ${MROOT}/usr/sbin/gentestcrt > /dev/null 2>&1 fi mstartunit apache2 } postremove() { [[ ! -f /usr/sbin/apache2 ]] && mstopunit apache2 }