summary refs log blame commit diff
path: root/pkgs/build-support/build-pecl.nix
blob: d75d3cf943a0a1b18d057ea6b4d7660230f404fa (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                     
 

         
                   
               
                  
                        
                 

                  
                                                            





                              
                                   
                        
 
              
 
                                                                   
                                                   
 
                                                                         
 






                                                                              
  
{ stdenv, lib, php, autoreconfHook, fetchurl, re2c }:

{ pname
, version
, internalDeps ? []
, peclDeps ? []
, buildInputs ? []
, nativeBuildInputs ? []
, postPhpize ? ""
, makeFlags ? []
, src ? fetchurl {
    url = "http://pecl.php.net/get/${pname}-${version}.tgz";
    inherit (args) sha256;
  }
, ...
}@args:

stdenv.mkDerivation (args // {
  name = "php-${pname}-${version}";
  extensionName = pname;

  inherit src;

  nativeBuildInputs = [ autoreconfHook re2c ] ++ nativeBuildInputs;
  buildInputs = [ php ] ++ peclDeps ++ buildInputs;

  makeFlags = [ "EXTENSION_DIR=$(out)/lib/php/extensions" ] ++ makeFlags;

  autoreconfPhase = ''
    phpize
    ${postPhpize}
    ${lib.concatMapStringsSep "\n"
      (dep: "mkdir -p ext; ln -s ${dep.dev}/include ext/${dep.extensionName}")
      internalDeps}
  '';
})