Merge pull request #75451 from Izorkin/php-build
Update php build configuration
This commit is contained in:
commit
21baef32d5
@ -1,9 +1,11 @@
|
|||||||
# pcre functionality is tested in nixos/tests/php-pcre.nix
|
# pcre functionality is tested in nixos/tests/php-pcre.nix
|
||||||
{ lib, stdenv, fetchurl, autoconf, bison, libtool, pkgconfig, re2c
|
{ config, lib, stdenv, fetchurl
|
||||||
, libmysqlclient, libxml2, readline, zlib, curl, postgresql, gettext
|
, autoconf, automake, bison, file, flex, libtool, pkgconfig, re2c
|
||||||
, openssl, pcre, pcre2, sqlite, config, libjpeg, libpng, freetype
|
, libxml2, readline, zlib, curl, postgresql, gettext
|
||||||
|
, openssl, pcre, pcre2, sqlite
|
||||||
, libxslt, libmcrypt, bzip2, icu, openldap, cyrus_sasl, libmhash, unixODBC
|
, libxslt, libmcrypt, bzip2, icu, openldap, cyrus_sasl, libmhash, unixODBC
|
||||||
, uwimap, pam, gmp, apacheHttpd, libiconv, systemd, libsodium, html-tidy, libargon2
|
, uwimap, pam, gmp, apacheHttpd, libiconv, systemd, libsodium, html-tidy, libargon2
|
||||||
|
, gd, freetype, libXpm, libjpeg, libpng, libwebp
|
||||||
, libzip, valgrind, oniguruma
|
, libzip, valgrind, oniguruma
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -19,8 +21,8 @@ let
|
|||||||
, ldapSupport ? config.php.ldap or true
|
, ldapSupport ? config.php.ldap or true
|
||||||
, mhashSupport ? config.php.mhash or false
|
, mhashSupport ? config.php.mhash or false
|
||||||
, mysqlndSupport ? config.php.mysqlnd or true
|
, mysqlndSupport ? config.php.mysqlnd or true
|
||||||
, mysqliSupport ? config.php.mysqli or true
|
, mysqliSupport ? (config.php.mysqli or true) && (mysqlndSupport)
|
||||||
, pdo_mysqlSupport ? config.php.pdo_mysql or true
|
, pdo_mysqlSupport ? (config.php.pdo_mysql or true) && (mysqlndSupport)
|
||||||
, libxml2Support ? config.php.libxml2 or true
|
, libxml2Support ? config.php.libxml2 or true
|
||||||
, apxs2Support ? config.php.apxs2 or (!stdenv.isDarwin)
|
, apxs2Support ? config.php.apxs2 or (!stdenv.isDarwin)
|
||||||
, embedSupport ? config.php.embed or false
|
, embedSupport ? config.php.embed or false
|
||||||
@ -61,20 +63,24 @@ let
|
|||||||
, xmlrpcSupport ? (config.php.xmlrpc or false) && (libxml2Support)
|
, xmlrpcSupport ? (config.php.xmlrpc or false) && (libxml2Support)
|
||||||
, cgotoSupport ? config.php.cgoto or false
|
, cgotoSupport ? config.php.cgoto or false
|
||||||
, valgrindSupport ? (config.php.valgrind or true) && (versionAtLeast version "7.2")
|
, valgrindSupport ? (config.php.valgrind or true) && (versionAtLeast version "7.2")
|
||||||
|
, ipv6Support ? config.php.ipv6 or true
|
||||||
|
, pearSupport ? (config.php.pear or true) && (libxml2Support)
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
mysqlBuildInputs = optional (!mysqlndSupport) libmysqlclient;
|
|
||||||
libmcrypt' = libmcrypt.override { disablePosixThreads = true; };
|
libmcrypt' = libmcrypt.override { disablePosixThreads = true; };
|
||||||
in stdenv.mkDerivation {
|
in stdenv.mkDerivation {
|
||||||
|
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
name = "php-${version}";
|
pname = "php";
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
nativeBuildInputs = [ autoconf bison libtool pkgconfig re2c ];
|
nativeBuildInputs = [
|
||||||
|
autoconf automake bison file flex libtool pkgconfig re2c
|
||||||
|
];
|
||||||
|
|
||||||
buildInputs = [ ]
|
buildInputs = [ ]
|
||||||
++ optional (versionOlder version "7.3") pcre
|
++ optional (versionOlder version "7.3") pcre
|
||||||
++ optional (versionAtLeast version "7.3") pcre2
|
++ optional (versionAtLeast version "7.3") pcre2
|
||||||
@ -83,7 +89,7 @@ let
|
|||||||
++ optionals imapSupport [ uwimap openssl pam ]
|
++ optionals imapSupport [ uwimap openssl pam ]
|
||||||
++ optionals curlSupport [ curl openssl ]
|
++ optionals curlSupport [ curl openssl ]
|
||||||
++ optionals ldapSupport [ openldap openssl ]
|
++ optionals ldapSupport [ openldap openssl ]
|
||||||
++ optionals gdSupport [ libpng libjpeg freetype ]
|
++ optionals gdSupport [ gd freetype libXpm libjpeg libpng libwebp ]
|
||||||
++ optionals opensslSupport [ openssl openssl.dev ]
|
++ optionals opensslSupport [ openssl openssl.dev ]
|
||||||
++ optional apxs2Support apacheHttpd
|
++ optional apxs2Support apacheHttpd
|
||||||
++ optional (ldapSupport && stdenv.isLinux) cyrus_sasl
|
++ optional (ldapSupport && stdenv.isLinux) cyrus_sasl
|
||||||
@ -95,8 +101,6 @@ let
|
|||||||
++ optional postgresqlSupport postgresql
|
++ optional postgresqlSupport postgresql
|
||||||
++ optional pdo_odbcSupport unixODBC
|
++ optional pdo_odbcSupport unixODBC
|
||||||
++ optional pdo_pgsqlSupport postgresql
|
++ optional pdo_pgsqlSupport postgresql
|
||||||
++ optionals pdo_mysqlSupport mysqlBuildInputs
|
|
||||||
++ optionals mysqliSupport mysqlBuildInputs
|
|
||||||
++ optional gmpSupport gmp
|
++ optional gmpSupport gmp
|
||||||
++ optional gettextSupport gettext
|
++ optional gettextSupport gettext
|
||||||
++ optional intlSupport icu
|
++ optional intlSupport icu
|
||||||
@ -138,7 +142,6 @@ let
|
|||||||
++ optional (libxml2Support && (versionOlder version "7.4")) "--with-libxml-dir=${libxml2.dev}"
|
++ optional (libxml2Support && (versionOlder version "7.4")) "--with-libxml-dir=${libxml2.dev}"
|
||||||
++ optional (!libxml2Support) [
|
++ optional (!libxml2Support) [
|
||||||
"--disable-dom"
|
"--disable-dom"
|
||||||
"--disable-libxml"
|
|
||||||
(if (versionOlder version "7.4") then "--disable-libxml" else "--without-libxml")
|
(if (versionOlder version "7.4") then "--disable-libxml" else "--without-libxml")
|
||||||
"--disable-simplexml"
|
"--disable-simplexml"
|
||||||
"--disable-xml"
|
"--disable-xml"
|
||||||
@ -152,23 +155,26 @@ let
|
|||||||
++ optional postgresqlSupport "--with-pgsql=${postgresql}"
|
++ optional postgresqlSupport "--with-pgsql=${postgresql}"
|
||||||
++ optional pdo_odbcSupport "--with-pdo-odbc=unixODBC,${unixODBC}"
|
++ optional pdo_odbcSupport "--with-pdo-odbc=unixODBC,${unixODBC}"
|
||||||
++ optional pdo_pgsqlSupport "--with-pdo-pgsql=${postgresql}"
|
++ optional pdo_pgsqlSupport "--with-pdo-pgsql=${postgresql}"
|
||||||
++ optional pdo_mysqlSupport "--with-pdo-mysql=${if mysqlndSupport then "mysqlnd" else libmysqlclient}"
|
++ optional (pdo_mysqlSupport && mysqlndSupport) "--with-pdo-mysql=mysqlnd"
|
||||||
++ optionals mysqliSupport [
|
++ optional (mysqliSupport && mysqlndSupport) "--with-mysqli=mysqlnd"
|
||||||
"--with-mysqli=${if mysqlndSupport then "mysqlnd" else "${libmysqlclient}/bin/mysql_config"}"
|
++ optional (pdo_mysqlSupport || mysqliSupport) "--with-mysql-sock=/run/mysqld/mysqld.sock"
|
||||||
]
|
|
||||||
++ optional ( pdo_mysqlSupport || mysqliSupport ) "--with-mysql-sock=/run/mysqld/mysqld.sock"
|
|
||||||
++ optional bcmathSupport "--enable-bcmath"
|
++ optional bcmathSupport "--enable-bcmath"
|
||||||
# FIXME: Our own gd package doesn't work, see https://bugs.php.net/bug.php?id=60108.
|
|
||||||
++ optionals (gdSupport && versionAtLeast version "7.4") [
|
++ optionals (gdSupport && versionAtLeast version "7.4") [
|
||||||
"--enable-gd"
|
"--enable-gd"
|
||||||
|
"--with-external-gd=${gd.dev}"
|
||||||
|
"--with-webp=${libwebp}"
|
||||||
"--with-jpeg=${libjpeg.dev}"
|
"--with-jpeg=${libjpeg.dev}"
|
||||||
|
"--with-xpm=${libXpm.dev}"
|
||||||
"--with-freetype=${freetype.dev}"
|
"--with-freetype=${freetype.dev}"
|
||||||
"--enable-gd-jis-conv"
|
"--enable-gd-jis-conv"
|
||||||
] ++ optionals (gdSupport && versionOlder version "7.4") [
|
] ++ optionals (gdSupport && versionOlder version "7.4") [
|
||||||
"--with-gd"
|
"--with-gd=${gd.dev}"
|
||||||
"--with-freetype-dir=${freetype.dev}"
|
"--with-webp-dir=${libwebp}"
|
||||||
"--with-png-dir=${libpng.dev}"
|
|
||||||
"--with-jpeg-dir=${libjpeg.dev}"
|
"--with-jpeg-dir=${libjpeg.dev}"
|
||||||
|
"--with-png-dir=${libpng.dev}"
|
||||||
|
"--with-freetype-dir=${freetype.dev}"
|
||||||
|
"--with-xpm-dir=${libXpm.dev}"
|
||||||
|
"--enable-gd-jis-conv"
|
||||||
]
|
]
|
||||||
++ optional gmpSupport "--with-gmp=${gmp.dev}"
|
++ optional gmpSupport "--with-gmp=${gmp.dev}"
|
||||||
++ optional soapSupport "--enable-soap"
|
++ optional soapSupport "--enable-soap"
|
||||||
@ -198,7 +204,9 @@ let
|
|||||||
++ optional (!pharSupport) "--disable-phar"
|
++ optional (!pharSupport) "--disable-phar"
|
||||||
++ optional xmlrpcSupport "--with-xmlrpc"
|
++ optional xmlrpcSupport "--with-xmlrpc"
|
||||||
++ optional cgotoSupport "--enable-re2c-cgoto"
|
++ optional cgotoSupport "--enable-re2c-cgoto"
|
||||||
++ optional valgrindSupport "--with-valgrind=${valgrind.dev}";
|
++ optional valgrindSupport "--with-valgrind=${valgrind.dev}"
|
||||||
|
++ optional (!ipv6Support) "--disable-ipv6"
|
||||||
|
++ optional (pearSupport && libxml2Support) "--with-pear=$(out)/lib/php/pear";
|
||||||
|
|
||||||
hardeningDisable = [ "bindnow" ];
|
hardeningDisable = [ "bindnow" ];
|
||||||
|
|
||||||
@ -212,14 +220,17 @@ let
|
|||||||
--replace '@PHP_LDFLAGS@' ""
|
--replace '@PHP_LDFLAGS@' ""
|
||||||
done
|
done
|
||||||
|
|
||||||
#[[ -z "$libxml2" ]] || addToSearchPath PATH $libxml2/bin
|
substituteInPlace ./build/libtool.m4 --replace /usr/bin/file ${file}/bin/file
|
||||||
|
|
||||||
export EXTENSION_DIR=$out/lib/php/extensions
|
export EXTENSION_DIR=$out/lib/php/extensions
|
||||||
|
|
||||||
configureFlags+=(--with-config-file-path=$out/etc \
|
./buildconf --copy --force
|
||||||
--includedir=$dev/include)
|
|
||||||
|
|
||||||
./buildconf --force
|
if test -f $src/genfiles; then
|
||||||
|
./genfiles
|
||||||
|
fi
|
||||||
|
'' + optionalString stdenv.isDarwin ''
|
||||||
|
substituteInPlace configure --replace "-lstdc++" "-lc++"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
@ -231,8 +242,8 @@ let
|
|||||||
mkdir -p $dev/bin $dev/share/man/man1
|
mkdir -p $dev/bin $dev/share/man/man1
|
||||||
mv $out/bin/phpize $out/bin/php-config $dev/bin/
|
mv $out/bin/phpize $out/bin/php-config $dev/bin/
|
||||||
mv $out/share/man/man1/phpize.1.gz \
|
mv $out/share/man/man1/phpize.1.gz \
|
||||||
$out/share/man/man1/php-config.1.gz \
|
$out/share/man/man1/php-config.1.gz \
|
||||||
$dev/share/man/man1/
|
$dev/share/man/man1/
|
||||||
'';
|
'';
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
@ -251,10 +262,6 @@ let
|
|||||||
|
|
||||||
patches = [ ./fix-paths-php7.patch ] ++ extraPatches;
|
patches = [ ./fix-paths-php7.patch ] ++ extraPatches;
|
||||||
|
|
||||||
postPatch = optional stdenv.isDarwin ''
|
|
||||||
substituteInPlace configure --replace "-lstdc++" "-lc++"
|
|
||||||
'';
|
|
||||||
|
|
||||||
stripDebugList = "bin sbin lib modules";
|
stripDebugList = "bin sbin lib modules";
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
outputs = [ "out" "dev" ];
|
||||||
|
Loading…
Reference in New Issue
Block a user