Merge pull request #2675 from ghostty-org/push-sukwvwpxlkpk

build: -Dpie default to true in system package mode
This commit is contained in:
Mitchell Hashimoto
2024-11-14 09:45:18 -08:00
committed by GitHub
2 changed files with 10 additions and 3 deletions

View File

@ -80,7 +80,9 @@ relevant to package maintainers:
- `--system`: The path to the offline cache directory. This disables
any package fetching from the internet. This flag also triggers all
dependencies to be dynamically linked by default.
dependencies to be dynamically linked by default. This flag also makes
the binary a PIE (Position Independent Executable) by default (override
with `-Dpie`).
- `-Doptimize=ReleaseFast`: Build with optimizations enabled and safety checks
disabled. This is the recommended build mode for distribution. I'd prefer

View File

@ -57,6 +57,11 @@ pub fn build(b: *std.Build) !void {
break :target result;
};
// This is set to true when we're building a system package. For now
// this is trivially detected using the "system_package_mode" bool
// but we may want to make this more sophisticated in the future.
const system_package: bool = b.graph.system_package_mode;
const wasm_target: WasmTarget = .browser;
// We use env vars throughout the build so we grab them immediately here.
@ -101,8 +106,8 @@ pub fn build(b: *std.Build) !void {
const pie = b.option(
bool,
"pie",
"Build a Position Independent Executable",
) orelse false;
"Build a Position Independent Executable. Default true for system packages.",
) orelse system_package;
const conformance = b.option(
[]const u8,