authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-25 23:57:47-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-09-25 23:59:07-04:00
logdc7016344eeb3ba2d58f80968c3df9503e7c72e7
tree2cf21d7ab6f81b3270c90518f6b176ffc8ec3dc7
parented36dbbd9c9dc21b2eebae1b31586fea1c6b51c3
signaturelock-open Commit is signed but in an unrecognized format.

remove --override-std-dir. fix issues caused by moving std lib


8 files changed, 15 insertions(+), 54 deletions(-)

CMakeLists.txt+1-2
......@@ -601,8 +601,7 @@ else()
601601endif()
602602add_custom_target(zig_build_libuserland ALL
603603 COMMAND zig0 build
604 --override-std-dir std
605 --override-lib-dir "${CMAKE_SOURCE_DIR}"
604 --override-lib-dir "${CMAKE_SOURCE_DIR}/lib"
606605 libuserland install
607606 "-Doutput-dir=${CMAKE_BINARY_DIR}"
608607 "-Drelease=${LIBUSERLAND_RELEASE_MODE}"
build.zig+2-7
......@@ -87,11 +87,6 @@ pub fn build(b: *Builder) !void {
8787 .source_dir = "lib",
8888 .install_dir = .Lib,
8989 .install_subdir = "zig",
90 });
91 b.installDirectory(InstallDirectoryOptions{
92 .source_dir = "std",
93 .install_dir = .Lib,
94 .install_subdir = "zig" ++ fs.path.sep_str ++ "std",
9590 .exclude_extensions = [_][]const u8{ "test.zig", "README.md" },
9691 });
9792
......@@ -134,9 +129,9 @@ pub fn build(b: *Builder) !void {
134129
135130 test_step.dependOn(tests.addPkgTests(b, test_filter, "test/stage1/behavior.zig", "behavior", "Run the behavior tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, glibc_multi_dir));
136131
137 test_step.dependOn(tests.addPkgTests(b, test_filter, "std/std.zig", "std", "Run the standard library tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, glibc_multi_dir));
132 test_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/std.zig", "std", "Run the standard library tests", modes, false, skip_non_native, skip_libc, is_wine_enabled, is_qemu_enabled, glibc_multi_dir));
138133
139 test_step.dependOn(tests.addPkgTests(b, test_filter, "std/special/compiler_rt.zig", "compiler-rt", "Run the compiler_rt tests", modes, true, skip_non_native, true, is_wine_enabled, is_qemu_enabled, glibc_multi_dir));
134 test_step.dependOn(tests.addPkgTests(b, test_filter, "lib/std/special/compiler_rt.zig", "compiler-rt", "Run the compiler_rt tests", modes, true, skip_non_native, true, is_wine_enabled, is_qemu_enabled, glibc_multi_dir));
140135
141136 test_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes));
142137 test_step.dependOn(tests.addStandaloneTests(b, test_filter, modes));
lib/std/build.zig+2-14
......@@ -52,7 +52,6 @@ pub const Builder = struct {
5252 cache_root: []const u8,
5353 release_mode: ?builtin.Mode,
5454 is_release: bool,
55 override_std_dir: ?[]const u8,
5655 override_lib_dir: ?[]const u8,
5756
5857 pkg_config_pkg_list: ?(PkgConfigError![]const PkgConfigPkg) = null,
......@@ -158,7 +157,6 @@ pub const Builder = struct {
158157 },
159158 .release_mode = null,
160159 .is_release = false,
161 .override_std_dir = null,
162160 .override_lib_dir = null,
163161 .install_path = undefined,
164162 };
......@@ -1439,7 +1437,6 @@ pub const LibExeObjStep = struct {
14391437 bundle_compiler_rt: bool,
14401438 disable_stack_probing: bool,
14411439 c_std: Builder.CStd,
1442 override_std_dir: ?[]const u8,
14431440 override_lib_dir: ?[]const u8,
14441441 main_pkg_path: ?[]const u8,
14451442 exec_cmd_args: ?[]const ?[]const u8,
......@@ -1570,7 +1567,6 @@ pub const LibExeObjStep = struct {
15701567 .build_options_contents = std.Buffer.initSize(builder.allocator, 0) catch unreachable,
15711568 .c_std = Builder.CStd.C99,
15721569 .system_linker_hack = false,
1573 .override_std_dir = null,
15741570 .override_lib_dir = null,
15751571 .main_pkg_path = null,
15761572 .exec_cmd_args = null,
......@@ -1883,8 +1879,8 @@ pub const LibExeObjStep = struct {
18831879 self.build_mode = mode;
18841880 }
18851881
1886 pub fn overrideStdDir(self: *LibExeObjStep, dir_path: []const u8) void {
1887 self.override_std_dir = dir_path;
1882 pub fn overrideZigLibDir(self: *LibExeObjStep, dir_path: []const u8) void {
1883 self.override_lib_dir = self.builder.dupe(dir_path);
18881884 }
18891885
18901886 pub fn setMainPkgPath(self: *LibExeObjStep, dir_path: []const u8) void {
......@@ -2300,14 +2296,6 @@ pub const LibExeObjStep = struct {
23002296 }
23012297 }
23022298
2303 if (self.override_std_dir) |dir| {
2304 try zig_args.append("--override-std-dir");
2305 try zig_args.append(builder.pathFromRoot(dir));
2306 } else if (self.builder.override_std_dir) |dir| {
2307 try zig_args.append("--override-std-dir");
2308 try zig_args.append(builder.pathFromRoot(dir));
2309 }
2310
23112299 if (self.override_lib_dir) |dir| {
23122300 try zig_args.append("--override-lib-dir");
23132301 try zig_args.append(builder.pathFromRoot(dir));
lib/std/special/build_runner.zig-6
......@@ -90,11 +90,6 @@ pub fn main() !void {
9090 return usageAndErr(builder, false, try stderr_stream);
9191 });
9292 builder.addSearchPrefix(search_prefix);
93 } else if (mem.eql(u8, arg, "--override-std-dir")) {
94 builder.override_std_dir = try unwrapArg(arg_it.next(allocator) orelse {
95 warn("Expected argument after --override-std-dir\n\n");
96 return usageAndErr(builder, false, try stderr_stream);
97 });
9893 } else if (mem.eql(u8, arg, "--override-lib-dir")) {
9994 builder.override_lib_dir = try unwrapArg(arg_it.next(allocator) orelse {
10095 warn("Expected argument after --override-lib-dir\n\n");
......@@ -199,7 +194,6 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: var) !void {
199194 \\Advanced Options:
200195 \\ --build-file [file] Override path to build.zig
201196 \\ --cache-dir [path] Override path to zig cache directory
202 \\ --override-std-dir [arg] Override path to Zig standard library
203197 \\ --override-lib-dir [arg] Override path to Zig lib directory
204198 \\ --verbose-tokenize Enable compiler debug output for tokenization
205199 \\ --verbose-ast Enable compiler debug output for parsing into an AST
src/codegen.cpp+4-9
......@@ -10367,8 +10367,7 @@ CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType o
1036710367 ZigLibCInstallation *libc)
1036810368{
1036910369 CodeGen *child_gen = codegen_create(nullptr, root_src_path, parent_gen->zig_target, out_type,
10370 parent_gen->build_mode, parent_gen->zig_lib_dir, parent_gen->zig_std_dir, libc, get_stage1_cache_path(),
10371 false);
10370 parent_gen->build_mode, parent_gen->zig_lib_dir, libc, get_stage1_cache_path(), false);
1037210371 child_gen->disable_gen_h = true;
1037310372 child_gen->want_stack_check = WantStackCheckDisabled;
1037410373 child_gen->verbose_tokenize = parent_gen->verbose_tokenize;
......@@ -10396,7 +10395,7 @@ CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType o
1039610395}
1039710396
1039810397CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget *target,
10399 OutType out_type, BuildMode build_mode, Buf *override_lib_dir, Buf *override_std_dir,
10398 OutType out_type, BuildMode build_mode, Buf *override_lib_dir,
1040010399 ZigLibCInstallation *libc, Buf *cache_dir, bool is_test_build)
1040110400{
1040210401 CodeGen *g = allocate<CodeGen>(1);
......@@ -10414,12 +10413,8 @@ CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget
1041410413 g->zig_lib_dir = override_lib_dir;
1041510414 }
1041610415
10417 if (override_std_dir == nullptr) {
10418 g->zig_std_dir = buf_alloc();
10419 os_path_join(g->zig_lib_dir, buf_create_from_str("std"), g->zig_std_dir);
10420 } else {
10421 g->zig_std_dir = override_std_dir;
10422 }
10416 g->zig_std_dir = buf_alloc();
10417 os_path_join(g->zig_lib_dir, buf_create_from_str("std"), g->zig_std_dir);
1042310418
1042410419 g->zig_c_headers_dir = buf_alloc();
1042510420 os_path_join(g->zig_lib_dir, buf_create_from_str("include"), g->zig_c_headers_dir);
src/codegen.hpp+1-1
......@@ -17,7 +17,7 @@
1717#include <stdio.h>
1818
1919CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget *target,
20 OutType out_type, BuildMode build_mode, Buf *zig_lib_dir, Buf *override_std_dir,
20 OutType out_type, BuildMode build_mode, Buf *zig_lib_dir,
2121 ZigLibCInstallation *libc, Buf *cache_dir, bool is_test_build);
2222
2323CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType out_type,
src/main.cpp+4-14
......@@ -88,8 +88,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) {
8888 " -dirafter [dir] same as -isystem but do it last\n"
8989 " -isystem [dir] add additional search path for other .h files\n"
9090 " -mllvm [arg] (unsupported) forward an arg to LLVM's option processing\n"
91 " --override-std-dir [arg] override path to Zig standard library\n"
92 " --override-lib-dir [arg] override path to Zig lib library\n"
91 " --override-lib-dir [arg] override path to Zig lib directory\n"
9392 " -ffunction-sections places each function in a separate section\n"
9493 " -D[macro]=[value] define C [macro] to [value] (1 if [value] omitted)\n"
9594 "\n"
......@@ -490,7 +489,6 @@ int main(int argc, char **argv) {
490489 bool want_single_threaded = false;
491490 bool disable_gen_h = false;
492491 bool bundle_compiler_rt = false;
493 Buf *override_std_dir = nullptr;
494492 Buf *override_lib_dir = nullptr;
495493 Buf *main_pkg_path = nullptr;
496494 ValgrindSupport valgrind_support = ValgrindSupportAuto;
......@@ -526,12 +524,6 @@ int main(int argc, char **argv) {
526524 } else if (i + 1 < argc && strcmp(argv[i], "--cache-dir") == 0) {
527525 cache_dir = argv[i + 1];
528526 i += 1;
529 } else if (i + 1 < argc && strcmp(argv[i], "--override-std-dir") == 0) {
530 override_std_dir = buf_create_from_str(argv[i + 1]);
531 i += 1;
532
533 args.append("--override-std-dir");
534 args.append(buf_ptr(override_std_dir));
535527 } else if (i + 1 < argc && strcmp(argv[i], "--override-lib-dir") == 0) {
536528 override_lib_dir = buf_create_from_str(argv[i + 1]);
537529 i += 1;
......@@ -590,7 +582,7 @@ int main(int argc, char **argv) {
590582 }
591583
592584 CodeGen *g = codegen_create(main_pkg_path, build_runner_path, &target, OutTypeExe,
593 BuildModeDebug, override_lib_dir, override_std_dir, nullptr, &full_cache_dir, false);
585 BuildModeDebug, override_lib_dir, nullptr, &full_cache_dir, false);
594586 g->valgrind_support = valgrind_support;
595587 g->enable_time_report = timing_info;
596588 codegen_set_out_name(g, buf_create_from_str("build"));
......@@ -787,8 +779,6 @@ int main(int argc, char **argv) {
787779 clang_argv.append(argv[i]);
788780
789781 llvm_argv.append(argv[i]);
790 } else if (strcmp(arg, "--override-std-dir") == 0) {
791 override_std_dir = buf_create_from_str(argv[i]);
792782 } else if (strcmp(arg, "--override-lib-dir") == 0) {
793783 override_lib_dir = buf_create_from_str(argv[i]);
794784 } else if (strcmp(arg, "--main-pkg-path") == 0) {
......@@ -1036,7 +1026,7 @@ int main(int argc, char **argv) {
10361026 }
10371027 case CmdBuiltin: {
10381028 CodeGen *g = codegen_create(main_pkg_path, nullptr, &target,
1039 out_type, build_mode, override_lib_dir, override_std_dir, nullptr, nullptr, false);
1029 out_type, build_mode, override_lib_dir, nullptr, nullptr, false);
10401030 codegen_set_strip(g, strip);
10411031 for (size_t i = 0; i < link_libs.length; i += 1) {
10421032 LinkLib *link_lib = codegen_add_link_lib(g, buf_create_from_str(link_libs.at(i)));
......@@ -1140,7 +1130,7 @@ int main(int argc, char **argv) {
11401130 cache_dir_buf = buf_create_from_str(cache_dir);
11411131 }
11421132 CodeGen *g = codegen_create(main_pkg_path, zig_root_source_file, &target, out_type, build_mode,
1143 override_lib_dir, override_std_dir, libc, cache_dir_buf, cmd == CmdTest);
1133 override_lib_dir, libc, cache_dir_buf, cmd == CmdTest);
11441134 if (llvm_argv.length >= 2) codegen_set_llvm_argv(g, llvm_argv.items + 1, llvm_argv.length - 2);
11451135 g->valgrind_support = valgrind_support;
11461136 g->want_pic = want_pic;
test/tests.zig+1-1
......@@ -408,7 +408,7 @@ pub fn addPkgTests(
408408 if (test_target.link_libc) {
409409 these_tests.linkSystemLibrary("c");
410410 }
411 these_tests.overrideStdDir("std");
411 these_tests.overrideZigLibDir("lib");
412412 these_tests.enable_wine = is_wine_enabled;
413413 these_tests.enable_qemu = is_qemu_enabled;
414414 these_tests.glibc_multi_install_dir = glibc_dir;