2012-10-15 17:14:26 +02:00
|
|
|
{ stdenv, fetchurl, composableDerivation, autoconf, automake, flex, bison
|
2012-12-01 21:17:50 +01:00
|
|
|
, apacheHttpd, mysql, libxml2, readline, zlib, curl, gd, postgresql, gettext
|
2013-06-15 13:57:05 +02:00
|
|
|
, openssl, pkgconfig, sqlite, config, libjpeg, libpng, freetype, libxslt
|
2013-06-24 14:32:02 +02:00
|
|
|
, libmcrypt, bzip2, icu, libssh2, makeWrapper, libiconvOrEmpty, libiconv, uwimap
|
|
|
|
, pam }:
|
2013-02-12 19:33:39 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
libmcryptOverride = libmcrypt.override { disablePosixThreads = true; };
|
|
|
|
in
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2012-10-15 17:14:26 +02:00
|
|
|
composableDerivation.composableDerivation {} ( fixed : let inherit (fixed.fixed) version; in {
|
2010-05-29 20:26:54 +02:00
|
|
|
|
2013-07-16 22:53:06 +02:00
|
|
|
version = "5.3.27";
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2011-07-18 22:50:59 +02:00
|
|
|
name = "php-${version}";
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2012-10-15 17:14:26 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2013-06-15 13:57:05 +02:00
|
|
|
buildInputs
|
|
|
|
= [ flex bison pkgconfig ]
|
|
|
|
++ stdenv.lib.optionals stdenv.isDarwin [ libssh2 makeWrapper ];
|
|
|
|
|
|
|
|
# need to include the C++ standard library when compiling on darwin
|
|
|
|
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-lstdc++";
|
|
|
|
|
|
|
|
# need to specify where the dylib for icu is stored
|
|
|
|
DYLD_LIBRARY_PATH = stdenv.lib.optionalString stdenv.isDarwin "${icu}/lib";
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
flags = {
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2012-10-15 17:14:26 +02:00
|
|
|
# much left to do here...
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
# SAPI modules:
|
2012-10-15 17:14:26 +02:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
apxs2 = {
|
|
|
|
configureFlags = ["--with-apxs2=${apacheHttpd}/bin/apxs"];
|
|
|
|
buildInputs = [apacheHttpd];
|
|
|
|
};
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
# Extensions
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
curl = {
|
2012-10-15 17:14:26 +02:00
|
|
|
configureFlags = ["--with-curl=${curl}" "--with-curlwrappers"];
|
2009-04-27 03:18:03 +02:00
|
|
|
buildInputs = [curl openssl];
|
2009-03-07 00:21:28 +01:00
|
|
|
};
|
2012-10-15 17:14:26 +02:00
|
|
|
|
2013-06-20 09:42:09 +02:00
|
|
|
pcntl = {
|
|
|
|
configureFlags = [ "--enable-pcntl" ];
|
|
|
|
};
|
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
zlib = {
|
2012-10-15 17:14:26 +02:00
|
|
|
configureFlags = ["--with-zlib=${zlib}"];
|
2009-03-07 00:21:28 +01:00
|
|
|
buildInputs = [zlib];
|
|
|
|
};
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
libxml2 = {
|
2013-06-15 13:57:05 +02:00
|
|
|
configureFlags
|
|
|
|
= [ "--with-libxml-dir=${libxml2}" ]
|
|
|
|
++ stdenv.lib.optional (libiconvOrEmpty != [])
|
|
|
|
[ "--with-iconv=${libiconv}" ];
|
|
|
|
buildInputs = [ libxml2 ] ++ libiconvOrEmpty;
|
2009-03-07 00:21:28 +01:00
|
|
|
};
|
2012-10-15 17:14:26 +02:00
|
|
|
|
2011-05-03 10:25:45 +02:00
|
|
|
readline = {
|
|
|
|
configureFlags = ["--with-readline=${readline}"];
|
|
|
|
buildInputs = [ readline ];
|
|
|
|
};
|
|
|
|
|
2009-05-13 12:43:34 +02:00
|
|
|
sqlite = {
|
|
|
|
configureFlags = ["--with-pdo-sqlite=${sqlite}"];
|
|
|
|
buildInputs = [ sqlite ];
|
|
|
|
};
|
2012-10-15 17:14:26 +02:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
postgresql = {
|
|
|
|
configureFlags = ["--with-pgsql=${postgresql}"];
|
|
|
|
buildInputs = [ postgresql ];
|
|
|
|
};
|
2012-10-15 17:14:26 +02:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
mysql = {
|
|
|
|
configureFlags = ["--with-mysql=${mysql}"];
|
|
|
|
buildInputs = [ mysql ];
|
|
|
|
};
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
mysqli = {
|
|
|
|
configureFlags = ["--with-mysqli=${mysql}/bin/mysql_config"];
|
|
|
|
buildInputs = [ mysql];
|
|
|
|
};
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
mysqli_embedded = {
|
|
|
|
configureFlags = ["--enable-embedded-mysqli"];
|
|
|
|
depends = "mysqli";
|
|
|
|
assertion = fixed.mysqliSupport;
|
|
|
|
};
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
pdo_mysql = {
|
|
|
|
configureFlags = ["--with-pdo-mysql=${mysql}"];
|
|
|
|
buildInputs = [ mysql ];
|
|
|
|
};
|
2012-10-15 17:14:26 +02:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
bcmath = {
|
|
|
|
configureFlags = ["--enable-bcmath"];
|
|
|
|
};
|
2008-08-31 08:36:56 +02:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
gd = {
|
2013-06-15 13:57:05 +02:00
|
|
|
configureFlags = [
|
2013-06-20 09:45:29 +02:00
|
|
|
"--with-gd=${gd}"
|
2013-06-15 13:57:05 +02:00
|
|
|
"--with-freetype-dir=${freetype}"
|
|
|
|
"--with-png-dir=${libpng}"
|
|
|
|
"--with-jpeg-dir=${libjpeg}"
|
|
|
|
];
|
2012-12-01 21:17:50 +01:00
|
|
|
buildInputs = [gd libpng libjpeg freetype];
|
2009-03-07 00:21:28 +01:00
|
|
|
};
|
2008-08-31 08:36:56 +02:00
|
|
|
|
2009-06-14 03:30:04 +02:00
|
|
|
soap = {
|
|
|
|
configureFlags = ["--enable-soap"];
|
|
|
|
};
|
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
sockets = {
|
|
|
|
configureFlags = ["--enable-sockets"];
|
|
|
|
};
|
2009-01-04 21:18:20 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
openssl = {
|
2012-10-15 17:14:26 +02:00
|
|
|
configureFlags = ["--with-openssl=${openssl}"];
|
2009-03-07 00:21:28 +01:00
|
|
|
buildInputs = ["openssl"];
|
2008-06-06 15:03:55 +02:00
|
|
|
};
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
mbstring = {
|
|
|
|
configureFlags = ["--enable-mbstring"];
|
|
|
|
};
|
2012-12-01 21:17:50 +01:00
|
|
|
|
|
|
|
gettext = {
|
|
|
|
configureFlags = ["--with-gettext=${gettext}"];
|
|
|
|
buildInputs = [gettext];
|
|
|
|
};
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2013-06-24 14:32:02 +02:00
|
|
|
imap = {
|
2013-07-14 03:47:14 +02:00
|
|
|
configureFlags = [ "--with-imap=${uwimap}" "--with-imap-ssl" ]
|
|
|
|
# uwimap builds with kerberos on darwin
|
|
|
|
++ stdenv.lib.optional (stdenv.isDarwin) "--with-kerberos";
|
|
|
|
buildInputs = [ uwimap openssl ]
|
|
|
|
++ stdenv.lib.optional (!stdenv.isDarwin) pam;
|
2013-06-24 14:32:02 +02:00
|
|
|
};
|
|
|
|
|
2013-01-26 13:17:31 +01:00
|
|
|
intl = {
|
|
|
|
configureFlags = ["--enable-intl"];
|
|
|
|
buildInputs = [icu];
|
|
|
|
};
|
|
|
|
|
|
|
|
exif = {
|
|
|
|
configureFlags = ["--enable-exif"];
|
|
|
|
};
|
|
|
|
|
2013-02-10 18:29:08 +01:00
|
|
|
xsl = {
|
|
|
|
configureFlags = ["--with-xsl=${libxslt}"];
|
|
|
|
buildInputs = [libxslt];
|
|
|
|
};
|
|
|
|
|
2013-02-12 19:33:39 +01:00
|
|
|
mcrypt = {
|
|
|
|
configureFlags = ["--with-mcrypt=${libmcrypt}"];
|
|
|
|
buildInputs = [libmcryptOverride];
|
|
|
|
};
|
|
|
|
|
2013-02-12 21:23:24 +01:00
|
|
|
bz2 = {
|
|
|
|
configureFlags = ["--with-bz2=${bzip2}"];
|
|
|
|
buildInputs = [bzip2];
|
|
|
|
};
|
|
|
|
|
|
|
|
zip = {
|
|
|
|
configureFlags = ["--enable-zip"];
|
|
|
|
};
|
|
|
|
|
2013-04-02 12:38:42 +02:00
|
|
|
ftp = {
|
|
|
|
configureFlags = ["--enable-ftp"];
|
|
|
|
};
|
2007-11-05 22:13:16 +01:00
|
|
|
};
|
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
cfg = {
|
2012-09-19 19:56:56 +02:00
|
|
|
apxs2Support = config.php.apxs2 or true;
|
|
|
|
bcmathSupport = config.php.bcmath or true;
|
2013-06-20 09:42:09 +02:00
|
|
|
bz2Support = config.php.bz2 or false;
|
2012-09-19 19:56:56 +02:00
|
|
|
curlSupport = config.php.curl or true;
|
2013-06-20 09:42:09 +02:00
|
|
|
exifSupport = config.php.exif or true;
|
|
|
|
ftpSupport = config.php.ftp or true;
|
|
|
|
gdSupport = config.php.gd or true;
|
2012-09-19 19:56:56 +02:00
|
|
|
gettextSupport = config.php.gettext or true;
|
2013-06-24 14:32:02 +02:00
|
|
|
imapSupport = config.php.imap or false;
|
2013-06-20 09:42:09 +02:00
|
|
|
intlSupport = config.php.intl or true;
|
|
|
|
libxml2Support = config.php.libxml2 or true;
|
|
|
|
mbstringSupport = config.php.mbstring or true;
|
|
|
|
mcryptSupport = config.php.mcrypt or false;
|
|
|
|
mysqlSupport = config.php.mysql or true;
|
|
|
|
mysqliSupport = config.php.mysqli or true;
|
|
|
|
opensslSupport = config.php.openssl or true;
|
|
|
|
pcntlSupport = config.php.pcntl or true;
|
|
|
|
pdo_mysqlSupport = config.php.pdo_mysql or true;
|
2012-09-19 19:56:56 +02:00
|
|
|
postgresqlSupport = config.php.postgresql or true;
|
|
|
|
readlineSupport = config.php.readline or true;
|
|
|
|
soapSupport = config.php.soap or true;
|
2013-06-20 09:42:09 +02:00
|
|
|
socketsSupport = config.php.sockets or true;
|
|
|
|
sqliteSupport = config.php.sqlite or true;
|
2013-02-10 18:29:08 +01:00
|
|
|
xslSupport = config.php.xsl or false;
|
2013-02-12 21:23:24 +01:00
|
|
|
zipSupport = config.php.zip or true;
|
2013-06-20 09:42:09 +02:00
|
|
|
zlibSupport = config.php.zlib or true;
|
2009-03-07 00:21:28 +01:00
|
|
|
};
|
2007-11-05 22:13:16 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
configurePhase = ''
|
2010-01-06 18:04:38 +01:00
|
|
|
iniFile=$out/etc/php-recommended.ini
|
2009-03-07 00:21:28 +01:00
|
|
|
[[ -z "$libxml2" ]] || export PATH=$PATH:$libxml2/bin
|
2013-01-26 13:17:31 +01:00
|
|
|
./configure --with-config-file-scan-dir=/etc --with-config-file-path=$out/etc --prefix=$out $configureFlags
|
2009-03-07 00:21:28 +01:00
|
|
|
echo configurePhase end
|
2013-07-14 03:47:14 +02:00
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
# don't build php.dSYM as the php binary
|
|
|
|
sed -i 's/EXEEXT = \.dSYM/EXEEXT =/' Makefile
|
2009-03-07 00:21:28 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
unset installPhase; installPhase;
|
2012-07-23 19:46:50 +02:00
|
|
|
cp php.ini-production $iniFile
|
2013-06-15 13:57:05 +02:00
|
|
|
'' + ( stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
for prog in $out/bin/*; do
|
|
|
|
wrapProgram "$prog" --prefix DYLD_LIBRARY_PATH : "$DYLD_LIBRARY_PATH"
|
|
|
|
done
|
|
|
|
'' );
|
2009-03-07 00:21:28 +01:00
|
|
|
|
2012-10-15 17:14:26 +02:00
|
|
|
src = fetchurl {
|
2013-07-16 22:53:06 +02:00
|
|
|
url = "http://nl1.php.net/get/php-${version}.tar.bz2/from/this/mirror";
|
|
|
|
sha256 = "11xj6v65m6l2lq2s2j5pq5l0iwjsnxmv1nad9hja50ivc8fb4bg1";
|
2009-03-07 00:21:28 +01:00
|
|
|
name = "php-${version}.tar.bz2";
|
|
|
|
};
|
2008-12-20 02:20:35 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
meta = {
|
|
|
|
description = "The PHP language runtime engine";
|
2013-06-15 13:57:05 +02:00
|
|
|
homepage = http://www.php.net/;
|
|
|
|
license = "PHP-3";
|
|
|
|
maintainers = with stdenv.lib.maintainers; [ lovek323 ];
|
|
|
|
platforms = stdenv.lib.platforms.unix;
|
2007-11-05 22:13:16 +01:00
|
|
|
};
|
2008-12-20 02:20:35 +01:00
|
|
|
|
2009-03-07 00:21:28 +01:00
|
|
|
patches = [./fix.patch];
|
|
|
|
|
|
|
|
})
|