From ed3a63b5d7aec50f803e3e91fcb71a001a7ebe78 Mon Sep 17 00:00:00 2001 From: "Jason \"Don\" O'Conal" Date: Sat, 15 Jun 2013 21:57:05 +1000 Subject: [PATCH] php53: fix on darwin * add libssh2 to build inputs (configure fails without this) * link with stdc++ * add icu/lib directory to DYLD_LIBRARY_PATH (and wrap binaries with this environment variable * add libiconv to build inputs * fix --with-iconv configure flag (was --with-iconv-dir which is not a valid flag) --- pkgs/development/interpreters/php/5.3.nix | 43 ++++++++++++++++------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/pkgs/development/interpreters/php/5.3.nix b/pkgs/development/interpreters/php/5.3.nix index 35508230ebdf..1625c924cbb3 100644 --- a/pkgs/development/interpreters/php/5.3.nix +++ b/pkgs/development/interpreters/php/5.3.nix @@ -1,7 +1,7 @@ { stdenv, fetchurl, composableDerivation, autoconf, automake, flex, bison , apacheHttpd, mysql, libxml2, readline, zlib, curl, gd, postgresql, gettext -, openssl, pkgconfig, sqlite, config, libiconv, libjpeg, libpng, freetype -, libxslt, libmcrypt, bzip2, icu }: +, openssl, pkgconfig, sqlite, config, libjpeg, libpng, freetype, libxslt +, libmcrypt, bzip2, icu, libssh2, makeWrapper, libiconvOrEmpty, libiconv }: let libmcryptOverride = libmcrypt.override { disablePosixThreads = true; }; @@ -15,7 +15,15 @@ composableDerivation.composableDerivation {} ( fixed : let inherit (fixed.fixed) enableParallelBuilding = true; - buildInputs = ["flex" "bison" "pkgconfig"]; + 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 = { @@ -41,11 +49,11 @@ composableDerivation.composableDerivation {} ( fixed : let inherit (fixed.fixed) }; libxml2 = { - configureFlags = [ - "--with-libxml-dir=${libxml2}" - #"--with-iconv-dir=${libiconv}" - ]; - buildInputs = [ libxml2 ]; + configureFlags + = [ "--with-libxml-dir=${libxml2}" ] + ++ stdenv.lib.optional (libiconvOrEmpty != []) + [ "--with-iconv=${libiconv}" ]; + buildInputs = [ libxml2 ] ++ libiconvOrEmpty; }; readline = { @@ -89,7 +97,12 @@ composableDerivation.composableDerivation {} ( fixed : let inherit (fixed.fixed) }; gd = { - configureFlags = ["--with-gd=${gd} --with-freetype-dir=${freetype}"]; + configureFlags = [ + "--with-gd" + "--with-freetype-dir=${freetype}" + "--with-png-dir=${libpng}" + "--with-jpeg-dir=${libjpeg}" + ]; buildInputs = [gd libpng libjpeg freetype]; }; @@ -197,7 +210,11 @@ composableDerivation.composableDerivation {} ( fixed : let inherit (fixed.fixed) 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://nl.php.net/get/php-${version}.tar.bz2/from/this/mirror"; @@ -207,8 +224,10 @@ composableDerivation.composableDerivation {} ( fixed : let inherit (fixed.fixed) meta = { description = "The PHP language runtime engine"; - homepage = http://www.php.net/; - license = "PHP-3"; + homepage = http://www.php.net/; + license = "PHP-3"; + maintainers = with stdenv.lib.maintainers; [ lovek323 ]; + platforms = stdenv.lib.platforms.unix; }; patches = [./fix.patch];