php: Re-indent main derivation
This commit is contained in:
parent
6c0fa331f0
commit
da3384a25d
@ -67,58 +67,52 @@ let
|
|||||||
, ipv6Support ? config.php.ipv6 or true
|
, ipv6Support ? config.php.ipv6 or true
|
||||||
, pearSupport ? (config.php.pear or true) && (libxml2Support)
|
, pearSupport ? (config.php.pear or true) && (libxml2Support)
|
||||||
}:
|
}:
|
||||||
|
let
|
||||||
|
libmcrypt' = libmcrypt.override { disablePosixThreads = true; };
|
||||||
|
in stdenv.mkDerivation {
|
||||||
|
pname = "php";
|
||||||
|
|
||||||
let
|
inherit version;
|
||||||
libmcrypt' = libmcrypt.override { disablePosixThreads = true; };
|
|
||||||
in stdenv.mkDerivation {
|
|
||||||
|
|
||||||
inherit version;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
pname = "php";
|
nativeBuildInputs = [ autoconf automake bison file flex libtool pkgconfig re2c ];
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
buildInputs = [ ]
|
||||||
|
++ optional (versionOlder version "7.3") pcre
|
||||||
|
++ optional (versionAtLeast version "7.3") pcre2
|
||||||
|
++ optional (versionAtLeast version "7.4") oniguruma
|
||||||
|
++ optional withSystemd systemd
|
||||||
|
++ optionals imapSupport [ uwimap openssl pam ]
|
||||||
|
++ optionals curlSupport [ curl openssl ]
|
||||||
|
++ optionals ldapSupport [ openldap openssl ]
|
||||||
|
++ optionals gdSupport [ gd freetype libXpm libjpeg libpng libwebp ]
|
||||||
|
++ optionals opensslSupport [ openssl openssl.dev ]
|
||||||
|
++ optional apxs2Support apacheHttpd
|
||||||
|
++ optional (ldapSupport && stdenv.isLinux) cyrus_sasl
|
||||||
|
++ optional mhashSupport libmhash
|
||||||
|
++ optional zlibSupport zlib
|
||||||
|
++ optional libxml2Support libxml2
|
||||||
|
++ optional readlineSupport readline
|
||||||
|
++ optional sqliteSupport sqlite
|
||||||
|
++ optional postgresqlSupport postgresql
|
||||||
|
++ optional pdo_odbcSupport unixODBC
|
||||||
|
++ optional pdo_pgsqlSupport postgresql
|
||||||
|
++ optional gmpSupport gmp
|
||||||
|
++ optional gettextSupport gettext
|
||||||
|
++ optional intlSupport icu
|
||||||
|
++ optional xslSupport libxslt
|
||||||
|
++ optional mcryptSupport libmcrypt'
|
||||||
|
++ optional bz2Support bzip2
|
||||||
|
++ optional sodiumSupport libsodium
|
||||||
|
++ optional tidySupport html-tidy
|
||||||
|
++ optional argon2Support libargon2
|
||||||
|
++ optional libzipSupport libzip
|
||||||
|
++ optional valgrindSupport valgrind;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
CXXFLAGS = optionalString stdenv.cc.isClang "-std=c++11";
|
||||||
autoconf automake bison file flex libtool pkgconfig re2c
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs = [ ]
|
configureFlags = [ "--with-config-file-scan-dir=/etc/php.d" ]
|
||||||
++ optional (versionOlder version "7.3") pcre
|
|
||||||
++ optional (versionAtLeast version "7.3") pcre2
|
|
||||||
++ optional (versionAtLeast version "7.4") oniguruma
|
|
||||||
++ optional withSystemd systemd
|
|
||||||
++ optionals imapSupport [ uwimap openssl pam ]
|
|
||||||
++ optionals curlSupport [ curl openssl ]
|
|
||||||
++ optionals ldapSupport [ openldap openssl ]
|
|
||||||
++ optionals gdSupport [ gd freetype libXpm libjpeg libpng libwebp ]
|
|
||||||
++ optionals opensslSupport [ openssl openssl.dev ]
|
|
||||||
++ optional apxs2Support apacheHttpd
|
|
||||||
++ optional (ldapSupport && stdenv.isLinux) cyrus_sasl
|
|
||||||
++ optional mhashSupport libmhash
|
|
||||||
++ optional zlibSupport zlib
|
|
||||||
++ optional libxml2Support libxml2
|
|
||||||
++ optional readlineSupport readline
|
|
||||||
++ optional sqliteSupport sqlite
|
|
||||||
++ optional postgresqlSupport postgresql
|
|
||||||
++ optional pdo_odbcSupport unixODBC
|
|
||||||
++ optional pdo_pgsqlSupport postgresql
|
|
||||||
++ optional gmpSupport gmp
|
|
||||||
++ optional gettextSupport gettext
|
|
||||||
++ optional intlSupport icu
|
|
||||||
++ optional xslSupport libxslt
|
|
||||||
++ optional mcryptSupport libmcrypt'
|
|
||||||
++ optional bz2Support bzip2
|
|
||||||
++ optional sodiumSupport libsodium
|
|
||||||
++ optional tidySupport html-tidy
|
|
||||||
++ optional argon2Support libargon2
|
|
||||||
++ optional libzipSupport libzip
|
|
||||||
++ optional valgrindSupport valgrind;
|
|
||||||
|
|
||||||
CXXFLAGS = optionalString stdenv.cc.isClang "-std=c++11";
|
|
||||||
|
|
||||||
configureFlags = [
|
|
||||||
"--with-config-file-scan-dir=/etc/php.d"
|
|
||||||
]
|
|
||||||
++ optionals (versionOlder version "7.3") [ "--with-pcre-regex=${pcre.dev}" "PCRE_LIBDIR=${pcre}" ]
|
++ optionals (versionOlder version "7.3") [ "--with-pcre-regex=${pcre.dev}" "PCRE_LIBDIR=${pcre}" ]
|
||||||
++ optionals (versions.majorMinor version == "7.3") [ "--with-pcre-regex=${pcre2.dev}" "PCRE_LIBDIR=${pcre2}" ]
|
++ optionals (versions.majorMinor version == "7.3") [ "--with-pcre-regex=${pcre2.dev}" "PCRE_LIBDIR=${pcre2}" ]
|
||||||
++ optionals (versionAtLeast version "7.4") [ "--with-external-pcre=${pcre2.dev}" "PCRE_LIBDIR=${pcre2}" ]
|
++ optionals (versionAtLeast version "7.4") [ "--with-external-pcre=${pcre2.dev}" "PCRE_LIBDIR=${pcre2}" ]
|
||||||
@ -209,89 +203,88 @@ let
|
|||||||
++ optional (!ipv6Support) "--disable-ipv6"
|
++ optional (!ipv6Support) "--disable-ipv6"
|
||||||
++ optional (pearSupport && libxml2Support) "--with-pear=$(out)/lib/php/pear";
|
++ optional (pearSupport && libxml2Support) "--with-pear=$(out)/lib/php/pear";
|
||||||
|
|
||||||
hardeningDisable = [ "bindnow" ];
|
hardeningDisable = [ "bindnow" ];
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
# Don't record the configure flags since this causes unnecessary
|
# Don't record the configure flags since this causes unnecessary
|
||||||
# runtime dependencies
|
# runtime dependencies
|
||||||
for i in main/build-defs.h.in scripts/php-config.in; do
|
for i in main/build-defs.h.in scripts/php-config.in; do
|
||||||
substituteInPlace $i \
|
substituteInPlace $i \
|
||||||
--replace '@CONFIGURE_COMMAND@' '(omitted)' \
|
--replace '@CONFIGURE_COMMAND@' '(omitted)' \
|
||||||
--replace '@CONFIGURE_OPTIONS@' "" \
|
--replace '@CONFIGURE_OPTIONS@' "" \
|
||||||
--replace '@PHP_LDFLAGS@' ""
|
--replace '@PHP_LDFLAGS@' ""
|
||||||
done
|
done
|
||||||
|
|
||||||
substituteInPlace ./build/libtool.m4 --replace /usr/bin/file ${file}/bin/file
|
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
|
||||||
|
|
||||||
./buildconf --copy --force
|
./buildconf --copy --force
|
||||||
|
|
||||||
if test -f $src/genfiles; then
|
if test -f $src/genfiles; then
|
||||||
./genfiles
|
./genfiles
|
||||||
fi
|
fi
|
||||||
'' + optionalString stdenv.isDarwin ''
|
'' + optionalString stdenv.isDarwin ''
|
||||||
substituteInPlace configure --replace "-lstdc++" "-lc++"
|
substituteInPlace configure --replace "-lstdc++" "-lc++"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
test -d $out/etc || mkdir $out/etc
|
test -d $out/etc || mkdir $out/etc
|
||||||
cp php.ini-production $out/etc/php.ini
|
cp php.ini-production $out/etc/php.ini
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postFixup = ''
|
postFixup = ''
|
||||||
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 {
|
|
||||||
url = "https://www.php.net/distributions/php-${version}.tar.bz2";
|
|
||||||
inherit sha256;
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
|
||||||
description = "An HTML-embedded scripting language";
|
|
||||||
homepage = https://www.php.net/;
|
|
||||||
license = licenses.php301;
|
|
||||||
maintainers = with maintainers; [ globin etu ma27 ];
|
|
||||||
platforms = platforms.all;
|
|
||||||
outputsToInstall = [ "out" "dev" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
patches = [ ./fix-paths-php7.patch ] ++ extraPatches;
|
|
||||||
|
|
||||||
stripDebugList = "bin sbin lib modules";
|
|
||||||
|
|
||||||
outputs = [ "out" "dev" ];
|
|
||||||
|
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://www.php.net/distributions/php-${version}.tar.bz2";
|
||||||
|
inherit sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
generic' = { version, sha256, ... }@args: let php = generic args; in php.overrideAttrs (_: {
|
meta = with stdenv.lib; {
|
||||||
passthru.buildEnv = { exts ? (_: []), extraConfig ? "" }: let
|
description = "An HTML-embedded scripting language";
|
||||||
extraInit = writeText "custom-php.ini" ''
|
homepage = https://www.php.net/;
|
||||||
${extraConfig}
|
license = licenses.php301;
|
||||||
${concatMapStringsSep "\n" (ext: let
|
maintainers = with maintainers; [ globin etu ma27 ];
|
||||||
extName = lib.removePrefix "php-" (builtins.parseDrvName ext.name).name;
|
platforms = platforms.all;
|
||||||
type = "${lib.optionalString (ext.zendExtension or false) "zend_"}extension";
|
outputsToInstall = [ "out" "dev" ];
|
||||||
in ''
|
};
|
||||||
${type}=${ext}/lib/php/extensions/${extName}.so
|
|
||||||
'') (exts (callPackage ../../../top-level/php-packages.nix { inherit php; }))}
|
patches = [ ./fix-paths-php7.patch ] ++ extraPatches;
|
||||||
'';
|
|
||||||
in symlinkJoin {
|
stripDebugList = "bin sbin lib modules";
|
||||||
name = "php-custom-${version}";
|
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
outputs = [ "out" "dev" ];
|
||||||
paths = [ php ];
|
};
|
||||||
postBuild = ''
|
|
||||||
wrapProgram $out/bin/php \
|
generic' = { version, sha256, ... }@args: let php = generic args; in php.overrideAttrs (_: {
|
||||||
--add-flags "-c ${extraInit}"
|
passthru.buildEnv = { exts ? (_: []), extraConfig ? "" }: let
|
||||||
wrapProgram $out/bin/php-fpm \
|
extraInit = writeText "custom-php.ini" ''
|
||||||
--add-flags "-c ${extraInit}"
|
${extraConfig}
|
||||||
'';
|
${concatMapStringsSep "\n" (ext: let
|
||||||
};
|
extName = lib.removePrefix "php-" (builtins.parseDrvName ext.name).name;
|
||||||
});
|
type = "${lib.optionalString (ext.zendExtension or false) "zend_"}extension";
|
||||||
|
in ''
|
||||||
|
${type}=${ext}/lib/php/extensions/${extName}.so
|
||||||
|
'') (exts (callPackage ../../../top-level/php-packages.nix { inherit php; }))}
|
||||||
|
'';
|
||||||
|
in symlinkJoin {
|
||||||
|
name = "php-custom-${version}";
|
||||||
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
|
paths = [ php ];
|
||||||
|
postBuild = ''
|
||||||
|
wrapProgram $out/bin/php \
|
||||||
|
--add-flags "-c ${extraInit}"
|
||||||
|
wrapProgram $out/bin/php-fpm \
|
||||||
|
--add-flags "-c ${extraInit}"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
in {
|
in {
|
||||||
php72 = generic' {
|
php72 = generic' {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user