Skip to content

Set CGO build flags and rust flags in builder environment#707

Merged
bbhtt merged 3 commits intomainfrom
bbhtt/cgo-flags
Mar 10, 2026
Merged

Set CGO build flags and rust flags in builder environment#707
bbhtt merged 3 commits intomainfrom
bbhtt/cgo-flags

Conversation

@bbhtt
Copy link
Copy Markdown
Contributor

@bbhtt bbhtt commented Mar 7, 2026

Fixes: #694
Fixes: #693

@bbhtt bbhtt force-pushed the bbhtt/cgo-flags branch from 82b7700 to 0ee4b78 Compare March 8, 2026 02:23
@bbhtt bbhtt changed the title Set CGO build flags in builder environment Set CGO build flags and rust flags in builder environment Mar 8, 2026
@bbhtt bbhtt force-pushed the bbhtt/cgo-flags branch 2 times, most recently from 04bd4f2 to 0753033 Compare March 8, 2026 05:47
@bbhtt bbhtt added this to the 1.5.0 milestone Mar 9, 2026
Comment thread src/builder-options.c Outdated
@bbhtt bbhtt force-pushed the bbhtt/cgo-flags branch 3 times, most recently from c308b8e to 20aa67e Compare March 10, 2026 06:21
Comment thread src/builder-options.c Outdated
@bbhtt bbhtt force-pushed the bbhtt/cgo-flags branch from 20aa67e to da18a2e Compare March 10, 2026 11:25
bbhtt added 3 commits March 10, 2026 18:19
When an override property is set in the manifest along with sdk default
flags set but no explicit flags, builder_options_get_flags would return
an empty string instead of NULL, causing a
`--env=CFLAGS=` (and equivalent) being passed to the build. Return
NULL in this case as well, which should not set the env var at all.

Buildsystems might interpret this differently but the override properties
as documented are not meant to affect the buildsystem's own internal
handlings of the flags, rather only clear the accumulated flags of f-b.
Set CGO_CFLAGS, CGO_CXXFLAGS and CGO_LDFLAGS in the build environment.
By default these inherit the values of cflags, cxxflags and ldflags
respectively, unless overridden in the manifest.

Fixes: #694
This inherits the SDK provided rustflags by default

Fixes: #693
@bbhtt bbhtt force-pushed the bbhtt/cgo-flags branch from da18a2e to 31f6869 Compare March 10, 2026 12:50
@bbhtt bbhtt enabled auto-merge (rebase) March 10, 2026 12:52
@bbhtt bbhtt merged commit 5fff033 into main Mar 10, 2026
3 checks passed
@bbhtt bbhtt deleted the bbhtt/cgo-flags branch March 10, 2026 12:53
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.

Set CGO_CFLAGS, CGO_CXXFLAGS and CGO_LDFLAGS Allow setting RUSTFLAGS from SDK

2 participants