mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Configurable Linux crt/crtbegin paths.
This commit is contained in:
committed by
Christoffer Lerno
parent
4cf98dab93
commit
b30d130d92
@@ -159,7 +159,11 @@ static void usage(void)
|
|||||||
OUTPUT(" --wincrt=<option> - Windows CRT linking: none, static, dynamic (default).");
|
OUTPUT(" --wincrt=<option> - Windows CRT linking: none, static, dynamic (default).");
|
||||||
OUTPUT("");
|
OUTPUT("");
|
||||||
OUTPUT(" --macossdk <dir> - Set the directory for the MacOS SDK for cross compilation.");
|
OUTPUT(" --macossdk <dir> - Set the directory for the MacOS SDK for cross compilation.");
|
||||||
|
OUTPUT(" --macos-min-version <ver> - Set the minimum MacOS version to compile for.");
|
||||||
|
OUTPUT(" --macos-sdk-version <ver> - Set the MacOS SDK compiled for.");
|
||||||
|
OUTPUT("");
|
||||||
|
OUTPUT(" --linux-crt <dir> - Set the directory to use for finding crt1.o and related files.");
|
||||||
|
OUTPUT(" --linux-crtbegin <dir> - Set the directory to use for finding crtbegin.o and related files.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -807,6 +811,18 @@ static void parse_option(BuildOptions *options)
|
|||||||
options->path = check_dir(next_arg());
|
options->path = check_dir(next_arg());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (match_longopt("linux-crt"))
|
||||||
|
{
|
||||||
|
if (at_end() || next_is_opt()) error_exit("error: --linux-crt needs a directory.");
|
||||||
|
options->linuxpaths.crt = check_dir(next_arg());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (match_longopt("linux-crtbegin"))
|
||||||
|
{
|
||||||
|
if (at_end() || next_is_opt()) error_exit("error: --linux-crtbegin needs a directory.");
|
||||||
|
options->linuxpaths.crtbegin = check_dir(next_arg());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (match_longopt("safe"))
|
if (match_longopt("safe"))
|
||||||
{
|
{
|
||||||
options->safe_mode = 1;
|
options->safe_mode = 1;
|
||||||
|
|||||||
@@ -297,6 +297,10 @@ typedef struct BuildOptions_
|
|||||||
const char *min_version;
|
const char *min_version;
|
||||||
const char *sdk_version;
|
const char *sdk_version;
|
||||||
} macos;
|
} macos;
|
||||||
|
struct {
|
||||||
|
const char *crt;
|
||||||
|
const char *crtbegin;
|
||||||
|
} linuxpaths;
|
||||||
int build_threads;
|
int build_threads;
|
||||||
const char** libraries_to_fetch;
|
const char** libraries_to_fetch;
|
||||||
const char** files;
|
const char** files;
|
||||||
@@ -456,6 +460,11 @@ typedef struct
|
|||||||
WinCrtLinking crt_linking;
|
WinCrtLinking crt_linking;
|
||||||
bool use_win_subsystem;
|
bool use_win_subsystem;
|
||||||
} win;
|
} win;
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
const char *crt;
|
||||||
|
const char *crtbegin;
|
||||||
|
} linuxpaths;
|
||||||
} BuildTarget;
|
} BuildTarget;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -243,6 +243,8 @@ static void update_build_target_from_options(BuildTarget *target, BuildOptions *
|
|||||||
if (options->macos.min_version) target->macos.min_version = options->macos.min_version;
|
if (options->macos.min_version) target->macos.min_version = options->macos.min_version;
|
||||||
if (options->macos.sdk_version) target->macos.sdk_version = options->macos.sdk_version;
|
if (options->macos.sdk_version) target->macos.sdk_version = options->macos.sdk_version;
|
||||||
if (options->win.crt_linking != WIN_CRT_DEFAULT) target->win.crt_linking = options->win.crt_linking;
|
if (options->win.crt_linking != WIN_CRT_DEFAULT) target->win.crt_linking = options->win.crt_linking;
|
||||||
|
if (options->linuxpaths.crt) target->linuxpaths.crt = options->linuxpaths.crt;
|
||||||
|
if (options->linuxpaths.crtbegin) target->linuxpaths.crtbegin = options->linuxpaths.crtbegin;
|
||||||
if (options->x86_vector_capability != X86VECTOR_DEFAULT)
|
if (options->x86_vector_capability != X86VECTOR_DEFAULT)
|
||||||
{
|
{
|
||||||
target->feature.x86_vector_capability = options->x86_vector_capability;
|
target->feature.x86_vector_capability = options->x86_vector_capability;
|
||||||
|
|||||||
@@ -374,6 +374,12 @@ static void load_into_build_target(JSONObject *json, const char *type, BuildTarg
|
|||||||
// macos-sdk-version
|
// macos-sdk-version
|
||||||
target->macos.sdk_version = get_valid_string(json, "macos-sdk-version", type, false);
|
target->macos.sdk_version = get_valid_string(json, "macos-sdk-version", type, false);
|
||||||
|
|
||||||
|
// Linux crt
|
||||||
|
target->linuxpaths.crt = get_valid_string(json, "linux-crt", type, false);
|
||||||
|
|
||||||
|
// Linux crtbegin
|
||||||
|
target->linuxpaths.crtbegin = get_valid_string(json, "linux-crtbegin", type, false);
|
||||||
|
|
||||||
// version
|
// version
|
||||||
const char *version = get_valid_string(json, "version", type, false);
|
const char *version = get_valid_string(json, "version", type, false);
|
||||||
if (version) target->version = version;
|
if (version) target->version = version;
|
||||||
|
|||||||
@@ -340,6 +340,7 @@ static const char *find_freebsd_crt(void)
|
|||||||
|
|
||||||
static const char *find_linux_crt(void)
|
static const char *find_linux_crt(void)
|
||||||
{
|
{
|
||||||
|
if (active_target.linuxpaths.crt) return active_target.linuxpaths.crt;
|
||||||
#if PLATFORM_POSIX
|
#if PLATFORM_POSIX
|
||||||
glob_t globbuf;
|
glob_t globbuf;
|
||||||
if (!glob("/usr/lib/*/crt1.o", 0, NULL, &globbuf) && globbuf.gl_pathc)
|
if (!glob("/usr/lib/*/crt1.o", 0, NULL, &globbuf) && globbuf.gl_pathc)
|
||||||
@@ -362,6 +363,7 @@ static const char *find_linux_crt(void)
|
|||||||
|
|
||||||
static const char *find_linux_crt_begin(void)
|
static const char *find_linux_crt_begin(void)
|
||||||
{
|
{
|
||||||
|
if (active_target.linuxpaths.crtbegin) return active_target.linuxpaths.crtbegin;
|
||||||
#if PLATFORM_POSIX
|
#if PLATFORM_POSIX
|
||||||
glob_t globbuf;
|
glob_t globbuf;
|
||||||
if (!glob("/usr/lib/gcc/*/*/crtbegin.o", 0, NULL, &globbuf) && globbuf.gl_pathc)
|
if (!glob("/usr/lib/gcc/*/*/crtbegin.o", 0, NULL, &globbuf) && globbuf.gl_pathc)
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#define COMPILER_VERSION "0.4.518"
|
#define COMPILER_VERSION "0.4.519"
|
||||||
Reference in New Issue
Block a user