From c9eb79df5915f5490dd5a44a0837cd5f07b94721 Mon Sep 17 00:00:00 2001 From: doylet Date: Tue, 30 Apr 2024 15:54:30 +1000 Subject: [PATCH] Update GCC scripts --- Internal/unix_build_template.sh | 0 Internal/unix_gcc_build.sh | 31 ++++++++++++++++++++++--------- Internal/unix_gcc_dockerfile | 6 ++++-- Linux/Scripts/gcc_env.sh | 30 ++++++++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 11 deletions(-) mode change 100644 => 100755 Internal/unix_build_template.sh mode change 100644 => 100755 Internal/unix_gcc_build.sh create mode 100755 Linux/Scripts/gcc_env.sh diff --git a/Internal/unix_build_template.sh b/Internal/unix_build_template.sh old mode 100644 new mode 100755 diff --git a/Internal/unix_gcc_build.sh b/Internal/unix_gcc_build.sh old mode 100644 new mode 100755 index 1021925..e9fc6a6 --- a/Internal/unix_gcc_build.sh +++ b/Internal/unix_gcc_build.sh @@ -1,20 +1,33 @@ #!/bin/bash +# Run script and build GCC versions +# ./unix_gcc_build.sh 13.2.0 12.3.0 11.4.0 10.4.0 9.5.0 8.5.0 7.5.0 6.5.0 + +# Extract and install the build using +# tar --use-compress-program=zstd -xf gcc-mostlyportable-13.2.0.tar.zst -C ~/Dev/Linux/GCC + for gcc_version in "$@" do image_name=mostlyportable-gcc-image container_name=mostlyportable-gcc - docker build -t ${image_name} --build-arg GCC_VERSION=${gcc_version} . || exit - docker container rm ${container_name} > /dev/null 2>&1 - docker create --name ${container_name} ${image_name} || exit + tar_file=gcc-mostlyportable-${gcc_version}.tar + archive_file=${tar_file}.zst + if [ ! -e "${archive_file}" ]; then + docker build -t ${image_name} --build-arg GCC_VERSION=${gcc_version} -f unix_gcc_dockerfile . || exit + docker container rm ${container_name} > /dev/null 2>&1 + docker create --name ${container_name} ${image_name} || exit - mkdir --parent build || exit - docker cp ${container_name}:/usr/local/docker/mostlyportable-gcc/mostly-built/gcc-mostlyportable-${gcc_version} . || exit + docker cp ${container_name}:/usr/local/docker/mostlyportable-gcc/mostly-built/gcc-mostlyportable-${gcc_version} . || exit + docker container rm ${container_name} || exit - docker container rm ${container_name} || exit + mv --force gcc-mostlyportable-${gcc_version} ${gcc_version} || exit + tar cf ${tar_file} -p ${gcc_version} || exit + zstd --rm ${tar_file} || exit + rm -rf ./${gcc_version} || exit + fi done -if [[ $EUID == 0 ]]; then - chown --recursive ${USER} gcc-mostlyportable-* -fi +# if [[ $EUID == 0 ]]; then +# chown --recursive ${USER} gcc-mostlyportable-* +# fi diff --git a/Internal/unix_gcc_dockerfile b/Internal/unix_gcc_dockerfile index 0a71a9f..6ec81b1 100644 --- a/Internal/unix_gcc_dockerfile +++ b/Internal/unix_gcc_dockerfile @@ -17,6 +17,8 @@ RUN set -ex \ libgmp-dev \ libz-dev \ m4 \ + file \ + bison \ schedtool \ texinfo \ texlive \ @@ -30,8 +32,8 @@ RUN set -ex \ && cd mostlyportable-gcc \ && git checkout $MOSTLY_PORTABLE_GIT_BRANCH -ARG GCC_VERSION=11.3.0 -ARG BIN_UTILS_VERSION=2.38 +ARG GCC_VERSION=13.2.0 +ARG BIN_UTILS_VERSION=2.41 RUN set -ex \ && cd mostlyportable-gcc \ && sed --in-place "s/^_use_gcc_git=\".*\"$/_use_gcc_git=\"false\"/" mostlyportable-gcc.cfg \ diff --git a/Linux/Scripts/gcc_env.sh b/Linux/Scripts/gcc_env.sh new file mode 100755 index 0000000..dbe9c41 --- /dev/null +++ b/Linux/Scripts/gcc_env.sh @@ -0,0 +1,30 @@ +#!/bin/bash +base_path="$devenver_root/GCC" + +# Check for help argument +if [[ "$1" == "help" || "$1" == "" || "$1" == "--help" || "$1" == "/?" ]]; then + echo "USAGE: gcc_env.sh " + echo + echo "VERSIONS:" + ls "$base_path" + exit 0 +fi + +# Check if a version is provided +if [[ -z "$1" ]]; then + echo "Error: No version specified." + echo "USAGE: gcc_env.sh " + exit 1 +fi + +# Extract the version and remaining arguments +version="$1" +shift +remaining_args="$@" + +# Execute the command +echo "[SCRIPT] Executing $remaining_args" + +root_path="$base_path/$version" +PATH=${root_path}/bin:${root_path}/lib:${root_path}/include:${PATH} +$remaining_args