authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-30 20:11:35-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-30 20:11:35-04:00
log2c6827064cf35be261790bfec29f88244c387c06
tree57e3ee36b0f22912d54ad0e399fdb9f6285307df
parent1ec89b02866cdf14b1c4309bbae7d4f5e4ee6ae7

fix regression from previous commit


3 files changed, 11 insertions(+), 10 deletions(-)

example/mix_o_files/build.zig+1-1
...@@ -12,7 +12,7 @@ pub fn build(b: &Builder) {...@@ -12,7 +12,7 @@ pub fn build(b: &Builder) {
1212
13 b.default_step.dependOn(&exe.step);13 b.default_step.dependOn(&exe.step);
1414
15 const run_cmd = b.addCommand(b.cache_root, b.env_map, "./test", [][]const u8{});15 const run_cmd = b.addCommand(".", b.env_map, exe.getOutputPath(), [][]const u8{});
16 run_cmd.step.dependOn(&exe.step);16 run_cmd.step.dependOn(&exe.step);
1717
18 const test_step = b.step("test", "Test the program");18 const test_step = b.step("test", "Test the program");
example/shared_library/build.zig+1-1
...@@ -12,7 +12,7 @@ pub fn build(b: &Builder) {...@@ -12,7 +12,7 @@ pub fn build(b: &Builder) {
1212
13 b.default_step.dependOn(&exe.step);13 b.default_step.dependOn(&exe.step);
1414
15 const run_cmd = b.addCommand(b.cache_root, b.env_map, "./test", [][]const u8{});15 const run_cmd = b.addCommand(".", b.env_map, exe.getOutputPath(), [][]const u8{});
16 run_cmd.step.dependOn(&exe.step);16 run_cmd.step.dependOn(&exe.step);
1717
18 const test_step = b.step("test", "Test the program");18 const test_step = b.step("test", "Test the program");
std/build.zig+9-8
...@@ -505,7 +505,6 @@ pub const Builder = struct {...@@ -505,7 +505,6 @@ pub const Builder = struct {
505 };505 };
506506
507 const term = child.wait() %% |err| {507 const term = child.wait() %% |err| {
508 test (cwd) |yes_cwd| %%io.stderr.printf("cwd: {}\n", yes_cwd);
509 %%io.stderr.printf("Unable to spawn {}: {}\n", exe_path, @errorName(err));508 %%io.stderr.printf("Unable to spawn {}: {}\n", exe_path, @errorName(err));
510 return err;509 return err;
511 };510 };
...@@ -1213,11 +1212,11 @@ pub const CLibExeObjStep = struct {...@@ -1213,11 +1212,11 @@ pub const CLibExeObjStep = struct {
1213 %%cc_args.append("-fPIC");1212 %%cc_args.append("-fPIC");
1214 }1213 }
12151214
1215 const abs_source_file = builder.pathFromRoot(source_file);
1216 %%cc_args.append("-c");1216 %%cc_args.append("-c");
1217 %%cc_args.append(source_file);1217 %%cc_args.append(abs_source_file);
12181218
1219 const rel_src_path = %%os.path.relative(builder.allocator, builder.build_root, source_file);1219 const cache_o_src = %%os.path.join(builder.allocator, builder.cache_root, source_file);
1220 const cache_o_src = %%os.path.join(builder.allocator, builder.cache_root, rel_src_path);
1221 const cache_o_dir = os.path.dirname(cache_o_src);1220 const cache_o_dir = os.path.dirname(cache_o_src);
1222 %return builder.makePath(cache_o_dir);1221 %return builder.makePath(cache_o_dir);
1223 const cache_o_file = builder.fmt("{}{}", cache_o_src, self.target.oFileExt());1222 const cache_o_file = builder.fmt("{}{}", cache_o_src, self.target.oFileExt());
...@@ -1230,7 +1229,7 @@ pub const CLibExeObjStep = struct {...@@ -1230,7 +1229,7 @@ pub const CLibExeObjStep = struct {
12301229
1231 for (self.include_dirs.toSliceConst()) |dir| {1230 for (self.include_dirs.toSliceConst()) |dir| {
1232 %%cc_args.append("-I");1231 %%cc_args.append("-I");
1233 %%cc_args.append(dir);1232 %%cc_args.append(builder.pathFromRoot(dir));
1234 }1233 }
12351234
1236 %return builder.spawnChild(cc, cc_args.toSliceConst());1235 %return builder.spawnChild(cc, cc_args.toSliceConst());
...@@ -1279,11 +1278,11 @@ pub const CLibExeObjStep = struct {...@@ -1279,11 +1278,11 @@ pub const CLibExeObjStep = struct {
1279 for (self.source_files.toSliceConst()) |source_file| {1278 for (self.source_files.toSliceConst()) |source_file| {
1280 %%cc_args.resize(0);1279 %%cc_args.resize(0);
12811280
1281 const abs_source_file = builder.pathFromRoot(source_file);
1282 %%cc_args.append("-c");1282 %%cc_args.append("-c");
1283 %%cc_args.append(builder.pathFromRoot(source_file));1283 %%cc_args.append(abs_source_file);
12841284
1285 const rel_src_path = %%os.path.relative(builder.allocator, builder.build_root, source_file);1285 const cache_o_src = %%os.path.join(builder.allocator, builder.cache_root, source_file);
1286 const cache_o_src = %%os.path.join(builder.allocator, builder.cache_root, rel_src_path);
1287 const cache_o_dir = os.path.dirname(cache_o_src);1286 const cache_o_dir = os.path.dirname(cache_o_src);
1288 %return builder.makePath(cache_o_dir);1287 %return builder.makePath(cache_o_dir);
1289 const cache_o_file = builder.fmt("{}{}", cache_o_src, self.target.oFileExt());1288 const cache_o_file = builder.fmt("{}{}", cache_o_src, self.target.oFileExt());
...@@ -1324,6 +1323,8 @@ pub const CLibExeObjStep = struct {...@@ -1324,6 +1323,8 @@ pub const CLibExeObjStep = struct {
1324 for (self.full_path_libs.toSliceConst()) |full_path_lib| {1323 for (self.full_path_libs.toSliceConst()) |full_path_lib| {
1325 %%cc_args.append(builder.pathFromRoot(full_path_lib));1324 %%cc_args.append(builder.pathFromRoot(full_path_lib));
1326 }1325 }
1326
1327 %return builder.spawnChild(cc, cc_args.toSliceConst());
1327 },1328 },
1328 }1329 }
1329 }1330 }