Skip to content

feat(frankenphp): allow passing extra Go build flags, ldflags and tags - #1269

Merged
crazywhalecc merged 1 commit into
crazywhalecc:v3from
dunglas:feat/frankenphp-go-flags
Oct 25, 2026
Merged

crazywhalecc merged 1 commit into
crazywhalecc:v3from
dunglas:feat/frankenphp-go-flags

Conversation

@dunglas

@dunglas dunglas commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

FrankenPHP static builds can't otherwise set Go linker variables such as EmbeddedAppPath, nor add build tags: a second -ldflags or -tags would replace the ones generated here.

  • SPC_CMD_VAR_FRANKENPHP_GO_BUILD_FLAGS is appended to the go build flags.
  • SPC_CMD_VAR_FRANKENPHP_GO_LDFLAGS is merged into the generated -ldflags. Values can't contain double quotes, like the -X flags already generated.
  • SPC_CMD_VAR_FRANKENPHP_GO_TAGS is merged into the generated tags.

Both the Unix (xcaddy) and Windows (go build) paths are covered. The defaults, empty, are documented in config/env.ini.

For instance, FrankenPHP's build-static.sh will use it to fix the extraction directory of embedded apps:

SPC_CMD_VAR_FRANKENPHP_GO_LDFLAGS="-X github.com/dunglas/frankenphp.EmbeddedAppPath=/opt/my-app"

FrankenPHP static builds can't otherwise set Go linker variables such as
EmbeddedAppPath, nor extra build tags: a second -ldflags or -tags would
replace the ones generated here. Add SPC_CMD_VAR_FRANKENPHP_GO_BUILD_FLAGS,
SPC_CMD_VAR_FRANKENPHP_GO_LDFLAGS and SPC_CMD_VAR_FRANKENPHP_GO_TAGS, merged
into the generated flags on Unix and Windows.
@crazywhalecc
crazywhalecc merged commit 251bc58 into crazywhalecc:v3 Oct 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants