[buildout]
parts =
  apache
  apache-antiloris

extends =
  ../nghttp2/buildout.cfg
  ../gdbm/buildout.cfg
  ../libexpat/buildout.cfg
  ../libuuid/buildout.cfg
  ../libxml2/buildout.cfg
  ../openssl/buildout.cfg
  ../patch/buildout.cfg
  ../pcre/buildout.cfg
  ../perl/buildout.cfg
  ../pkgconfig/buildout.cfg
  ../sqlite3/buildout.cfg
  ../zlib/buildout.cfg

[apr]
recipe = slapos.recipe.build:download-unpacked
strip-top-level-dir = false
version = 1.5.2
md5sum = 4e9769f3349fe11fc0a5e1b224c236aa
url = https://archive.apache.org/dist/apr/apr-${:version}.tar.bz2

[apr-util]
recipe = slapos.recipe.build:download-unpacked
strip-top-level-dir = false
version = 1.5.4
url = https://archive.apache.org/dist/apr/apr-util-${:version}.tar.bz2
md5sum = 2202b18f269ad606d70e1864857ed93c

[apache]
# inspired on http://old.aclark.net/team/aclark/blog/a-lamp-buildout-for-wordpress-and-other-php-apps/
recipe = slapos.recipe.cmmi
version = 2.4.28
url = https://archive.apache.org/dist/httpd/httpd-${:version}.tar.bz2
md5sum = 49007ffe8e37a0834255b279810edf24
pre-configure =
  cp -ar ${apr:location}/apr-${apr:version} srclib/apr/ &&
  cp -ar ${apr-util:location}/apr-util-${apr-util:version} srclib/apr-util
configure-options = --disable-static
                    --enable-authn-alias
                    --enable-bucketeer
                    --enable-cache
                    --enable-case-filter
                    --enable-case-filter-in
                    --enable-cgid
                    --enable-charset-lite
                    --enable-disk-cache
                    --enable-mem-cache
                    --enable-echo
                    --enable-http2
                    --enable-exception-hook
                    --enable-mods-shared=all
                    --enable-optional-fn-export
                    --enable-optional-fn-import
                    --enable-optional-hook-export
                    --enable-optional-hook-import
                    --enable-proxy
                    --enable-proxy-ajp
                    --enable-proxy-balancer
                    --enable-proxy-connect
                    --enable-proxy-ftp
                    --enable-proxy-http
                    --enable-proxy-scgi
                    --enable-dav
                    --enable-dav-fs
                    --enable-so
                    --enable-ssl
                    --disable-lua
                    --with-included-apr
                    --with-ssl=${openssl:location}
                    --with-z=${zlib:location}
                    --with-expat=${libexpat:location}
                    --with-libxml2=${libxml2:location}/include/libxml2
                    --with-pcre=${pcre:location}
                    --with-sqlite3=${sqlite3:location}
                    --with-gdbm=${gdbm:location}
                    --with-nghttp2=${nghttp2:location}
                    --without-lber
                    --without-ldap
                    --without-ndbm
                    --without-berkeley-db
                    --without-pgsql
                    --without-mysql
                    --without-sqlite2
                    --without-oracle
                    --without-freedts
                    --without-odbc
                    --without-iconv

environment =
  PATH=${perl:location}/bin:${pkgconfig:location}/bin:%(PATH)s
  PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig
  CPPFLAGS =-I${libuuid:location}/include -I${openssl:location}/include
  LDFLAGS =-Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${openssl:location}/lib -L${libuuid:location}/lib -Wl,-rpath=${libuuid:location}/lib -L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib -Wl,-rpath=${pcre:location}/lib -Wl,-rpath=${sqlite3:location}/lib -Wl,-rpath=${gdbm:location}/lib

[apache-antiloris]
# Note: Shall react on each build of apache and reinstall itself
recipe = slapos.recipe.cmmi
url = http://downloads.sourceforge.net/project/mod-antiloris/mod_antiloris-0.4.tar.bz2
md5sum = 66862bf10e9be3a023e475604a28a0b4
patch-options = -p0
# http://www.apachelounge.com/viewtopic.php?p=19139
# http://www.apachelounge.com/viewtopic.php?p=20551
patches =
  ${:_profile_base_location_}/mod_antiloris-apache-2.4.patch#4f074f035d3b37f3f3e71cd9616440f3
configure-command = ${apache:location}/bin/apxs
configure-options = -c mod_antiloris.c
make-binary = ${:configure-command}
make-options = -i -a -n antiloris mod_antiloris.la
make-targets =
environment =
  PATH=${patch:location}/bin:%(PATH)s

[apache-2.2]
# inspired on http://old.aclark.net/team/aclark/blog/a-lamp-buildout-for-wordpress-and-other-php-apps/
recipe = slapos.recipe.cmmi
version = 2.2.34
url = https://archive.apache.org/dist/httpd/httpd-${:version}.tar.bz2
md5sum = c0bf1bdb779a3b5e6e294caf9ca20441
patch-options = -p1
configure-options = --disable-static
                    --enable-authn-alias
                    --enable-bucketeer
                    --enable-cache
                    --enable-case-filter
                    --enable-case-filter-in
                    --enable-cgid
                    --enable-charset-lite
                    --enable-disk-cache
                    --enable-mem-cache
                    --enable-echo
                    --enable-exception-hook
                    --enable-mods-shared=all
                    --enable-optional-fn-export
                    --enable-optional-fn-import
                    --enable-optional-hook-export
                    --enable-optional-hook-import
                    --enable-proxy
                    --enable-proxy-ajp
                    --enable-proxy-balancer
                    --enable-proxy-connect
                    --enable-proxy-ftp
                    --enable-proxy-http
                    --enable-proxy-scgi
                    --enable-dav
                    --enable-dav-fs
                    --enable-dav-lock
                    --enable-so
                    --enable-ssl
                    --with-included-apr
                    --with-ssl=${openssl:location}
                    --with-z=${zlib:location}
                    --with-expat=${libexpat:location}
                    --with-pcre=${pcre:location}
                    --with-sqlite3=${sqlite3:location}
                    --with-gdbm=${gdbm:location}
                    --without-lber
                    --without-ldap
                    --without-ndbm
                    --without-berkeley-db
                    --without-pgsql
                    --without-mysql
                    --without-sqlite2
                    --without-oracle
                    --without-freedts
                    --without-odbc
                    --without-iconv

environment =
  PATH=${patch:location}/bin:${perl:location}/bin:${pkgconfig:location}/bin:%(PATH)s
  PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig
  CPPFLAGS =-I${libuuid:location}/include
  LDFLAGS =-Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${openssl:location}/lib -L${libuuid:location}/lib -Wl,-rpath=${libuuid:location}/lib -Wl,-rpath=${libexpat:location}/lib -Wl,-rpath=${pcre:location}/lib -Wl,-rpath=${sqlite3:location}/lib -Wl,-rpath=${gdbm:location}/lib

[apache-antiloris-apache-2.2]
# Note: Shall react on each build of apache and reinstall itself
recipe = slapos.recipe.cmmi
url = http://downloads.sourceforge.net/project/mod-antiloris/mod_antiloris-0.4.tar.bz2
md5sum = 66862bf10e9be3a023e475604a28a0b4
configure-command = ${apache-2.2:location}/bin/apxs
configure-options = -c mod_antiloris.c
make-binary = ${:configure-command}
make-options = -i -a -n antiloris mod_antiloris.la
make-targets =

[template-apache-backend-conf]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/apache-backend.conf.in
md5sum = 8f1f92ad308ab6bad973c790ee583428
mode = 640