mirror of https://gitlab.com/nakst/essence
extract sysroot for pre built toolchain
This commit is contained in:
parent
187577e8f8
commit
a8e26c63b8
13
util/build.c
13
util/build.c
|
@ -1591,8 +1591,19 @@ void DoCommand(const char *l) {
|
||||||
CallSystem("mv bin/source cross");
|
CallSystem("mv bin/source cross");
|
||||||
CallSystem("mkdir -p cross/bin2");
|
CallSystem("mkdir -p cross/bin2");
|
||||||
CallSystem("gcc -o bin/change_sysroot util/change_sysroot.c -Wall -Wextra");
|
CallSystem("gcc -o bin/change_sysroot util/change_sysroot.c -Wall -Wextra");
|
||||||
|
CallSystem("cross/bin2/" TOOLCHAIN_PREFIX "-gcc --verbose > bin/temp.txt");
|
||||||
|
char *configureFlags = (char *) LoadFile("bin/temp.txt", NULL);
|
||||||
|
char *sysrootPath = strstr(configureFlags, "--with-sysroot=");
|
||||||
|
sysrootPath += 15;
|
||||||
|
char *sysrootPathEnd = strchr(sysrootPath, ' ');
|
||||||
|
if (sysrootPathEnd) *sysrootPathEnd = 0;
|
||||||
|
free(configureFlags);
|
||||||
|
CallSystem("rm bin/temp.txt");
|
||||||
|
fprintf("Detected sysroot from gcc as \"%s\".\n", sysrootPath);
|
||||||
#define MAKE_TOOLCHAIN_WRAPPER(tool) \
|
#define MAKE_TOOLCHAIN_WRAPPER(tool) \
|
||||||
CallSystem("gcc -o cross/bin2/" TOOLCHAIN_PREFIX "-" tool " util/toolchain_wrapper.c -Wall -Wextra -g -DTOOL=" TOOLCHAIN_PREFIX "-" tool)
|
CallSystemF("gcc -o cross/bin2/" TOOLCHAIN_PREFIX "-" tool \
|
||||||
|
" util/toolchain_wrapper.c -Wall -Wextra -g " \
|
||||||
|
" -DCONFIGURE_SYSROOT=\"%s\" -DTOOL=" TOOLCHAIN_PREFIX "-" tool, sysrootPath)
|
||||||
MAKE_TOOLCHAIN_WRAPPER("addr2line");
|
MAKE_TOOLCHAIN_WRAPPER("addr2line");
|
||||||
MAKE_TOOLCHAIN_WRAPPER("ar");
|
MAKE_TOOLCHAIN_WRAPPER("ar");
|
||||||
MAKE_TOOLCHAIN_WRAPPER("as");
|
MAKE_TOOLCHAIN_WRAPPER("as");
|
||||||
|
|
|
@ -28,7 +28,7 @@ int main(int argc, char **argv) {
|
||||||
// printf("'%s'\n", tool);
|
// printf("'%s'\n", tool);
|
||||||
char **newArgv = (char **) calloc(sizeof(char *), (argc + 4));
|
char **newArgv = (char **) calloc(sizeof(char *), (argc + 4));
|
||||||
newArgv[0] = change;
|
newArgv[0] = change;
|
||||||
newArgv[1] = "/home/runner/work/build-gcc/build-gcc/essence/root/";
|
newArgv[1] = CONFIGURE_SYSROOT;
|
||||||
newArgv[2] = sysroot;
|
newArgv[2] = sysroot;
|
||||||
newArgv[3] = tool;
|
newArgv[3] = tool;
|
||||||
memcpy(newArgv + 4, argv + 1, (argc - 1) * sizeof(char *));
|
memcpy(newArgv + 4, argv + 1, (argc - 1) * sizeof(char *));
|
||||||
|
|
Loading…
Reference in New Issue