Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frankenphp: add darwin support #271678

Merged
merged 3 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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