php: Build an even slimmer base

This moves yet more extensions from the base build to
phpPackages.ext. Some of the extensions are a bit quirky and need
patching for this to work, most notably mysqlnd and opcache.

Two new parameters are introduced for mkExtension - internalDeps and
postPhpize. internalDeps is used to specify which other internal
extensions the current extension depends on, in order to provide them
at build time. postPhpize is for when patches and quirks need to be
applied after running phpize.

Patch notes:

- For opcache, older versions of PHP have a bug where header files are
  included in the wrong order.

- For mysqlnd, the config.h is never included, so we include it in the
  main header file, mysqlnd.h. Also, the configure script doesn't add
  the necessary library link flags, so we add them to the variable
  configure should have added them to.
This commit is contained in:
talyz
2020-04-03 10:11:13 +02:00
committed by Elis Hirwing
parent da8ca2be2f
commit 282337799b
2 changed files with 118 additions and 44 deletions
+9 -29
View File
@@ -1,8 +1,8 @@
# pcre functionality is tested in nixos/tests/php-pcre.nix
{ callPackage, config, fetchurl, lib, makeWrapper, stdenv, symlinkJoin, writeText
, autoconf, automake, bison, flex, libtool, pkgconfig, re2c
, apacheHttpd, gettext, libargon2, libxml2, openssl, pcre, pcre2, readline
, sqlite, systemd, valgrind, zlib, oniguruma }:
{ callPackage, config, fetchurl, lib, makeWrapper, stdenv, symlinkJoin
, writeText , autoconf, automake, bison, flex, libtool, pkgconfig, re2c
, apacheHttpd, libargon2, libxml2, pcre, pcre2 , systemd, valgrind
}:
let
generic =
@@ -10,9 +10,6 @@ let
, sha256
, extraPatches ? []
# Build a minimal php
, minimalBuild ? config.php.minimal or false
# Sapi flags
, cgiSupport ? config.php.cgi or true
, cliSupport ? config.php.cli or true
@@ -42,17 +39,9 @@ let
nativeBuildInputs = [ autoconf automake bison flex libtool pkgconfig re2c ];
buildInputs = [ ]
# Deps for some base extensions
++ [ gettext ] # Gettext extension
++ [ openssl openssl.dev ] # Openssl extension
++ [ pcre' ] # PCRE extension
++ [ readline ] # Readline extension
++ [ zlib ] # Zlib extension
++ [ oniguruma ] # mbstring extension
# Deps needed when building all default extensions
++ lib.optionals (!minimalBuild) [ sqlite ]
buildInputs =
# PCRE extension
[ pcre' ]
# Enable sapis
++ lib.optional pearSupport [ libxml2.dev ]
@@ -66,18 +55,9 @@ let
CXXFLAGS = lib.optionalString stdenv.cc.isClang "-std=c++11";
configureFlags = []
configureFlags =
# Disable all extensions
++ lib.optional minimalBuild [ "--disable-all" ]
# A bunch of base extensions
++ [ "--with-gettext=${gettext}" ]
++ [ "--with-openssl" ]
++ [ "--with-readline=${readline.dev}" ]
++ [ "--with-zlib=${zlib.dev}" ]
++ [ "--enable-mysqlnd" ] # Required to be able to build mysqli and pdo_mysql
++ [ "--enable-sockets" ]
++ [ "--enable-mbstring" ]
[ "--disable-all" ]
# PCRE
++ lib.optionals (lib.versionAtLeast version "7.4") [ "--with-external-pcre=${pcre'.dev}" ]