fix cross compiler build recursion; possibly fix macos

This commit is contained in:
nakst 2022-01-22 09:36:22 +00:00
parent 30bc29ff66
commit cd1759ed4a
6 changed files with 25 additions and 19 deletions

View File

@ -72,7 +72,8 @@ if [ ! -d "bin/harfbuzz" ]; then
SED=sed
if [ "$OSTYPE" = "darwin"* ]; then
uname -a | grep Darwin > /dev/null
if [ $? -ne 1 ]; then
SED=gsed
fi

View File

@ -18,8 +18,8 @@ uname -a | grep Darwin > /dev/null
if [ $? -ne 1 ]; then
export CC=gcc-11
export CXX=g++-11
export CPPFLAGS=-I/opt/homebrew/include
export LDFLAGS=-L/opt/homebrew/lib
export CPPFLAGS=-I$(brew --prefix)/include
export LDFLAGS=-L$(brew --prefix)/lib
alias md5sum="md5"
alias gcc="gcc-11"
alias g++="g++-11"

View File

@ -18,6 +18,7 @@ echo "General.wallpaper=0:/Demo Content/Abstract.jpg" >> bin/config.ini
echo "General.window_color=5" >> bin/config.ini
# Setup toolchain, build the system and ports.
./start.sh get-toolchain
./start.sh build-optimised
./start.sh build-optional-ports > /dev/null

View File

@ -15,4 +15,5 @@ echo "Dependency.stb_image=0" >> bin/config.ini
echo "Dependency.stb_image_write=0" >> bin/config.ini
echo "Dependency.stb_sprintf=0" >> bin/config.ini
echo "Dependency.FreeTypeAndHarfBuzz=0" >> bin/config.ini
./start.sh get-toolchain
./start.sh build-optimised

View File

@ -10,6 +10,7 @@ echo "accepted_license=1" >> bin/build_config.ini
echo "Flag.ENABLE_POSIX_SUBSYSTEM=1" >> bin/config.ini
echo "desktop/api_tests.ini" >> bin/extra_applications.ini
echo `git log | head -n 1 | cut -b 8-14` > bin/commit.txt
./start.sh get-toolchain
./start.sh build
./start.sh build-port busybox
util/x11/build.sh apps/samples/hello.c

View File

@ -758,7 +758,7 @@ void BuildCrossCompiler() {
if (processorCount > 16) processorCount = 16;
printf("Type 'yes' if you have updated your system.\n");
if (!GetYes()) { printf("The build has been canceled.\n"); exit(0); }
if (interactiveMode && !GetYes()) { printf("The build has been canceled.\n"); exit(0); }
{
getcwd(installationFolder, 4096);
@ -768,7 +768,7 @@ void BuildCrossCompiler() {
strcpy(compilerPath, installationFolder);
strcat(compilerPath, "/bin");
printf("\nType 'yes' to install the compiler into '%s'.\n", installationFolder);
if (!GetYes()) { printf("The build has been canceled.\n"); exit(0); }
if (interactiveMode && !GetYes()) { printf("The build has been canceled.\n"); exit(0); }
}
if (!AddCompilerToPath()) {
@ -1864,6 +1864,16 @@ void DoCommand(const char *l) {
getcwd(compilerPath, sizeof(compilerPath) - 64);
strcat(compilerPath, "/cross/bin2");
SaveConfig();
} else if (0 == strcmp(l, "get-toolchain")) {
#if defined(__linux__) && defined(__x86_64__)
fprintf(stderr, "Downloading the compiler toolchain...\n");
DoCommand("get-source-checked 700205f81c7a5ca3279ae7b1fdb24e025d33b36a9716b81a71125bf0fec0de50 "
"prefix https://github.com/nakst/build-gcc/releases/download/gcc-11.1.0/gcc-x86_64-essence.tar.xz");
DoCommand("setup-pre-built-toolchain");
AddCompilerToPath();
#else
BuildCrossCompiler();
#endif
} 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");
@ -1961,20 +1971,6 @@ int main(int _argc, char **_argv) {
const char *runFirstCommand = NULL;
if (CallSystem("" TOOLCHAIN_PREFIX "-gcc --version > /dev/null 2>&1 ")) {
#if defined(__linux__) && defined(__x86_64__)
fprintf(stderr, "Downloading the compiler toolchain...\n");
DoCommand("get-source-checked 700205f81c7a5ca3279ae7b1fdb24e025d33b36a9716b81a71125bf0fec0de50 "
"prefix https://github.com/nakst/build-gcc/releases/download/gcc-11.1.0/gcc-x86_64-essence.tar.xz");
DoCommand("setup-pre-built-toolchain");
AddCompilerToPath();
#else
BuildCrossCompiler();
#endif
runFirstCommand = "b";
foundValidCrossCompiler = true;
}
if (argc >= 2) {
char buffer[4096];
buffer[0] = 0;
@ -1991,6 +1987,12 @@ int main(int _argc, char **_argv) {
interactiveMode = true;
}
if (CallSystem("" TOOLCHAIN_PREFIX "-gcc --version > /dev/null 2>&1 ")) {
DoCommand("get-toolchain");
runFirstCommand = "b";
foundValidCrossCompiler = true;
}
SaveConfig();
if (runFirstCommand) {