From b1750659dcca4496aced1f96b696ec100cdb93fd Mon Sep 17 00:00:00 2001 From: Kartatz <105828205+Kartatz@users.noreply.github.com> Date: Fri, 23 Aug 2024 00:50:05 -0300 Subject: [PATCH] Include sysroots from Debian 6 up to 9 Also allow cross-compiling software to these targets by adding wrappers that calls GCC/G++ with the appropriate --sysroot option. --- build.sh | 30 +++++++++++++++--------------- tools/gcc-wrapper/main.c | 20 +++++++++++++++++++- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/build.sh b/build.sh index 360b387..25f8347 100644 --- a/build.sh +++ b/build.sh @@ -133,22 +133,22 @@ make all --jobs make install declare -ra targets=( - 'ia64-unknown-linux-gnu' - 'alpha-unknown-linux-gnu' + # 'ia64-unknown-linux-gnu' + # 'alpha-unknown-linux-gnu' 'x86_64-unknown-linux-gnu' - 'i386-unknown-linux-gnu' - 'arm-unknown-linux-gnueabi' - 'arm-unknown-linux-gnueabihf' - 'hppa-unknown-linux-gnu' - 'aarch64-unknown-linux-gnu' - 'mips-unknown-linux-gnu' - 'mipsel-unknown-linux-gnu' - 'powerpc-unknown-linux-gnu' - 's390-unknown-linux-gnu' - 's390x-unknown-linux-gnu' - 'sparc-unknown-linux-gnu' - 'powerpc64le-unknown-linux-gnu' - 'mips64el-unknown-linux-gnuabi64' + # 'i386-unknown-linux-gnu' + # 'arm-unknown-linux-gnueabi' + # 'arm-unknown-linux-gnueabihf' + # 'hppa-unknown-linux-gnu' + # 'aarch64-unknown-linux-gnu' + # 'mips-unknown-linux-gnu' + # 'mipsel-unknown-linux-gnu' + # 'powerpc-unknown-linux-gnu' + # 's390-unknown-linux-gnu' + # 's390x-unknown-linux-gnu' + # 'sparc-unknown-linux-gnu' + # 'powerpc64le-unknown-linux-gnu' + # 'mips64el-unknown-linux-gnuabi64' ) for target in "${targets[@]}"; do diff --git a/tools/gcc-wrapper/main.c b/tools/gcc-wrapper/main.c index 7651a55..f218474 100644 --- a/tools/gcc-wrapper/main.c +++ b/tools/gcc-wrapper/main.c @@ -216,7 +216,7 @@ int main(int argc, char* argv[], char* envp[]) { strcat(gcc_include_directory, PATHSEP); strcat(gcc_include_directory, GCC_MAJOR_VERSION); strcat(gcc_include_directory, INCLUDE_DIR); - + /* gpp_include_directory = malloc(strlen(parent_directory) + strlen(INCLUDE_DIR) + strlen(PATHSEP) + strlen(CPP) + strlen(PATHSEP) + strlen(GCC_MAJOR_VERSION) + 1); if (gpp_include_directory == NULL) { @@ -232,6 +232,24 @@ int main(int argc, char* argv[], char* envp[]) { strcat(gpp_include_directory, CPP); strcat(gpp_include_directory, PATHSEP); strcat(gpp_include_directory, GCC_MAJOR_VERSION); + */ + gpp_include_directory = malloc(strlen(parent_directory) + strlen(PATHSEP) + strlen(triplet) + strlen(INCLUDE_DIR) + strlen(PATHSEP) + strlen(CPP) + strlen(PATHSEP) + strlen(GCC_MAJOR_VERSION) + 1); + + if (gpp_include_directory == NULL) { + fprintf(stderr, "fatal error: could not allocate memory\n"); + + status = EXIT_FAILURE; + goto end; + } + + strcpy(gpp_include_directory, parent_directory); + strcat(gpp_include_directory, PATHSEP); + strcat(gpp_include_directory, triplet); + strcat(gpp_include_directory, INCLUDE_DIR); + strcat(gpp_include_directory, PATHSEP); + strcat(gpp_include_directory, CPP); + strcat(gpp_include_directory, PATHSEP); + strcat(gpp_include_directory, GCC_MAJOR_VERSION); gpp_builtins_include_directory = malloc(strlen(gpp_include_directory) + strlen(PATHSEP) + strlen(triplet) + 1);