authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-23 11:09:26-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-04-23 11:09:26-04:00
logf9fa768dca1f16dea6e62213a8c0e77538285033
tree898e19c08ef02d16d0f3d8004a121a67b3d89a92
parent0f633167c5228e2f042775354376cdfa54c84879

zig build system: installFile and installClibrary

See #332

1 files changed, 10 insertions(+), 4 deletions(-)

std/build.zig+10-4
......@@ -569,6 +569,10 @@ pub const Builder = struct {
569569 }
570570
571571 fn copyFile(self: &Builder, source_path: []const u8, dest_path: []const u8) {
572 const dirname = os.path.dirname(dest_path);
573 os.makePath(self.allocator, dirname) %% |err| {
574 debug.panic("Unable to create path {}: {}", dirname, @errorName(err));
575 };
572576 os.copyFile(self.allocator, source_path, dest_path) %% |err| {
573577 debug.panic("Unable to copy {} to {}: {}", source_path, dest_path, @errorName(err));
574578 };
......@@ -1725,11 +1729,14 @@ pub const InstallCLibraryStep = struct {
17251729
17261730 fn make(step: &Step) -> %void {
17271731 const self = @fieldParentPtr(InstallCLibraryStep, "step", step);
1732 const builder = self.builder;
17281733
17291734 self.builder.copyFile(self.lib.out_filename, self.dest_file);
17301735 if (!self.lib.static) {
1731 %%os.atomicSymLink(self.builder.allocator, self.lib.out_filename, self.lib.major_only_filename);
1732 %%os.atomicSymLink(self.builder.allocator, self.lib.major_only_filename, self.lib.name_only_filename);
1736 const dest_major_only = %%os.path.join(builder.allocator, builder.lib_dir, self.lib.major_only_filename);
1737 const dest_name_only = %%os.path.join(builder.allocator, builder.lib_dir, self.lib.name_only_filename);
1738 %%os.atomicSymLink(self.builder.allocator, self.lib.out_filename, dest_major_only);
1739 %%os.atomicSymLink(self.builder.allocator, self.lib.major_only_filename, dest_name_only);
17331740 }
17341741 }
17351742};
......@@ -1751,8 +1758,7 @@ pub const InstallFileStep = struct {
17511758
17521759 fn make(step: &Step) -> %void {
17531760 const self = @fieldParentPtr(InstallFileStep, "step", step);
1754
1755 debug.panic("TODO install file");
1761 self.builder.copyFile(self.src_path, self.dest_path);
17561762 }
17571763};
17581764