diff --git a/pkgs/development/interpreters/php-xdebug/default.nix b/pkgs/development/interpreters/php-xdebug/default.nix new file mode 100644 index 000000000000..d400b3e0a393 --- /dev/null +++ b/pkgs/development/interpreters/php-xdebug/default.nix @@ -0,0 +1,34 @@ +args: with args; +stdenv.mkDerivation { + name = "php-xdebug"; + + src = args.fetchurl { + url = "http://xdebug.org/files/xdebug-2.0.5.tgz"; + sha256 = "1cmq7c36gj8n41mfq1wba5rij8j77yqhydpcsbcysk1zchg68f26"; + }; + + buildInputs = [php autoconf automake]; + + configurePhase = '' + phpize + ./configure --prefix=$out + ''; + + buildPhase = '' + make && make test + ''; + + installPhase = '' + ensureDir $out/lib/xdebug + cp modules/xdebug.so $out/lib + cp LICENSE $out/lib/xdebug + ''; + + meta = { + description = "php debugger and profiler extension"; + homepage = http://xdebug.org/; + license = "xdebug"; # based on PHP-3 + maintainers = [args.lib.maintainers.marcweber]; + platforms = args.lib.platforms.linux; + }; +} diff --git a/pkgs/development/interpreters/php/ini-bulider.nix b/pkgs/development/interpreters/php/ini-bulider.nix new file mode 100644 index 000000000000..72179fd068bd --- /dev/null +++ b/pkgs/development/interpreters/php/ini-bulider.nix @@ -0,0 +1,43 @@ +{runCommand, php, appendLines ? "", prefixPhpRecommended ? true} : + + +/* + +NixOS: see apache-httpd/default.nix's phpIni option + +to enable Xdebug append these lines: + '' + zend_extension="${pkgs.phpXdebug}/lib/xdebug.so" + zend_extension_ts="${pkgs.phpXdebug}/lib/xdebug.so" + zend_extension_debug="${pkgs.phpXdebug}/lib/xdebug.so" + xdebug.remote_enable=true + xdebug.remote_host=127.0.0.1 + xdebug.remote_port=9000 + xdebug.remote_handler=dbgp + xdebug.profiler_enable=0 + xdebug.profiler_output_dir="/tmp/xdebug" + xdebug.remote_mode=req + '' + +to make php's mail() function work add + '' + ; Needed for PHP's mail() function. + sendmail_path = sendmail -t -i + '' +*/ + + +runCommand "php.ini" + { + inherit php appendLines prefixPhpRecommended; + } + '' + [ -z "$prefixPhpRecommended" ] || { + { + echo "# PHP RECOMMENDED INI START" + cat $php/etc/php-recommended.ini + echo "# PHP RECOMMENDED INI END" + } >> $out + } + echo "$appendLines" >> $out + '' diff --git a/pkgs/development/interpreters/php_configurable/default.nix b/pkgs/development/interpreters/php_configurable/default.nix index 07ac6f90a1b3..eb4a29dd720d 100644 --- a/pkgs/development/interpreters/php_configurable/default.nix +++ b/pkgs/development/interpreters/php_configurable/default.nix @@ -106,13 +106,6 @@ composableDerivation {} ( fixed : { license = "based on the PHP license - as is"; }; */ - xdebug = { - buildInputs = [ automake autoconf ]; - xdebug_src = args.fetchurl { - url = "http://xdebug.org/files/xdebug-2.0.5.tgz"; - sha256 = "1cmq7c36gj8n41mfq1wba5rij8j77yqhydpcsbcysk1zchg68f26"; - }; - }; }; cfg = { @@ -130,14 +123,13 @@ composableDerivation {} ( fixed : { soapSupport = getConfig ["php" "soap"] true; zlibSupport = getConfig ["php" "zlib"] true; opensslSupport = getConfig ["php" "openssl"] true; - xdebugSupport = getConfig ["php" "xdebug"] false; mbstringSupport = getConfig ["php" "mbstring"] true; gdSupport = getConfig ["php" "gd"] true; }; # only -O1 configurePhase = '' - iniFile=$out/etc/$name.ini + iniFile=$out/etc/php-recommended.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 @@ -147,32 +139,6 @@ composableDerivation {} ( fixed : { installPhase = '' unset installPhase; installPhase; cp php.ini-recommended $iniFile - - # Now Let's build xdebug if flag has been given - # TODO I think there are better paths than the given below - if [ -n "$xdebug_src" ]; then - PATH=$PATH:$out/bin - tar xfz $xdebug_src; - cd xdebug* - phpize - ./configure --prefix=$out - make - ensureDir $out/lib; cp modules/xdebug.so $out/lib - cat >> $out/etc/php.ini << EOF - zend_extension="$out/lib/xdebug.so" - zend_extension_ts="$out/lib/xdebug.so" - zend_extension_debug="$out/lib/xdebug.so" - xdebug.remote_enable=true - xdebug.remote_host=127.0.0.1 - xdebug.remote_port=9000 - xdebug.remote_handler=dbgp - xdebug.profiler_enable=0 - xdebug.profiler_output_dir="/tmp/xdebug" - xdebug.remote_mode=req - max_execution_time = 300 - date.timezone = UTC - EOF - fi ''; src = args.fetchurl { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a954bfad17c7..11d72ab6fec7 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2339,13 +2339,21 @@ let if stdenv.isDarwin then null else unixODBC; }; - php = import ../development/interpreters/php_configurable { + php = makeOverridable (import ../development/interpreters/php_configurable) { inherit stdenv fetchurl lib composableDerivation autoconf automake flex bison apacheHttpd mysql libxml2 # gettext zlib curl gd postgresql openssl pkgconfig sqlite getConfig; }; + phpXdebug = import ../development/interpreters/php-xdebug { + inherit stdenv fetchurl php autoconf automake; + }; + + phpIniBuilder = makeOverridable (import ../development/interpreters/php/ini-bulider.nix) { + inherit php runCommand; + }; + pltScheme = builderDefsPackage (import ../development/interpreters/plt-scheme) { inherit cairo fontconfig freetype libjpeg libpng openssl perl mesa zlib which;