aboutsummaryrefslogtreecommitdiff
path: root/test/link/macho
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-07-29 23:57:52 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-07-30 11:19:32 -0700
commit38840e2e586d71f2b38ed825ea02529f615c5f0c (patch)
tree5c31180307056823d2fc8a5aab73f094ad4d729d /test/link/macho
parentf8386de7ae12fca1e50e7920964fd7c47301fc05 (diff)
downloadzig-38840e2e586d71f2b38ed825ea02529f615c5f0c.tar.gz
zig-38840e2e586d71f2b38ed825ea02529f615c5f0c.zip
build system: follow-up enhancements regarding LazyPath
* introduce LazyPath.cwd_relative variant and use it for --zig-lib-dir. closes #12685 * move overrideZigLibDir and setMainPkgPath to options fields set once and then never mutated. * avoid introducing Build/util.zig * use doc comments for deprecation notices so that they show up in generated documentation. * introduce InstallArtifact.Options, accept it as a parameter to addInstallArtifact, and move override_dest_dir into it. Instead of configuring the installation via Compile step, configure the installation via the InstallArtifact step. In retrospect this is obvious. * remove calls to pushInstalledFile in InstallArtifact. See #14943 * rewrite InstallArtifact to not incorrectly observe whether a Compile step has any generated outputs. InstallArtifact is meant to trigger output generation. * fix child process evaluation code handling of `-fno-emit-bin`. * don't store out_h_filename, out_ll_filename, etc., pointlessly. these are all just simple extensions appended to the root name. * make emit_directory optional. It's possible to have nothing outputted, for example, if you're just type-checking. * avoid passing -femit-foo/-fno-emit-foo when it is the default * rename ConfigHeader.getTemplate to getOutput * deprecate addOptionArtifact * update the random number seed of Options step caching. * avoid using `inline for` pointlessly * avoid using `override_Dest_dir` pointlessly * avoid emitting an executable pointlessly in test cases Removes forceBuild and forceEmit. Let's consider these additions separately. Nearly all of the usage sites were suspicious.
Diffstat (limited to 'test/link/macho')
-rw-r--r--test/link/macho/dylib/build.zig4
-rw-r--r--test/link/macho/needed_library/build.zig5
-rw-r--r--test/link/macho/search_strategy/build.zig14
-rw-r--r--test/link/macho/tbdv3/build.zig3
-rw-r--r--test/link/macho/weak_library/build.zig4
5 files changed, 10 insertions, 20 deletions
diff --git a/test/link/macho/dylib/build.zig b/test/link/macho/dylib/build.zig
index aecc9b38ec..b05e4f5677 100644
--- a/test/link/macho/dylib/build.zig
+++ b/test/link/macho/dylib/build.zig
@@ -41,8 +41,8 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
});
exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &.{} });
exe.linkSystemLibrary("a");
- exe.addLibraryPath(dylib.getEmitDirectory());
- exe.addRPath(dylib.getEmitDirectory());
+ exe.addLibraryPath(dylib.getEmittedBinDirectory());
+ exe.addRPath(dylib.getEmittedBinDirectory());
exe.linkLibC();
const check_exe = exe.checkObject();
diff --git a/test/link/macho/needed_library/build.zig b/test/link/macho/needed_library/build.zig
index c24569e06d..de5d6b1ae6 100644
--- a/test/link/macho/needed_library/build.zig
+++ b/test/link/macho/needed_library/build.zig
@@ -23,7 +23,6 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
});
dylib.addCSourceFile(.{ .file = .{ .path = "a.c" }, .flags = &.{} });
dylib.linkLibC();
- dylib.forceEmit(.bin); // enforce library creation, we import it below
// -dead_strip_dylibs
// -needed-la
@@ -35,8 +34,8 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &[0][]const u8{} });
exe.linkLibC();
exe.linkSystemLibraryNeeded("a");
- exe.addLibraryPath(dylib.getEmitDirectory());
- exe.addRPath(dylib.getEmitDirectory());
+ exe.addLibraryPath(dylib.getEmittedBinDirectory());
+ exe.addRPath(dylib.getEmittedBinDirectory());
exe.dead_strip_dylibs = true;
const check = exe.checkObject();
diff --git a/test/link/macho/search_strategy/build.zig b/test/link/macho/search_strategy/build.zig
index d802bddbf4..574782617b 100644
--- a/test/link/macho/search_strategy/build.zig
+++ b/test/link/macho/search_strategy/build.zig
@@ -57,10 +57,6 @@ fn createScenario(
});
static.addCSourceFile(.{ .file = .{ .path = "a.c" }, .flags = &.{} });
static.linkLibC();
- static.override_dest_dir = std.Build.InstallDir{
- .custom = "static",
- };
- static.forceEmit(.bin);
const dylib = b.addSharedLibrary(.{
.name = name,
@@ -70,10 +66,6 @@ fn createScenario(
});
dylib.addCSourceFile(.{ .file = .{ .path = "a.c" }, .flags = &.{} });
dylib.linkLibC();
- dylib.override_dest_dir = std.Build.InstallDir{
- .custom = "dynamic",
- };
- dylib.forceEmit(.bin); // we want the binary to be built as we use it further below
const exe = b.addExecutable(.{
.name = name,
@@ -83,8 +75,8 @@ fn createScenario(
exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &.{} });
exe.linkSystemLibraryName(name);
exe.linkLibC();
- exe.addLibraryPath(static.getEmitDirectory());
- exe.addLibraryPath(dylib.getEmitDirectory());
- exe.addRPath(dylib.getEmitDirectory());
+ exe.addLibraryPath(static.getEmittedBinDirectory());
+ exe.addLibraryPath(dylib.getEmittedBinDirectory());
+ exe.addRPath(dylib.getEmittedBinDirectory());
return exe;
}
diff --git a/test/link/macho/tbdv3/build.zig b/test/link/macho/tbdv3/build.zig
index 3b27b5a0ca..ba11004f29 100644
--- a/test/link/macho/tbdv3/build.zig
+++ b/test/link/macho/tbdv3/build.zig
@@ -25,7 +25,6 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
});
lib.addCSourceFile(.{ .file = .{ .path = "a.c" }, .flags = &.{} });
lib.linkLibC();
- lib.forceEmit(.bin); // will be referenced by the tbd file
const tbd_file = b.addWriteFile("liba.tbd",
\\--- !tapi-tbd-v3
@@ -47,7 +46,7 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &[0][]const u8{} });
exe.linkSystemLibrary("a");
exe.addLibraryPath(tbd_file.getDirectory());
- exe.addRPath(lib.getEmitDirectory());
+ exe.addRPath(lib.getEmittedBinDirectory());
exe.linkLibC();
const run = b.addRunArtifact(exe);
diff --git a/test/link/macho/weak_library/build.zig b/test/link/macho/weak_library/build.zig
index 3d0819c19b..f66316693e 100644
--- a/test/link/macho/weak_library/build.zig
+++ b/test/link/macho/weak_library/build.zig
@@ -33,8 +33,8 @@ fn add(b: *std.Build, test_step: *std.Build.Step, optimize: std.builtin.Optimize
exe.addCSourceFile(.{ .file = .{ .path = "main.c" }, .flags = &[0][]const u8{} });
exe.linkLibC();
exe.linkSystemLibraryWeak("a");
- exe.addLibraryPath(dylib.getEmitDirectory());
- exe.addRPath(dylib.getEmitDirectory());
+ exe.addLibraryPath(dylib.getEmittedBinDirectory());
+ exe.addRPath(dylib.getEmittedBinDirectory());
const check = exe.checkObject();
check.checkStart();