authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-16 18:58:27-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-04-16 18:58:27-07:00
logdd5a1b1106b3aed3aacd54e9615d96703d29ed9d
tree373bb02788a558180be13e76547149f35206cb61
parent9375ad0d3b5e97fa2889622862dbc4724b9e9243

build.zig: add a way to skip installing lib/ files


1 files changed, 16 insertions(+), 13 deletions(-)

build.zig+16-13
...@@ -53,6 +53,7 @@ pub fn build(b: *Builder) !void {...@@ -53,6 +53,7 @@ pub fn build(b: *Builder) !void {
53 const skip_compile_errors = b.option(bool, "skip-compile-errors", "Main test suite skips compile error tests") orelse false;53 const skip_compile_errors = b.option(bool, "skip-compile-errors", "Main test suite skips compile error tests") orelse false;
54 const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse false;54 const skip_run_translated_c = b.option(bool, "skip-run-translated-c", "Main test suite skips run-translated-c tests") orelse false;
55 const skip_stage2_tests = b.option(bool, "skip-stage2-tests", "Main test suite skips self-hosted compiler tests") orelse false;55 const skip_stage2_tests = b.option(bool, "skip-stage2-tests", "Main test suite skips self-hosted compiler tests") orelse false;
56 const skip_install_lib_files = b.option(bool, "skip-install-lib-files", "Do not copy lib/ files to installation prefix") orelse false;
5657
57 const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;58 const only_install_lib_files = b.option(bool, "lib-files-only", "Only install library files") orelse false;
58 const is_stage1 = b.option(bool, "stage1", "Build the stage1 compiler, put stage2 behind a feature flag") orelse false;59 const is_stage1 = b.option(bool, "stage1", "Build the stage1 compiler, put stage2 behind a feature flag") orelse false;
...@@ -61,19 +62,21 @@ pub fn build(b: *Builder) !void {...@@ -61,19 +62,21 @@ pub fn build(b: *Builder) !void {
61 const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse (is_stage1 or static_llvm);62 const enable_llvm = b.option(bool, "enable-llvm", "Build self-hosted compiler with LLVM backend enabled") orelse (is_stage1 or static_llvm);
62 const config_h_path_option = b.option([]const u8, "config_h", "Path to the generated config.h");63 const config_h_path_option = b.option([]const u8, "config_h", "Path to the generated config.h");
6364
64 b.installDirectory(InstallDirectoryOptions{65 if (!skip_install_lib_files) {
65 .source_dir = "lib",66 b.installDirectory(InstallDirectoryOptions{
66 .install_dir = .Lib,67 .source_dir = "lib",
67 .install_subdir = "zig",68 .install_dir = .Lib,
68 .exclude_extensions = &[_][]const u8{69 .install_subdir = "zig",
69 "test.zig",70 .exclude_extensions = &[_][]const u8{
70 "README.md",71 "test.zig",
71 ".z.0",72 "README.md",
72 ".z.9",73 ".z.0",
73 ".gz",74 ".z.9",
74 "rfc1951.txt",75 ".gz",
75 },76 "rfc1951.txt",
76 });77 },
78 });
79 }
7780
78 if (only_install_lib_files)81 if (only_install_lib_files)
79 return;82 return;