mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-20 12:42:24 +00:00
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
|
||||
{ lib, stdenv, fetchurl, autoconf, bison, libtool, pkgconfig, re2c
|
||||
, libmysqlclient, libxml2, readline, zlib, curl, postgresql, gettext
|
||||
, openssl, pcre, pcre2, sqlite, config, libjpeg, libpng, freetype
|
||||
{ config, lib, stdenv, fetchurl
|
||||
, autoconf, automake, bison, file, flex, libtool, pkgconfig, re2c
|
||||
, libxml2, readline, zlib, curl, postgresql, gettext
|
||||
, openssl, pcre, pcre2, sqlite
|
||||
, libxslt, libmcrypt, bzip2, icu, openldap, cyrus_sasl, libmhash, unixODBC
|
||||
, uwimap, pam, gmp, apacheHttpd, libiconv, systemd, libsodium, html-tidy, libargon2
|
||||
, gd, freetype, libXpm, libjpeg, libpng, libwebp
|
||||
, libzip, valgrind, oniguruma
|
||||
}:
|
||||
|
||||
|
@ -19,8 +21,8 @@ let
|
|||
, ldapSupport ? config.php.ldap or true
|
||||
, mhashSupport ? config.php.mhash or false
|
||||
, mysqlndSupport ? config.php.mysqlnd or true
|
||||
, mysqliSupport ? config.php.mysqli or true
|
||||
, pdo_mysqlSupport ? config.php.pdo_mysql or true
|
||||
, mysqliSupport ? (config.php.mysqli or true) && (mysqlndSupport)
|
||||
, pdo_mysqlSupport ? (config.php.pdo_mysql or true) && (mysqlndSupport)
|
||||
, libxml2Support ? config.php.libxml2 or true
|
||||
, apxs2Support ? config.php.apxs2 or (!stdenv.isDarwin)
|
||||
, embedSupport ? config.php.embed or false
|
||||
|
@ -61,20 +63,24 @@ let
|
|||
, xmlrpcSupport ? (config.php.xmlrpc or false) && (libxml2Support)
|
||||
, cgotoSupport ? config.php.cgoto or false
|
||||
, valgrindSupport ? (config.php.valgrind or true) && (versionAtLeast version "7.2")
|
||||
, ipv6Support ? config.php.ipv6 or true
|
||||
, pearSupport ? (config.php.pear or true) && (libxml2Support)
|
||||
}:
|
||||
|
||||
let
|
||||
mysqlBuildInputs = optional (!mysqlndSupport) libmysqlclient;
|
||||
libmcrypt' = libmcrypt.override { disablePosixThreads = true; };
|
||||
in stdenv.mkDerivation {
|
||||
|
||||
inherit version;
|
||||
|
||||
name = "php-${version}";
|
||||
pname = "php";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
nativeBuildInputs = [ autoconf bison libtool pkgconfig re2c ];
|
||||
nativeBuildInputs = [
|
||||
autoconf automake bison file flex libtool pkgconfig re2c
|
||||
];
|
||||
|
||||
buildInputs = [ ]
|
||||
++ optional (versionOlder version "7.3") pcre
|
||||
++ optional (versionAtLeast version "7.3") pcre2
|
||||
|
@ -83,7 +89,7 @@ let
|
|||
++ optionals imapSupport [ uwimap openssl pam ]
|
||||
++ optionals curlSupport [ curl openssl ]
|
||||
++ optionals ldapSupport [ openldap openssl ]
|
||||
++ optionals gdSupport [ libpng libjpeg freetype ]
|
||||
++ optionals gdSupport [ gd freetype libXpm libjpeg libpng libwebp ]
|
||||
++ optionals opensslSupport [ openssl openssl.dev ]
|
||||
++ optional apxs2Support apacheHttpd
|
||||
++ optional (ldapSupport && stdenv.isLinux) cyrus_sasl
|
||||
|
@ -95,8 +101,6 @@ let
|
|||
++ optional postgresqlSupport postgresql
|
||||
++ optional pdo_odbcSupport unixODBC
|
||||
++ optional pdo_pgsqlSupport postgresql
|
||||
++ optionals pdo_mysqlSupport mysqlBuildInputs
|
||||
++ optionals mysqliSupport mysqlBuildInputs
|
||||
++ optional gmpSupport gmp
|
||||
++ optional gettextSupport gettext
|
||||
++ optional intlSupport icu
|
||||
|
@ -138,7 +142,6 @@ let
|
|||
++ optional (libxml2Support && (versionOlder version "7.4")) "--with-libxml-dir=${libxml2.dev}"
|
||||
++ optional (!libxml2Support) [
|
||||
"--disable-dom"
|
||||
"--disable-libxml"
|
||||
(if (versionOlder version "7.4") then "--disable-libxml" else "--without-libxml")
|
||||
"--disable-simplexml"
|
||||
"--disable-xml"
|
||||
|
@ -152,23 +155,26 @@ let
|
|||
++ optional postgresqlSupport "--with-pgsql=${postgresql}"
|
||||
++ optional pdo_odbcSupport "--with-pdo-odbc=unixODBC,${unixODBC}"
|
||||
++ optional pdo_pgsqlSupport "--with-pdo-pgsql=${postgresql}"
|
||||
++ optional pdo_mysqlSupport "--with-pdo-mysql=${if mysqlndSupport then "mysqlnd" else libmysqlclient}"
|
||||
++ optionals mysqliSupport [
|
||||
"--with-mysqli=${if mysqlndSupport then "mysqlnd" else "${libmysqlclient}/bin/mysql_config"}"
|
||||
]
|
||||
++ optional (pdo_mysqlSupport && mysqlndSupport) "--with-pdo-mysql=mysqlnd"
|
||||
++ optional (mysqliSupport && mysqlndSupport) "--with-mysqli=mysqlnd"
|
||||
++ optional (pdo_mysqlSupport || mysqliSupport) "--with-mysql-sock=/run/mysqld/mysqld.sock"
|
||||
++ 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") [
|
||||
"--enable-gd"
|
||||
"--with-external-gd=${gd.dev}"
|
||||
"--with-webp=${libwebp}"
|
||||
"--with-jpeg=${libjpeg.dev}"
|
||||
"--with-xpm=${libXpm.dev}"
|
||||
"--with-freetype=${freetype.dev}"
|
||||
"--enable-gd-jis-conv"
|
||||
] ++ optionals (gdSupport && versionOlder version "7.4") [
|
||||
"--with-gd"
|
||||
"--with-freetype-dir=${freetype.dev}"
|
||||
"--with-png-dir=${libpng.dev}"
|
||||
"--with-gd=${gd.dev}"
|
||||
"--with-webp-dir=${libwebp}"
|
||||
"--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 soapSupport "--enable-soap"
|
||||
|
@ -198,7 +204,9 @@ let
|
|||
++ optional (!pharSupport) "--disable-phar"
|
||||
++ optional xmlrpcSupport "--with-xmlrpc"
|
||||
++ 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" ];
|
||||
|
||||
|
@ -212,14 +220,17 @@ let
|
|||
--replace '@PHP_LDFLAGS@' ""
|
||||
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
|
||||
|
||||
configureFlags+=(--with-config-file-path=$out/etc \
|
||||
--includedir=$dev/include)
|
||||
./buildconf --copy --force
|
||||
|
||||
./buildconf --force
|
||||
if test -f $src/genfiles; then
|
||||
./genfiles
|
||||
fi
|
||||
'' + optionalString stdenv.isDarwin ''
|
||||
substituteInPlace configure --replace "-lstdc++" "-lc++"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
|
@ -251,10 +262,6 @@ let
|
|||
|
||||
patches = [ ./fix-paths-php7.patch ] ++ extraPatches;
|
||||
|
||||
postPatch = optional stdenv.isDarwin ''
|
||||
substituteInPlace configure --replace "-lstdc++" "-lc++"
|
||||
'';
|
||||
|
||||
stripDebugList = "bin sbin lib modules";
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
|
|
Loading…
Reference in a new issue