Skip to content

Commit

Permalink
Include sysroots from Debian 6 up to 9
Browse files Browse the repository at this point in the history
Also allow cross-compiling software to these targets by adding wrappers that calls GCC/G++ with the appropriate --sysroot option.
  • Loading branch information
Kartatz committed Aug 23, 2024
1 parent 87c52ee commit b175065
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 16 deletions.
30 changes: 15 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 19 additions & 1 deletion tools/gcc-wrapper/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);

Expand Down

0 comments on commit b175065

Please sign in to comment.