Skip to content

Commit

Permalink
Merge pull request #271678 from shyim/frankenphp-darwin-support
Browse files Browse the repository at this point in the history
frankenphp: add darwin support
  • Loading branch information
drupol authored Dec 5, 2023
2 parents f10cab3 + 64a56af commit 17a63a0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
20 changes: 17 additions & 3 deletions pkgs/by-name/fr/frankenphp/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
, php
, testers
, frankenphp
, darwin
, pkg-config
, runCommand
, writeText
}:
Expand All @@ -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";
Expand All @@ -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" ];

Expand All @@ -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;
Expand Down Expand Up @@ -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;
};
}
9 changes: 7 additions & 2 deletions pkgs/development/interpreters/php/generic.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -236,7 +239,6 @@ let
# PCRE
++ [ "--with-external-pcre=${pcre2.dev}" ]


# Enable sapis
++ lib.optional (!cgiSupport) "--disable-cgi"
++ lib.optional (!cliSupport) "--disable-cli"
Expand All @@ -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
Expand Down

0 comments on commit 17a63a0

Please sign in to comment.