[buildout]
parts = apache-php

extends =
  ../apache/buildout.cfg
  ../argon2/buildout.cfg
  ../bzip2/buildout.cfg
  ../cclient/buildout.cfg
  ../curl/buildout.cfg
  ../freetype/buildout.cfg
  ../gettext/buildout.cfg
  ../libiconv/buildout.cfg
  ../libjpeg/buildout.cfg
  ../libpng/buildout.cfg
  ../libtool/buildout.cfg
  ../mariadb/buildout.cfg
  ../openldap/buildout.cfg
  ../pkgconfig/buildout.cfg
  ../zlib/buildout.cfg
  ../libzip/buildout.cfg
  ../autoconf/buildout.cfg
  ../automake/buildout.cfg
  ../imagemagick/buildout.cfg
  ../icu/buildout.cfg
  ../openssl/buildout.cfg
  ../libnsl/buildout.cfg
  ../gmp/buildout.cfg
  ../sqlite3/buildout.cfg
  ../oniguruma/buildout.cfg
  ../libsodium/buildout.cfg

[php-redis]
recipe = slapos.recipe.cmmi
url = https://github.com/phpredis/phpredis/archive/5.3.7.tar.gz
md5sum = 38d5f9db6696b26a4b07970ab0421b0c
configure-command =
  phpize && ./configure
environment =
  PATH=${autoconf:location}/bin:${automake:location}/bin:${m4:location}/bin:${apache-php:location}/bin:%(PATH)s

[php-imagick]
recipe = slapos.recipe.cmmi
url = https://github.com/Imagick/imagick/archive/refs/tags/3.7.0.tar.gz
md5sum = 4dbe07a2ef15d3c9e4c54d5685bdfbc9
configure-command =
  phpize && ./configure
configure-options =
  --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
environment =
  PKG_CONFIG_PATH=${imagemagick:location}/lib/pkgconfig
  PATH=${pkgconfig:location}/bin:${imagemagick:location}/bin:${autoconf:location}/bin:${automake:location}/bin:${m4:location}/bin:${apache-php:location}/bin:%(PATH)s
  IM_IMAGEMAGICK_PREFIX=${imagemagick:location}

[php-apcu]
recipe = slapos.recipe.cmmi
url = https://github.com/krakjoe/apcu/archive/v5.1.21.tar.gz
md5sum = 032ef434e2a14942f76b51acaf67fec7
configure-command =
  phpize && ./configure
configure-options =
  --with-php-config=${apache-php:location}/bin/php-config
environment =
  PATH=${autoconf:location}/bin:${automake:location}/bin:${m4:location}/bin:${apache-php:location}/bin:%(PATH)s


[apache]
# apache-php will write in apache folder, so we cannot share apache if apache-php is used.
shared = false

[apache-php7]
recipe = slapos.recipe.cmmi
url = https://www.php.net/distributions/php-7.4.33.tar.bz2
md5sum = 6d1bc534ddc97848251bf29bb30da74f
configure-options =
  --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
  --with-apxs2=${apache:location}/bin/apxs
  --with-mysql=${mariadb:location}
  --with-bz2=${bzip2:location}
  --enable-gd
  --with-jpeg
  --with-freetype
  --with-pdo-mysql=mysqlnd
  --with-mysqli=mysqlnd
  --with-curl
  --with-imap=${cclient:location}
  --with-iconv-dir=${libiconv:location}
  --with-gettext=${gettext:location}
  --with-ldap=${openldap:location}
  --with-imap-ssl
  --with-openssl=${openssl:location}
  --with-password-argon2=${argon2:location}
  --with-gmp=${gmp:location}
  --with-zlib=${zlib:location}
  --with-sodium=${libsodium:location}
  --with-zip
  --enable-apcu-bc
  --enable-bcmath
  --enable-intl
  --enable-libxml
  --enable-json
  --enable-mbstring
  --enable-pcntl
  --enable-session
  --enable-exif
  --enable-ftp
  --disable-zend-test
  --disable-static

# Changing TMPDIR is required for PEAR installation.
# It will create a pear/temp directory under the SR instead of a shared /tmp/pear/temp.
# XXX we could mkdir tmp there

environment =
  PKG_CONFIG_PATH=${zlib:location}/lib/pkgconfig:${oniguruma:location}/lib/pkgconfig:${icu:location}/lib/pkgconfig:${curl:location}/lib/pkgconfig:${sqlite3:location}/lib/pkgconfig:${libxml2:location}/lib/pkgconfig:${openssl:location}/lib/pkgconfig:${libzip:location}/lib/pkgconfig:${libpng:location}/lib/pkgconfig:${libjpeg:location}/lib/pkgconfig:${freetype:location}/lib/pkgconfig:${argon2:location}/lib/x86_64-linux-gnu/pkgconfig:${libsodium:location}/lib/pkgconfig
  PATH=${pkgconfig:location}/bin:${bzip2:location}/bin:${libxml2:location}/bin:%(PATH)s
  CPPFLAGS=-I${libzip:location}/include
  LDFLAGS=-L${bzip2:location}/lib -Wl,-rpath -Wl,${bzip2:location}/lib -Wl,-rpath -Wl,${curl:location}/lib -L${libtool:location}/lib -Wl,-rpath -Wl,${libtool:location}/lib -L${mariadb:location}/lib -Wl,-rpath -Wl,${mariadb:location}/lib -L${zlib:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib -L${libzip:location}/lib -Wl,-rpath -Wl,${libzip:location}/lib -L${argon2:location}/lib/x86_64-linux-gnu -Wl,-rpath -Wl,${argon2:location}/lib/x86_64-linux-gnu -Wl,-rpath -Wl,${zstd:location}/lib -L${libnsl:location}/lib -Wl,-rpath -Wl,${libnsl:location}/lib -L${libpng:location}/lib -Wl,-rpath -Wl,${libpng:location}/lib
  TMPDIR=${buildout:parts-directory}/${:_buildout_section_name_}
  HOME=${apache:location}

[xml-rpc]
recipe = slapos.recipe.cmmi
url = http://downloads.sourceforge.net/project/phpxmlrpc/phpxmlrpc/2.2.2/xmlrpc-2.2.2.tar.gz
md5sum = 59a644c636c6d98267d0c99b406ae9e8


[apache-php8]
<= apache-php7
url = https://www.php.net/distributions/php-8.2.2.tar.bz2
md5sum = 2a45250d2f073aa7698db5c3bc4d6d29

[apache-php8.1]
<= apache-php7
url = https://www.php.net/distributions/php-8.1.18.tar.xz
md5sum = b6a290905d0851cb999a1d9d5e2a24c1

[apache-php]
<= apache-php8

# Older version of php, but required for drupal8
[apache-php7.2]
recipe = slapos.recipe.cmmi
url = https://www.php.net/distributions/php-7.2.30.tar.xz
md5sum = 8c1ddec2683b82adb5b7e9d9646027d5
configure-options =
  --prefix=${buildout:parts-directory}/${:_buildout_section_name_}
  --with-apxs2=${apache:location}/bin/apxs
  --with-libxml-dir=${libxml2:location}
  --with-mysql=${mariadb:location}
  --with-zlib-dir=${zlib:location}
  --with-bz2=${bzip2:location}
  --with-gd
  --with-jpeg-dir=${libjpeg:location}
  --with-png-dir=${libpng:location}
  --enable-gd-native-ttf
  --with-freetype-dir=${freetype:location}
  --with-pdo-mysql=mysqlnd
  --with-mysqli=mysqlnd
  --with-curl=${curl:location}
  --with-imap=${cclient:location}
  --with-iconv-dir=${libiconv:location}
  --with-gettext=${gettext:location}
  --with-ldap=${openldap:location}
  --with-imap-ssl
  --with-openssl=${openssl:location}
  --with-libzip=${libzip:location}
  --with-icu-dir=${icu:location}
  --with-password-argon2=${argon2:location}
  --enable-apcu-bc
  --enable-intl
  --enable-libxml
  --enable-json
  --enable-mbstring
  --enable-pcntl
  --enable-session
  --enable-exif
  --enable-ftp
  --enable-zip
  --disable-zend-test
  --disable-static

# Changing TMPDIR is required for PEAR installation.
# It will create a pear/temp directory under the SR instead of a shared /tmp/pear/temp.
# XXX we could mkdir tmp there

environment =
  PKG_CONFIG_PATH=${libxml2:location}/lib/pkgconfig:${openssl:location}/lib/pkgconfig:${libzip:location}/lib/pkgconfig
  PATH=${pkgconfig:location}/bin:${bzip2:location}/bin:${libxml2:location}/bin:%(PATH)s
  CPPFLAGS=-I${libzip:location}/include
  LDFLAGS=-L${bzip2:location}/lib -Wl,-rpath -Wl,${bzip2:location}/lib -Wl,-rpath -Wl,${curl:location}/lib -L${libtool:location}/lib -Wl,-rpath -Wl,${libtool:location}/lib -L${mariadb:location}/lib -Wl,-rpath -Wl,${mariadb:location}/lib -L${zlib:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib -L${libzip:location}/lib -Wl,-rpath -Wl,${libzip:location}/lib -L${argon2:location}/lib/x86_64-linux-gnu -Wl,-rpath -Wl,${argon2:location}/lib/x86_64-linux-gnu -Wl,-rpath -Wl,${zstd:location}/lib -L${libnsl:location}/lib -Wl,-rpath -Wl,${libnsl:location}/lib
  TMPDIR=${buildout:parts-directory}/${:_buildout_section_name_}
  HOME=${apache:location}