Last active
December 8, 2016 21:13
-
-
Save 3noch/7f42dbd9a02172e0857b5088f527ea5d to your computer and use it in GitHub Desktop.
PHP 5.3 derivation compatible with NixOS 16.09
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is derived from the following: | |
# https://github.com/NixOS/nixpkgs/blob/c5eaf231bcfeff384d3914378a3338d88b236435/pkgs/development/interpreters/php/default.nix | |
# with a tiny bit from the following (which is the commit that removed PHP 5.4 from nixpkgs): | |
# https://github.com/NixOS/nixpkgs/blob/fc84ee22df2a6d14b638a93c0e802c033233f21e/pkgs/development/interpreters/php/default.nix | |
{ stdenv, fetchurl, composableDerivation, autoconf, automake, flex, bison | |
, apacheHttpd, mysql55, libxml2, readline, zlib, curl, gd, postgresql, gettext | |
, openssl, pkgconfig, sqlite, config, libjpeg, libpng, freetype, libxslt | |
, libmcrypt, bzip2, icu, libssh2, makeWrapper, libiconv, uwimap | |
, pam | |
# added | |
, gcc | |
}: | |
let | |
mysql = mysql55; | |
libiconvOrNull = | |
if gcc.libc or null != null || stdenv.isGlibc | |
then null | |
else libiconv; | |
libiconvOrEmpty = if libiconvOrNull == null then [] else [libiconv]; | |
libmcryptOverride = libmcrypt.override { disablePosixThreads = true; }; | |
in | |
composableDerivation.composableDerivation {} ( fixed : let inherit (fixed.fixed) version; in { | |
version = "5.3.29"; | |
name = "php-${version}"; | |
enableParallelBuilding = true; | |
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"; | |
flags = { | |
# much left to do here... | |
# SAPI modules: | |
apxs2 = { | |
configureFlags = ["--with-apxs2=${apacheHttpd.dev}/bin/apxs"]; | |
buildInputs = [apacheHttpd]; | |
}; | |
calendar = { | |
configureFlags = [ "--enable-calendar" ]; | |
}; | |
# Extensions | |
curl = { | |
configureFlags = ["--with-curl=${curl.dev}" "--with-curlwrappers"]; | |
buildInputs = [curl openssl]; | |
}; | |
pcntl = { | |
configureFlags = [ "--enable-pcntl" ]; | |
}; | |
zlib = { | |
configureFlags = ["--with-zlib=${zlib.dev}"]; | |
buildInputs = [zlib]; | |
}; | |
libxml2 = { | |
configureFlags | |
= [ "--with-libxml-dir=${libxml2.dev}" ] | |
++ stdenv.lib.optional (libiconvOrEmpty != []) | |
[ "--with-iconv=${libiconv.dev}" ]; | |
buildInputs = [ libxml2 ] ++ libiconvOrEmpty; | |
}; | |
readline = { | |
configureFlags = ["--with-readline=${readline.dev}"]; | |
buildInputs = [ readline ]; | |
}; | |
sqlite = { | |
configureFlags = ["--with-pdo-sqlite=${sqlite.dev}"]; | |
buildInputs = [ sqlite ]; | |
}; | |
postgresql = { | |
configureFlags = ["--with-pgsql=${postgresql}"]; | |
buildInputs = [ postgresql ]; | |
}; | |
mysql = { | |
configureFlags = ["--with-mysql=${mysql}"]; | |
buildInputs = [ mysql ]; #mysql.lib.dev | |
}; | |
mysqli = { | |
configureFlags = ["--with-mysqli=${mysql}/bin/mysql_config"]; | |
buildInputs = [ mysql ]; | |
}; | |
mysqli_embedded = { | |
configureFlags = ["--enable-embedded-mysqli"]; | |
depends = "mysqli"; | |
assertion = fixed.mysqliSupport; | |
}; | |
pdo_mysql = { | |
configureFlags = ["--with-pdo-mysql=${mysql}"]; | |
buildInputs = [ mysql ]; | |
}; | |
bcmath = { | |
configureFlags = ["--enable-bcmath"]; | |
}; | |
gd = { | |
configureFlags = [ | |
"--with-gd" | |
"--with-freetype-dir=${freetype.dev}" | |
"--with-png-dir=${libpng.dev}" | |
"--with-jpeg-dir=${libjpeg.dev}" | |
]; | |
buildInputs = [gd libpng libjpeg freetype]; | |
}; | |
soap = { | |
configureFlags = ["--enable-soap"]; | |
}; | |
sockets = { | |
configureFlags = ["--enable-sockets"]; | |
}; | |
openssl = { | |
configureFlags = ["--with-openssl"]; | |
buildInputs = [openssl openssl.dev]; | |
}; | |
mbstring = { | |
configureFlags = ["--enable-mbstring"]; | |
}; | |
gettext = { | |
configureFlags = ["--with-gettext=${gettext}"]; | |
buildInputs = [gettext]; | |
}; | |
imap = { | |
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; | |
}; | |
intl = { | |
configureFlags = ["--enable-intl"]; | |
buildInputs = [icu]; | |
}; | |
exif = { | |
configureFlags = ["--enable-exif"]; | |
}; | |
xsl = { | |
configureFlags = ["--with-xsl=${libxslt.dev}"]; | |
buildInputs = [libxslt]; | |
}; | |
mcrypt = { | |
configureFlags = ["--with-mcrypt=${libmcrypt}"]; | |
buildInputs = [libmcryptOverride]; | |
}; | |
bz2 = { | |
configureFlags = ["--with-bz2=${bzip2.dev}"]; | |
buildInputs = [bzip2]; | |
}; | |
zip = { | |
configureFlags = ["--enable-zip"]; | |
}; | |
ftp = { | |
configureFlags = ["--enable-ftp"]; | |
}; | |
fpm = { | |
configureFlags = ["--enable-fpm"]; | |
}; | |
}; | |
cfg = { | |
apxs2Support = config.php.apxs2 or true; | |
bcmathSupport = config.php.bcmath or true; | |
bz2Support = config.php.bz2 or false; | |
calendarSupport = config.php.calendar or true; | |
curlSupport = config.php.curl or true; | |
exifSupport = config.php.exif or true; | |
ftpSupport = config.php.ftp or true; | |
fpmSupport = config.php.fpm or true; | |
gdSupport = config.php.gd or true; | |
gettextSupport = config.php.gettext or true; | |
imapSupport = config.php.imap or false; | |
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; | |
postgresqlSupport = config.php.postgresql or true; | |
readlineSupport = config.php.readline or true; | |
soapSupport = config.php.soap or true; | |
socketsSupport = config.php.sockets or true; | |
sqliteSupport = config.php.sqlite or true; | |
xslSupport = config.php.xsl or false; | |
zipSupport = config.php.zip or true; | |
zlibSupport = config.php.zlib or true; | |
}; | |
configurePhase = '' | |
iniFile=$out/etc/php.ini | |
[[ -z "$libxml2" ]] || export PATH=$PATH:$libxml2/bin | |
./configure --with-config-file-scan-dir=/etc --with-config-file-path=$out/etc --prefix=$out $configureFlags | |
echo configurePhase end | |
'' + stdenv.lib.optionalString stdenv.isDarwin '' | |
# don't build php.dSYM as the php binary | |
sed -i 's/EXEEXT = \.dSYM/EXEEXT =/' Makefile | |
''; | |
installPhase = '' | |
unset installPhase; installPhase; | |
cp php.ini-production $iniFile | |
'' + ( stdenv.lib.optionalString stdenv.isDarwin '' | |
for prog in $out/bin/*; do | |
wrapProgram "$prog" --prefix DYLD_LIBRARY_PATH : "$DYLD_LIBRARY_PATH" | |
done | |
'' ); | |
src = fetchurl { | |
url = "http://www.php.net/distributions/php-${version}.tar.bz2"; | |
sha256 = "1480pfp4391byqzmvdmbxkdkqwdzhdylj63sfzrcgadjf9lwzqf4"; | |
name = "php-${version}.tar.bz2"; | |
}; | |
meta = { | |
description = "An HTML-embedded scripting language"; | |
homepage = http://www.php.net/; | |
license = stdenv.lib.licenses.php301; | |
maintainers = with stdenv.lib.maintainers; [ lovek323 ]; | |
platforms = stdenv.lib.platforms.unix; | |
}; | |
patches = [ | |
(fetchurl { | |
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/55d59eefb3968be11cf40b96650f5cb4c64b60b7/pkgs/development/interpreters/php/fix.patch"; | |
sha256 = "02c8pp45yzbdsz8k67p1ijiyh0xc3835wly4s1vgs3q1f2z10v1p"; | |
}) | |
(fetchurl { | |
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/55d59eefb3968be11cf40b96650f5cb4c64b60b7/pkgs/development/interpreters/php/5.3-freetype-dirs.patch"; | |
sha256 = "1n2wiiqji8f9f4iasy4nh23ny9020mm6i9fr0vmf8l5yvryrbcpy"; | |
}) | |
]; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment