diff --git a/pkgs/by-name/fr/frankenphp/package.nix b/pkgs/by-name/fr/frankenphp/package.nix index 3bc94389d67f4..6ac7fd6a1ae56 100644 --- a/pkgs/by-name/fr/frankenphp/package.nix +++ b/pkgs/by-name/fr/frankenphp/package.nix @@ -5,6 +5,8 @@ , php , testers , frankenphp +, darwin +, pkg-config , runCommand , writeText }: @@ -13,6 +15,9 @@ let phpEmbedWithZts = php.override { embedSupport = true; ztsSupport = true; + staticSupport = stdenv.isDarwin; + zendSignalsSupport = false; + zendMaxExecutionTimersSupport = stdenv.isLinux; }; phpUnwrapped = phpEmbedWithZts.unwrapped; phpConfig = "${phpUnwrapped.dev}/bin/php-config"; @@ -36,6 +41,7 @@ in buildGoModule rec { vendorHash = "sha256-Lgj/pFtSQIgjrycajJ1zNY3ytvArmuk0E3IjsAzsNdM="; buildInputs = [ phpUnwrapped ] ++ phpUnwrapped.buildInputs; + nativeBuildInputs = lib.optionals stdenv.isDarwin [ pkg-config darwin.cctools darwin.autoSignDarwinBinariesHook ]; subPackages = [ "frankenphp" ]; @@ -52,7 +58,15 @@ in buildGoModule rec { export CGO_CFLAGS="$(${phpConfig} --includes)" export CGO_LDFLAGS="-DFRANKENPHP_VERSION=${version} \ $(${phpConfig} --ldflags) \ - -Wl,--start-group $(${phpConfig} --libs) -Wl,--end-group" + $(${phpConfig} --libs)" + '' + lib.optionalString stdenv.isDarwin '' + # replace hard-code homebrew path + substituteInPlace ../frankenphp.go \ + --replace "-L/opt/homebrew/opt/libiconv/lib" "-L${darwin.libiconv}/lib" + + # remove when https://github.com/dunglas/frankenphp/pull/331 is merged and released + substituteInPlace ../frankenphp.go \ + --replace "darwin pkg-config: libxml-2.0 sqlite3" "darwin pkg-config: libxml-2.0" ''; doCheck = false; @@ -82,7 +96,7 @@ in buildGoModule rec { homepage = "https://github.com/dunglas/frankenphp"; license = licenses.mit; mainProgram = "frankenphp"; - maintainers = with maintainers; [ gaelreyrol ]; - platforms = platforms.linux; + maintainers = with maintainers; [ gaelreyrol shyim ]; + platforms = platforms.linux ++ platforms.darwin; }; } diff --git a/pkgs/development/interpreters/php/generic.nix b/pkgs/development/interpreters/php/generic.nix index ba5ce5537bbbc..3bea507ad0a9e 100644 --- a/pkgs/development/interpreters/php/generic.nix +++ b/pkgs/development/interpreters/php/generic.nix @@ -53,7 +53,10 @@ let , argon2Support ? true , cgotoSupport ? false , embedSupport ? false + , staticSupport ? false , ipv6Support ? true + , zendSignalsSupport ? true + , zendMaxExecutionTimersSupport ? false , systemdSupport ? lib.meta.availableOn stdenv.hostPlatform systemd , valgrindSupport ? !stdenv.isDarwin && lib.meta.availableOn stdenv.hostPlatform valgrind , ztsSupport ? apxs2Support @@ -236,7 +239,6 @@ let # PCRE ++ [ "--with-external-pcre=${pcre2.dev}" ] - # Enable sapis ++ lib.optional (!cgiSupport) "--disable-cgi" ++ lib.optional (!cliSupport) "--disable-cli" @@ -250,11 +252,14 @@ let ++ lib.optional apxs2Support "--with-apxs2=${apacheHttpd.dev}/bin/apxs" ++ lib.optional argon2Support "--with-password-argon2=${libargon2}" ++ lib.optional cgotoSupport "--enable-re2c-cgoto" - ++ lib.optional embedSupport "--enable-embed" + ++ lib.optional embedSupport "--enable-embed${lib.optionalString staticSupport "=static"}" ++ lib.optional (!ipv6Support) "--disable-ipv6" ++ lib.optional systemdSupport "--with-fpm-systemd" ++ lib.optional valgrindSupport "--with-valgrind=${valgrind.dev}" ++ lib.optional ztsSupport "--enable-zts" + ++ lib.optional staticSupport "--enable-static" + ++ lib.optional (!zendSignalsSupport) ["--disable-zend-signals"] + ++ lib.optional zendMaxExecutionTimersSupport "--enable-zend-max-execution-timers" # Sendmail