Skip to content

feat(static): pass extra Go build flags, ldflags and tags - #2766

Closed
dunglas wants to merge 1 commit into
mainfrom
feat/static-go-flags
Closed

dunglas wants to merge 1 commit into
mainfrom
feat/static-go-flags

Conversation

@dunglas

@dunglas dunglas commented Oct 25, 2026

Copy link
Copy Markdown
Member

Static builds couldn't set Go linker variables such as EmbeddedAppPath, or add build tags, since static-php-cli generates the Go flags. This exposes GO_BUILD_FLAGS, GO_LDFLAGS and GO_TAGS in build-static.sh, forwarded to static-php-cli through craft.yml's extra-env like XCADDY_ARGS, and documents how to fix the extraction path of embedded apps:

EMBED=/path/to/app GO_LDFLAGS="-X github.com/dunglas/frankenphp.EmbeddedAppPath=/opt/my-app" ./build-static.sh

Requires crazywhalecc/static-php-cli#1269; older static-php-cli versions ignore these variables.

Static builds couldn't set Go linker variables such as EmbeddedAppPath, or add
build tags, since static-php-cli generates the Go flags. Expose GO_BUILD_FLAGS,
GO_LDFLAGS and GO_TAGS, forwarded to static-php-cli which merges them into its
own flags, and document how to fix the embedded app extraction path.
@dunglas

dunglas commented Oct 25, 2026

Copy link
Copy Markdown
Member Author

Closing: static-php-cli already reads these settings from the environment (SPC_REGISTRIES, and SPC_CMD_VAR_FRANKENPHP_GO_* since crazywhalecc/static-php-cli#1269), and build-static.sh reuses dist/spc, so this isn't needed.

@dunglas dunglas closed this Oct 25, 2026
@dunglas
dunglas deleted the feat/static-go-flags branch October 25, 2026 19:10
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.

1 participant