mirror of https://gitlab.com/nakst/essence
restore cross compile build
This commit is contained in:
parent
7a13233be0
commit
3656e8c817
7
start.sh
7
start.sh
|
@ -61,6 +61,13 @@ if [ $? -ne 0 ]; then
|
|||
exit
|
||||
fi
|
||||
|
||||
# Check make is available.
|
||||
make --version > /dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Missing make."
|
||||
exit
|
||||
fi
|
||||
|
||||
# Compile and run Build.
|
||||
gcc -o bin/build -g util/build.c -pthread -DPARALLEL_BUILD -D${ES_TARGET-TARGET_X86_64} \
|
||||
-Wall -Wextra -Wno-format-security -Wno-format-overflow -Wno-missing-field-initializers -Wno-unused-function -Wno-format-truncation \
|
||||
|
|
48
util/build.c
48
util/build.c
|
@ -589,42 +589,9 @@ void BuildCrossCompiler() {
|
|||
exit(0);
|
||||
}
|
||||
|
||||
bool usePreBuilt;
|
||||
|
||||
{
|
||||
printf("\n");
|
||||
printf("To build Essence, you need a cross compiler.\n");
|
||||
#ifdef __linux__
|
||||
printf("You can either use a pre-built cross compiler (~40MB download), or build one locally.\n");
|
||||
printf("Type 'yes' if you want to use the pre-built cross compiler.\n");
|
||||
usePreBuilt = automatedBuild || GetYes();
|
||||
#else
|
||||
printf("A cross compiler will be built for you automatically.\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
if (usePreBuilt) {
|
||||
DoCommand("get-source prefix https://github.com/nakst/build-gcc-x86_64-essence/releases/download/gcc-v11.1.0/out.tar.xz");
|
||||
if (CallSystem("mv bin/source cross")) goto fail;
|
||||
if (CallSystem("mkdir -p cross/bin2")) goto fail;
|
||||
foundValidCrossCompiler = true;
|
||||
getcwd(compilerPath, sizeof(compilerPath));
|
||||
strcat(compilerPath, "/cross/bin2");
|
||||
if (CallSystem("gcc -o bin/change_sysroot util/change_sysroot.c -Wall -Wextra")) goto fail;
|
||||
#define MAKE_TOOLCHAIN_WRAPPER(tool) \
|
||||
if (CallSystem("gcc -o cross/bin2/" TOOLCHAIN_PREFIX "-" tool " util/toolchain_wrapper.c -Wall -Wextra -g -DTOOL=" TOOLCHAIN_PREFIX "-" tool)) goto fail;
|
||||
MAKE_TOOLCHAIN_WRAPPER("ar");
|
||||
MAKE_TOOLCHAIN_WRAPPER("gcc");
|
||||
MAKE_TOOLCHAIN_WRAPPER("g++");
|
||||
MAKE_TOOLCHAIN_WRAPPER("ld");
|
||||
MAKE_TOOLCHAIN_WRAPPER("nm");
|
||||
MAKE_TOOLCHAIN_WRAPPER("strip");
|
||||
if (!AddCompilerToPath()) goto fail;
|
||||
SaveConfig();
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
printf("To build Essence, you need a cross compiler. This will be built for you automatically.\n");
|
||||
printf("- You need to be connected to the internet. ~100MB will be downloaded.\n");
|
||||
printf("- You need ~3GB of drive space available.\n");
|
||||
printf("- You need ~8GB of RAM available.\n");
|
||||
|
@ -1602,6 +1569,19 @@ void DoCommand(const char *l) {
|
|||
getcwd(cwd, sizeof(cwd));
|
||||
strcat(cwd, "/crash-report.tar.gz");
|
||||
fprintf(stderr, "Crash report made at " ColorHighlight "%s" ColorNormal ".\n", cwd);
|
||||
} else if (0 == strcmp(l, "setup-pre-built-toolchain")) {
|
||||
if (CallSystem("mv bin/source cross")) goto fail;
|
||||
if (CallSystem("mkdir -p cross/bin2")) goto fail;
|
||||
if (CallSystem("gcc -o bin/change_sysroot util/change_sysroot.c -Wall -Wextra")) goto fail;
|
||||
#define MAKE_TOOLCHAIN_WRAPPER(tool) \
|
||||
if (CallSystem("gcc -o cross/bin2/" TOOLCHAIN_PREFIX "-" tool " util/toolchain_wrapper.c -Wall -Wextra -g -DTOOL=" TOOLCHAIN_PREFIX "-" tool)) goto fail;
|
||||
MAKE_TOOLCHAIN_WRAPPER("ar");
|
||||
MAKE_TOOLCHAIN_WRAPPER("gcc");
|
||||
MAKE_TOOLCHAIN_WRAPPER("g++");
|
||||
MAKE_TOOLCHAIN_WRAPPER("ld");
|
||||
MAKE_TOOLCHAIN_WRAPPER("nm");
|
||||
MAKE_TOOLCHAIN_WRAPPER("strip");
|
||||
SaveConfig();
|
||||
} else if (0 == strcmp(l, "help") || 0 == strcmp(l, "h") || 0 == strcmp(l, "?")) {
|
||||
printf(ColorHighlight "\n=== Common Commands ===\n" ColorNormal);
|
||||
printf("build (b) - Build.\n");
|
||||
|
|
Loading…
Reference in New Issue