add --each-lib-rpath option and corresponding config option

This adds an rpath entry for each used dynamic library directory.
This is necessary on some systems such as NixOS.
This commit is contained in:
Andrew Kelley committed 2017-03-13 13:11:55 -04:00
1 parent d10bbd28e9
commit 7efa2cd81c
9 files changed
+61 -4

No files matched your search

+8
View File
@@ -90,6 +90,7 @@ CodeGen *codegen_create(Buf *root_source_dir, const ZigTarget *target) {
g->libc_static_lib_dir = buf_create_from_str("");
g->libc_include_dir = buf_create_from_str("");
g->darwin_linker_version = buf_create_from_str("");
g->each_lib_rpath = false;
} else {
// native compilation, we can rely on the configuration stuff
g->is_native_target = true;
@@ -100,6 +101,9 @@ CodeGen *codegen_create(Buf *root_source_dir, const ZigTarget *target) {
g->libc_static_lib_dir = buf_create_from_str(ZIG_LIBC_STATIC_LIB_DIR);
g->libc_include_dir = buf_create_from_str(ZIG_LIBC_INCLUDE_DIR);
g->darwin_linker_version = buf_create_from_str(ZIG_HOST_LINK_VERSION);
#ifdef ZIG_EACH_LIB_RPATH
g->each_lib_rpath = true;
#endif
if (g->zig_target.os == ZigLLVM_Darwin ||
g->zig_target.os == ZigLLVM_MacOSX ||
@@ -138,6 +142,10 @@ void codegen_set_check_unused(CodeGen *g, bool check_unused) {
g->check_unused = check_unused;
}
void codegen_set_each_lib_rpath(CodeGen *g, bool each_lib_rpath) {
g->each_lib_rpath = each_lib_rpath;
}
void codegen_set_errmsg_color(CodeGen *g, ErrColor err_color) {
g->err_color = err_color;
}