Merge pull request #2647 from ghostty-org/push-vsytqoyrvsvv

build.zig: add -Dpie option for position independent executables
This commit is contained in:
Mitchell Hashimoto
2024-11-11 19:28:05 -08:00
committed by GitHub

View File

@ -98,6 +98,12 @@ pub fn build(b: *std.Build) !void {
"Enables the use of Adwaita when using the GTK rendering backend.", "Enables the use of Adwaita when using the GTK rendering backend.",
) orelse true; ) orelse true;
const pie = b.option(
bool,
"pie",
"Build a Position Independent Executable",
) orelse false;
const conformance = b.option( const conformance = b.option(
[]const u8, []const u8,
"conformance", "conformance",
@ -282,6 +288,9 @@ pub fn build(b: *std.Build) !void {
// Exe // Exe
if (exe_) |exe| { if (exe_) |exe| {
// Set PIE if requested
if (pie) exe.pie = true;
// Add the shared dependencies // Add the shared dependencies
_ = try addDeps(b, exe, config); _ = try addDeps(b, exe, config);