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()...@@ -601,8 +601,7 @@ else()
601endif()601endif()
602add_custom_target(zig_build_libuserland ALL602add_custom_target(zig_build_libuserland ALL
603 COMMAND zig0 build603 COMMAND zig0 build
604 --override-std-dir std604 --override-lib-dir "${CMAKE_SOURCE_DIR}/lib"
605 --override-lib-dir "${CMAKE_SOURCE_DIR}"
606 libuserland install605 libuserland install
607 "-Doutput-dir=${CMAKE_BINARY_DIR}"606 "-Doutput-dir=${CMAKE_BINARY_DIR}"
608 "-Drelease=${LIBUSERLAND_RELEASE_MODE}"607 "-Drelease=${LIBUSERLAND_RELEASE_MODE}"
build.zig+2-7
...@@ -87,11 +87,6 @@ pub fn build(b: *Builder) !void {...@@ -87,11 +87,6 @@ pub fn build(b: *Builder) !void {
87 .source_dir = "lib",87 .source_dir = "lib",
88 .install_dir = .Lib,88 .install_dir = .Lib,
89 .install_subdir = "zig",89 .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",
95 .exclude_extensions = [_][]const u8{ "test.zig", "README.md" },90 .exclude_extensions = [_][]const u8{ "test.zig", "README.md" },
96 });91 });
9792
...@@ -134,9 +129,9 @@ pub fn build(b: *Builder) !void {...@@ -134,9 +129,9 @@ pub fn build(b: *Builder) !void {
134129
135 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));130 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
141 test_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes));136 test_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes));
142 test_step.dependOn(tests.addStandaloneTests(b, test_filter, modes));137 test_step.dependOn(tests.addStandaloneTests(b, test_filter, modes));
lib/std/build.zig+2-14
...@@ -52,7 +52,6 @@ pub const Builder = struct {...@@ -52,7 +52,6 @@ pub const Builder = struct {
52 cache_root: []const u8,52 cache_root: []const u8,
53 release_mode: ?builtin.Mode,53 release_mode: ?builtin.Mode,
54 is_release: bool,54 is_release: bool,
55 override_std_dir: ?[]const u8,
56 override_lib_dir: ?[]const u8,55 override_lib_dir: ?[]const u8,
5756
58 pkg_config_pkg_list: ?(PkgConfigError![]const PkgConfigPkg) = null,57 pkg_config_pkg_list: ?(PkgConfigError![]const PkgConfigPkg) = null,
...@@ -158,7 +157,6 @@ pub const Builder = struct {...@@ -158,7 +157,6 @@ pub const Builder = struct {
158 },157 },
159 .release_mode = null,158 .release_mode = null,
160 .is_release = false,159 .is_release = false,
161 .override_std_dir = null,
162 .override_lib_dir = null,160 .override_lib_dir = null,
163 .install_path = undefined,161 .install_path = undefined,
164 };162 };
...@@ -1439,7 +1437,6 @@ pub const LibExeObjStep = struct {...@@ -1439,7 +1437,6 @@ pub const LibExeObjStep = struct {
1439 bundle_compiler_rt: bool,1437 bundle_compiler_rt: bool,
1440 disable_stack_probing: bool,1438 disable_stack_probing: bool,
1441 c_std: Builder.CStd,1439 c_std: Builder.CStd,
1442 override_std_dir: ?[]const u8,
1443 override_lib_dir: ?[]const u8,1440 override_lib_dir: ?[]const u8,
1444 main_pkg_path: ?[]const u8,1441 main_pkg_path: ?[]const u8,
1445 exec_cmd_args: ?[]const ?[]const u8,1442 exec_cmd_args: ?[]const ?[]const u8,
...@@ -1570,7 +1567,6 @@ pub const LibExeObjStep = struct {...@@ -1570,7 +1567,6 @@ pub const LibExeObjStep = struct {
1570 .build_options_contents = std.Buffer.initSize(builder.allocator, 0) catch unreachable,1567 .build_options_contents = std.Buffer.initSize(builder.allocator, 0) catch unreachable,
1571 .c_std = Builder.CStd.C99,1568 .c_std = Builder.CStd.C99,
1572 .system_linker_hack = false,1569 .system_linker_hack = false,
1573 .override_std_dir = null,
1574 .override_lib_dir = null,1570 .override_lib_dir = null,
1575 .main_pkg_path = null,1571 .main_pkg_path = null,
1576 .exec_cmd_args = null,1572 .exec_cmd_args = null,
...@@ -1883,8 +1879,8 @@ pub const LibExeObjStep = struct {...@@ -1883,8 +1879,8 @@ pub const LibExeObjStep = struct {
1883 self.build_mode = mode;1879 self.build_mode = mode;
1884 }1880 }
18851881
1886 pub fn overrideStdDir(self: *LibExeObjStep, dir_path: []const u8) void {1882 pub fn overrideZigLibDir(self: *LibExeObjStep, dir_path: []const u8) void {
1887 self.override_std_dir = dir_path;1883 self.override_lib_dir = self.builder.dupe(dir_path);
1888 }1884 }
18891885
1890 pub fn setMainPkgPath(self: *LibExeObjStep, dir_path: []const u8) void {1886 pub fn setMainPkgPath(self: *LibExeObjStep, dir_path: []const u8) void {
...@@ -2300,14 +2296,6 @@ pub const LibExeObjStep = struct {...@@ -2300,14 +2296,6 @@ pub const LibExeObjStep = struct {
2300 }2296 }
2301 }2297 }
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
2311 if (self.override_lib_dir) |dir| {2299 if (self.override_lib_dir) |dir| {
2312 try zig_args.append("--override-lib-dir");2300 try zig_args.append("--override-lib-dir");
2313 try zig_args.append(builder.pathFromRoot(dir));2301 try zig_args.append(builder.pathFromRoot(dir));
lib/std/special/build_runner.zig-6
...@@ -90,11 +90,6 @@ pub fn main() !void {...@@ -90,11 +90,6 @@ pub fn main() !void {
90 return usageAndErr(builder, false, try stderr_stream);90 return usageAndErr(builder, false, try stderr_stream);
91 });91 });
92 builder.addSearchPrefix(search_prefix);92 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 });
98 } else if (mem.eql(u8, arg, "--override-lib-dir")) {93 } else if (mem.eql(u8, arg, "--override-lib-dir")) {
99 builder.override_lib_dir = try unwrapArg(arg_it.next(allocator) orelse {94 builder.override_lib_dir = try unwrapArg(arg_it.next(allocator) orelse {
100 warn("Expected argument after --override-lib-dir\n\n");95 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 {...@@ -199,7 +194,6 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: var) !void {
199 \\Advanced Options:194 \\Advanced Options:
200 \\ --build-file [file] Override path to build.zig195 \\ --build-file [file] Override path to build.zig
201 \\ --cache-dir [path] Override path to zig cache directory196 \\ --cache-dir [path] Override path to zig cache directory
202 \\ --override-std-dir [arg] Override path to Zig standard library
203 \\ --override-lib-dir [arg] Override path to Zig lib directory197 \\ --override-lib-dir [arg] Override path to Zig lib directory
204 \\ --verbose-tokenize Enable compiler debug output for tokenization198 \\ --verbose-tokenize Enable compiler debug output for tokenization
205 \\ --verbose-ast Enable compiler debug output for parsing into an AST199 \\ --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...@@ -10367,8 +10367,7 @@ CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType o
10367 ZigLibCInstallation *libc)10367 ZigLibCInstallation *libc)
10368{10368{
10369 CodeGen *child_gen = codegen_create(nullptr, root_src_path, parent_gen->zig_target, out_type,10369 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(),10370 parent_gen->build_mode, parent_gen->zig_lib_dir, libc, get_stage1_cache_path(), false);
10371 false);
10372 child_gen->disable_gen_h = true;10371 child_gen->disable_gen_h = true;
10373 child_gen->want_stack_check = WantStackCheckDisabled;10372 child_gen->want_stack_check = WantStackCheckDisabled;
10374 child_gen->verbose_tokenize = parent_gen->verbose_tokenize;10373 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...@@ -10396,7 +10395,7 @@ CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType o
10396}10395}
1039710396
10398CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget *target,10397CodeGen *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,
10400 ZigLibCInstallation *libc, Buf *cache_dir, bool is_test_build)10399 ZigLibCInstallation *libc, Buf *cache_dir, bool is_test_build)
10401{10400{
10402 CodeGen *g = allocate<CodeGen>(1);10401 CodeGen *g = allocate<CodeGen>(1);
...@@ -10414,12 +10413,8 @@ CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget...@@ -10414,12 +10413,8 @@ CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget
10414 g->zig_lib_dir = override_lib_dir;10413 g->zig_lib_dir = override_lib_dir;
10415 }10414 }
1041610415
10417 if (override_std_dir == nullptr) {10416 g->zig_std_dir = buf_alloc();
10418 g->zig_std_dir = buf_alloc();10417 os_path_join(g->zig_lib_dir, buf_create_from_str("std"), g->zig_std_dir);
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 }
1042310418
10424 g->zig_c_headers_dir = buf_alloc();10419 g->zig_c_headers_dir = buf_alloc();
10425 os_path_join(g->zig_lib_dir, buf_create_from_str("include"), g->zig_c_headers_dir);10420 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 @@...@@ -17,7 +17,7 @@
17#include <stdio.h>17#include <stdio.h>
1818
19CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget *target,19CodeGen *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,
21 ZigLibCInstallation *libc, Buf *cache_dir, bool is_test_build);21 ZigLibCInstallation *libc, Buf *cache_dir, bool is_test_build);
2222
23CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType out_type,23CodeGen *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) {...@@ -88,8 +88,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) {
88 " -dirafter [dir] same as -isystem but do it last\n"88 " -dirafter [dir] same as -isystem but do it last\n"
89 " -isystem [dir] add additional search path for other .h files\n"89 " -isystem [dir] add additional search path for other .h files\n"
90 " -mllvm [arg] (unsupported) forward an arg to LLVM's option processing\n"90 " -mllvm [arg] (unsupported) forward an arg to LLVM's option processing\n"
91 " --override-std-dir [arg] override path to Zig standard library\n"91 " --override-lib-dir [arg] override path to Zig lib directory\n"
92 " --override-lib-dir [arg] override path to Zig lib library\n"
93 " -ffunction-sections places each function in a separate section\n"92 " -ffunction-sections places each function in a separate section\n"
94 " -D[macro]=[value] define C [macro] to [value] (1 if [value] omitted)\n"93 " -D[macro]=[value] define C [macro] to [value] (1 if [value] omitted)\n"
95 "\n"94 "\n"
...@@ -490,7 +489,6 @@ int main(int argc, char **argv) {...@@ -490,7 +489,6 @@ int main(int argc, char **argv) {
490 bool want_single_threaded = false;489 bool want_single_threaded = false;
491 bool disable_gen_h = false;490 bool disable_gen_h = false;
492 bool bundle_compiler_rt = false;491 bool bundle_compiler_rt = false;
493 Buf *override_std_dir = nullptr;
494 Buf *override_lib_dir = nullptr;492 Buf *override_lib_dir = nullptr;
495 Buf *main_pkg_path = nullptr;493 Buf *main_pkg_path = nullptr;
496 ValgrindSupport valgrind_support = ValgrindSupportAuto;494 ValgrindSupport valgrind_support = ValgrindSupportAuto;
...@@ -526,12 +524,6 @@ int main(int argc, char **argv) {...@@ -526,12 +524,6 @@ int main(int argc, char **argv) {
526 } else if (i + 1 < argc && strcmp(argv[i], "--cache-dir") == 0) {524 } else if (i + 1 < argc && strcmp(argv[i], "--cache-dir") == 0) {
527 cache_dir = argv[i + 1];525 cache_dir = argv[i + 1];
528 i += 1;526 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));
535 } else if (i + 1 < argc && strcmp(argv[i], "--override-lib-dir") == 0) {527 } else if (i + 1 < argc && strcmp(argv[i], "--override-lib-dir") == 0) {
536 override_lib_dir = buf_create_from_str(argv[i + 1]);528 override_lib_dir = buf_create_from_str(argv[i + 1]);
537 i += 1;529 i += 1;
...@@ -590,7 +582,7 @@ int main(int argc, char **argv) {...@@ -590,7 +582,7 @@ int main(int argc, char **argv) {
590 }582 }
591583
592 CodeGen *g = codegen_create(main_pkg_path, build_runner_path, &target, OutTypeExe,584 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);
594 g->valgrind_support = valgrind_support;586 g->valgrind_support = valgrind_support;
595 g->enable_time_report = timing_info;587 g->enable_time_report = timing_info;
596 codegen_set_out_name(g, buf_create_from_str("build"));588 codegen_set_out_name(g, buf_create_from_str("build"));
...@@ -787,8 +779,6 @@ int main(int argc, char **argv) {...@@ -787,8 +779,6 @@ int main(int argc, char **argv) {
787 clang_argv.append(argv[i]);779 clang_argv.append(argv[i]);
788780
789 llvm_argv.append(argv[i]);781 llvm_argv.append(argv[i]);
790 } else if (strcmp(arg, "--override-std-dir") == 0) {
791 override_std_dir = buf_create_from_str(argv[i]);
792 } else if (strcmp(arg, "--override-lib-dir") == 0) {782 } else if (strcmp(arg, "--override-lib-dir") == 0) {
793 override_lib_dir = buf_create_from_str(argv[i]);783 override_lib_dir = buf_create_from_str(argv[i]);
794 } else if (strcmp(arg, "--main-pkg-path") == 0) {784 } else if (strcmp(arg, "--main-pkg-path") == 0) {
...@@ -1036,7 +1026,7 @@ int main(int argc, char **argv) {...@@ -1036,7 +1026,7 @@ int main(int argc, char **argv) {
1036 }1026 }
1037 case CmdBuiltin: {1027 case CmdBuiltin: {
1038 CodeGen *g = codegen_create(main_pkg_path, nullptr, &target,1028 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);
1040 codegen_set_strip(g, strip);1030 codegen_set_strip(g, strip);
1041 for (size_t i = 0; i < link_libs.length; i += 1) {1031 for (size_t i = 0; i < link_libs.length; i += 1) {
1042 LinkLib *link_lib = codegen_add_link_lib(g, buf_create_from_str(link_libs.at(i)));1032 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) {...@@ -1140,7 +1130,7 @@ int main(int argc, char **argv) {
1140 cache_dir_buf = buf_create_from_str(cache_dir);1130 cache_dir_buf = buf_create_from_str(cache_dir);
1141 }1131 }
1142 CodeGen *g = codegen_create(main_pkg_path, zig_root_source_file, &target, out_type, build_mode,1132 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);
1144 if (llvm_argv.length >= 2) codegen_set_llvm_argv(g, llvm_argv.items + 1, llvm_argv.length - 2);1134 if (llvm_argv.length >= 2) codegen_set_llvm_argv(g, llvm_argv.items + 1, llvm_argv.length - 2);
1145 g->valgrind_support = valgrind_support;1135 g->valgrind_support = valgrind_support;
1146 g->want_pic = want_pic;1136 g->want_pic = want_pic;
test/tests.zig+1-1
...@@ -408,7 +408,7 @@ pub fn addPkgTests(...@@ -408,7 +408,7 @@ pub fn addPkgTests(
408 if (test_target.link_libc) {408 if (test_target.link_libc) {
409 these_tests.linkSystemLibrary("c");409 these_tests.linkSystemLibrary("c");
410 }410 }
411 these_tests.overrideStdDir("std");411 these_tests.overrideZigLibDir("lib");
412 these_tests.enable_wine = is_wine_enabled;412 these_tests.enable_wine = is_wine_enabled;
413 these_tests.enable_qemu = is_qemu_enabled;413 these_tests.enable_qemu = is_qemu_enabled;
414 these_tests.glibc_multi_install_dir = glibc_dir;414 these_tests.glibc_multi_install_dir = glibc_dir;