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

master
Andrew Kelley 2019-09-25 23:57:47 -04:00
parent ed36dbbd9c
commit dc7016344e
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
8 changed files with 15 additions and 54 deletions

View File

@ -601,8 +601,7 @@ else()
endif() endif()
add_custom_target(zig_build_libuserland ALL add_custom_target(zig_build_libuserland ALL
COMMAND zig0 build COMMAND zig0 build
--override-std-dir std --override-lib-dir "${CMAKE_SOURCE_DIR}/lib"
--override-lib-dir "${CMAKE_SOURCE_DIR}"
libuserland install libuserland install
"-Doutput-dir=${CMAKE_BINARY_DIR}" "-Doutput-dir=${CMAKE_BINARY_DIR}"
"-Drelease=${LIBUSERLAND_RELEASE_MODE}" "-Drelease=${LIBUSERLAND_RELEASE_MODE}"

View File

@ -87,11 +87,6 @@ pub fn build(b: *Builder) !void {
.source_dir = "lib", .source_dir = "lib",
.install_dir = .Lib, .install_dir = .Lib,
.install_subdir = "zig", .install_subdir = "zig",
});
b.installDirectory(InstallDirectoryOptions{
.source_dir = "std",
.install_dir = .Lib,
.install_subdir = "zig" ++ fs.path.sep_str ++ "std",
.exclude_extensions = [_][]const u8{ "test.zig", "README.md" }, .exclude_extensions = [_][]const u8{ "test.zig", "README.md" },
}); });
@ -134,9 +129,9 @@ pub fn build(b: *Builder) !void {
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)); 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));
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)); 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));
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)); 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));
test_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes)); test_step.dependOn(tests.addCompareOutputTests(b, test_filter, modes));
test_step.dependOn(tests.addStandaloneTests(b, test_filter, modes)); test_step.dependOn(tests.addStandaloneTests(b, test_filter, modes));

View File

@ -52,7 +52,6 @@ pub const Builder = struct {
cache_root: []const u8, cache_root: []const u8,
release_mode: ?builtin.Mode, release_mode: ?builtin.Mode,
is_release: bool, is_release: bool,
override_std_dir: ?[]const u8,
override_lib_dir: ?[]const u8, override_lib_dir: ?[]const u8,
pkg_config_pkg_list: ?(PkgConfigError![]const PkgConfigPkg) = null, pkg_config_pkg_list: ?(PkgConfigError![]const PkgConfigPkg) = null,
@ -158,7 +157,6 @@ pub const Builder = struct {
}, },
.release_mode = null, .release_mode = null,
.is_release = false, .is_release = false,
.override_std_dir = null,
.override_lib_dir = null, .override_lib_dir = null,
.install_path = undefined, .install_path = undefined,
}; };
@ -1439,7 +1437,6 @@ pub const LibExeObjStep = struct {
bundle_compiler_rt: bool, bundle_compiler_rt: bool,
disable_stack_probing: bool, disable_stack_probing: bool,
c_std: Builder.CStd, c_std: Builder.CStd,
override_std_dir: ?[]const u8,
override_lib_dir: ?[]const u8, override_lib_dir: ?[]const u8,
main_pkg_path: ?[]const u8, main_pkg_path: ?[]const u8,
exec_cmd_args: ?[]const ?[]const u8, exec_cmd_args: ?[]const ?[]const u8,
@ -1570,7 +1567,6 @@ pub const LibExeObjStep = struct {
.build_options_contents = std.Buffer.initSize(builder.allocator, 0) catch unreachable, .build_options_contents = std.Buffer.initSize(builder.allocator, 0) catch unreachable,
.c_std = Builder.CStd.C99, .c_std = Builder.CStd.C99,
.system_linker_hack = false, .system_linker_hack = false,
.override_std_dir = null,
.override_lib_dir = null, .override_lib_dir = null,
.main_pkg_path = null, .main_pkg_path = null,
.exec_cmd_args = null, .exec_cmd_args = null,
@ -1883,8 +1879,8 @@ pub const LibExeObjStep = struct {
self.build_mode = mode; self.build_mode = mode;
} }
pub fn overrideStdDir(self: *LibExeObjStep, dir_path: []const u8) void { pub fn overrideZigLibDir(self: *LibExeObjStep, dir_path: []const u8) void {
self.override_std_dir = dir_path; self.override_lib_dir = self.builder.dupe(dir_path);
} }
pub fn setMainPkgPath(self: *LibExeObjStep, dir_path: []const u8) void { pub fn setMainPkgPath(self: *LibExeObjStep, dir_path: []const u8) void {
@ -2300,14 +2296,6 @@ pub const LibExeObjStep = struct {
} }
} }
if (self.override_std_dir) |dir| {
try zig_args.append("--override-std-dir");
try zig_args.append(builder.pathFromRoot(dir));
} else if (self.builder.override_std_dir) |dir| {
try zig_args.append("--override-std-dir");
try zig_args.append(builder.pathFromRoot(dir));
}
if (self.override_lib_dir) |dir| { if (self.override_lib_dir) |dir| {
try zig_args.append("--override-lib-dir"); try zig_args.append("--override-lib-dir");
try zig_args.append(builder.pathFromRoot(dir)); try zig_args.append(builder.pathFromRoot(dir));

View File

@ -90,11 +90,6 @@ pub fn main() !void {
return usageAndErr(builder, false, try stderr_stream); return usageAndErr(builder, false, try stderr_stream);
}); });
builder.addSearchPrefix(search_prefix); builder.addSearchPrefix(search_prefix);
} else if (mem.eql(u8, arg, "--override-std-dir")) {
builder.override_std_dir = try unwrapArg(arg_it.next(allocator) orelse {
warn("Expected argument after --override-std-dir\n\n");
return usageAndErr(builder, false, try stderr_stream);
});
} else if (mem.eql(u8, arg, "--override-lib-dir")) { } else if (mem.eql(u8, arg, "--override-lib-dir")) {
builder.override_lib_dir = try unwrapArg(arg_it.next(allocator) orelse { builder.override_lib_dir = try unwrapArg(arg_it.next(allocator) orelse {
warn("Expected argument after --override-lib-dir\n\n"); 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 {
\\Advanced Options: \\Advanced Options:
\\ --build-file [file] Override path to build.zig \\ --build-file [file] Override path to build.zig
\\ --cache-dir [path] Override path to zig cache directory \\ --cache-dir [path] Override path to zig cache directory
\\ --override-std-dir [arg] Override path to Zig standard library
\\ --override-lib-dir [arg] Override path to Zig lib directory \\ --override-lib-dir [arg] Override path to Zig lib directory
\\ --verbose-tokenize Enable compiler debug output for tokenization \\ --verbose-tokenize Enable compiler debug output for tokenization
\\ --verbose-ast Enable compiler debug output for parsing into an AST \\ --verbose-ast Enable compiler debug output for parsing into an AST

View File

@ -10367,8 +10367,7 @@ CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType o
ZigLibCInstallation *libc) ZigLibCInstallation *libc)
{ {
CodeGen *child_gen = codegen_create(nullptr, root_src_path, parent_gen->zig_target, out_type, CodeGen *child_gen = codegen_create(nullptr, root_src_path, parent_gen->zig_target, out_type,
parent_gen->build_mode, parent_gen->zig_lib_dir, parent_gen->zig_std_dir, libc, get_stage1_cache_path(), parent_gen->build_mode, parent_gen->zig_lib_dir, libc, get_stage1_cache_path(), false);
false);
child_gen->disable_gen_h = true; child_gen->disable_gen_h = true;
child_gen->want_stack_check = WantStackCheckDisabled; child_gen->want_stack_check = WantStackCheckDisabled;
child_gen->verbose_tokenize = parent_gen->verbose_tokenize; 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
} }
CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget *target, CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget *target,
OutType out_type, BuildMode build_mode, Buf *override_lib_dir, Buf *override_std_dir, OutType out_type, BuildMode build_mode, Buf *override_lib_dir,
ZigLibCInstallation *libc, Buf *cache_dir, bool is_test_build) ZigLibCInstallation *libc, Buf *cache_dir, bool is_test_build)
{ {
CodeGen *g = allocate<CodeGen>(1); CodeGen *g = allocate<CodeGen>(1);
@ -10414,12 +10413,8 @@ CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget
g->zig_lib_dir = override_lib_dir; g->zig_lib_dir = override_lib_dir;
} }
if (override_std_dir == nullptr) { g->zig_std_dir = buf_alloc();
g->zig_std_dir = buf_alloc(); os_path_join(g->zig_lib_dir, buf_create_from_str("std"), g->zig_std_dir);
os_path_join(g->zig_lib_dir, buf_create_from_str("std"), g->zig_std_dir);
} else {
g->zig_std_dir = override_std_dir;
}
g->zig_c_headers_dir = buf_alloc(); g->zig_c_headers_dir = buf_alloc();
os_path_join(g->zig_lib_dir, buf_create_from_str("include"), g->zig_c_headers_dir); os_path_join(g->zig_lib_dir, buf_create_from_str("include"), g->zig_c_headers_dir);

View File

@ -17,7 +17,7 @@
#include <stdio.h> #include <stdio.h>
CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget *target, CodeGen *codegen_create(Buf *main_pkg_path, Buf *root_src_path, const ZigTarget *target,
OutType out_type, BuildMode build_mode, Buf *zig_lib_dir, Buf *override_std_dir, OutType out_type, BuildMode build_mode, Buf *zig_lib_dir,
ZigLibCInstallation *libc, Buf *cache_dir, bool is_test_build); ZigLibCInstallation *libc, Buf *cache_dir, bool is_test_build);
CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType out_type, CodeGen *create_child_codegen(CodeGen *parent_gen, Buf *root_src_path, OutType out_type,

View File

@ -88,8 +88,7 @@ static int print_full_usage(const char *arg0, FILE *file, int return_code) {
" -dirafter [dir] same as -isystem but do it last\n" " -dirafter [dir] same as -isystem but do it last\n"
" -isystem [dir] add additional search path for other .h files\n" " -isystem [dir] add additional search path for other .h files\n"
" -mllvm [arg] (unsupported) forward an arg to LLVM's option processing\n" " -mllvm [arg] (unsupported) forward an arg to LLVM's option processing\n"
" --override-std-dir [arg] override path to Zig standard library\n" " --override-lib-dir [arg] override path to Zig lib directory\n"
" --override-lib-dir [arg] override path to Zig lib library\n"
" -ffunction-sections places each function in a separate section\n" " -ffunction-sections places each function in a separate section\n"
" -D[macro]=[value] define C [macro] to [value] (1 if [value] omitted)\n" " -D[macro]=[value] define C [macro] to [value] (1 if [value] omitted)\n"
"\n" "\n"
@ -490,7 +489,6 @@ int main(int argc, char **argv) {
bool want_single_threaded = false; bool want_single_threaded = false;
bool disable_gen_h = false; bool disable_gen_h = false;
bool bundle_compiler_rt = false; bool bundle_compiler_rt = false;
Buf *override_std_dir = nullptr;
Buf *override_lib_dir = nullptr; Buf *override_lib_dir = nullptr;
Buf *main_pkg_path = nullptr; Buf *main_pkg_path = nullptr;
ValgrindSupport valgrind_support = ValgrindSupportAuto; ValgrindSupport valgrind_support = ValgrindSupportAuto;
@ -526,12 +524,6 @@ int main(int argc, char **argv) {
} else if (i + 1 < argc && strcmp(argv[i], "--cache-dir") == 0) { } else if (i + 1 < argc && strcmp(argv[i], "--cache-dir") == 0) {
cache_dir = argv[i + 1]; cache_dir = argv[i + 1];
i += 1; i += 1;
} else if (i + 1 < argc && strcmp(argv[i], "--override-std-dir") == 0) {
override_std_dir = buf_create_from_str(argv[i + 1]);
i += 1;
args.append("--override-std-dir");
args.append(buf_ptr(override_std_dir));
} else if (i + 1 < argc && strcmp(argv[i], "--override-lib-dir") == 0) { } else if (i + 1 < argc && strcmp(argv[i], "--override-lib-dir") == 0) {
override_lib_dir = buf_create_from_str(argv[i + 1]); override_lib_dir = buf_create_from_str(argv[i + 1]);
i += 1; i += 1;
@ -590,7 +582,7 @@ int main(int argc, char **argv) {
} }
CodeGen *g = codegen_create(main_pkg_path, build_runner_path, &target, OutTypeExe, CodeGen *g = codegen_create(main_pkg_path, build_runner_path, &target, OutTypeExe,
BuildModeDebug, override_lib_dir, override_std_dir, nullptr, &full_cache_dir, false); BuildModeDebug, override_lib_dir, nullptr, &full_cache_dir, false);
g->valgrind_support = valgrind_support; g->valgrind_support = valgrind_support;
g->enable_time_report = timing_info; g->enable_time_report = timing_info;
codegen_set_out_name(g, buf_create_from_str("build")); codegen_set_out_name(g, buf_create_from_str("build"));
@ -787,8 +779,6 @@ int main(int argc, char **argv) {
clang_argv.append(argv[i]); clang_argv.append(argv[i]);
llvm_argv.append(argv[i]); llvm_argv.append(argv[i]);
} else if (strcmp(arg, "--override-std-dir") == 0) {
override_std_dir = buf_create_from_str(argv[i]);
} else if (strcmp(arg, "--override-lib-dir") == 0) { } else if (strcmp(arg, "--override-lib-dir") == 0) {
override_lib_dir = buf_create_from_str(argv[i]); override_lib_dir = buf_create_from_str(argv[i]);
} else if (strcmp(arg, "--main-pkg-path") == 0) { } else if (strcmp(arg, "--main-pkg-path") == 0) {
@ -1036,7 +1026,7 @@ int main(int argc, char **argv) {
} }
case CmdBuiltin: { case CmdBuiltin: {
CodeGen *g = codegen_create(main_pkg_path, nullptr, &target, CodeGen *g = codegen_create(main_pkg_path, nullptr, &target,
out_type, build_mode, override_lib_dir, override_std_dir, nullptr, nullptr, false); out_type, build_mode, override_lib_dir, nullptr, nullptr, false);
codegen_set_strip(g, strip); codegen_set_strip(g, strip);
for (size_t i = 0; i < link_libs.length; i += 1) { for (size_t i = 0; i < link_libs.length; i += 1) {
LinkLib *link_lib = codegen_add_link_lib(g, buf_create_from_str(link_libs.at(i))); 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) {
cache_dir_buf = buf_create_from_str(cache_dir); cache_dir_buf = buf_create_from_str(cache_dir);
} }
CodeGen *g = codegen_create(main_pkg_path, zig_root_source_file, &target, out_type, build_mode, CodeGen *g = codegen_create(main_pkg_path, zig_root_source_file, &target, out_type, build_mode,
override_lib_dir, override_std_dir, libc, cache_dir_buf, cmd == CmdTest); override_lib_dir, libc, cache_dir_buf, cmd == CmdTest);
if (llvm_argv.length >= 2) codegen_set_llvm_argv(g, llvm_argv.items + 1, llvm_argv.length - 2); if (llvm_argv.length >= 2) codegen_set_llvm_argv(g, llvm_argv.items + 1, llvm_argv.length - 2);
g->valgrind_support = valgrind_support; g->valgrind_support = valgrind_support;
g->want_pic = want_pic; g->want_pic = want_pic;

View File

@ -408,7 +408,7 @@ pub fn addPkgTests(
if (test_target.link_libc) { if (test_target.link_libc) {
these_tests.linkSystemLibrary("c"); these_tests.linkSystemLibrary("c");
} }
these_tests.overrideStdDir("std"); these_tests.overrideZigLibDir("lib");
these_tests.enable_wine = is_wine_enabled; these_tests.enable_wine = is_wine_enabled;
these_tests.enable_qemu = is_qemu_enabled; these_tests.enable_qemu = is_qemu_enabled;
these_tests.glibc_multi_install_dir = glibc_dir; these_tests.glibc_multi_install_dir = glibc_dir;