From bce5f7aba3619a9dbfacda3d5b5367ceef13d8ce Mon Sep 17 00:00:00 2001 From: doyle Date: Thu, 8 Sep 2022 17:10:22 +1000 Subject: [PATCH] gcc vars script --- linux_install.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/linux_install.sh b/linux_install.sh index fb3c261..effb9e1 100755 --- a/linux_install.sh +++ b/linux_install.sh @@ -128,13 +128,32 @@ cp "${installer_dir}/unix_gcc_dockerfile" "${gcc_dir}/Dockerfile" cd "${gcc_dir}" || exit for gcc_version in ${gcc_version_list[@]}; do - gcc_bin_dir=${gcc_dir}/gcc-mostlyportable-${gcc_version}/bin + gcc_root_dir=${gcc_dir}/gcc-mostlyportable-${gcc_version} + gcc_bin_dir=${gcc_root_dir}/bin if [[ ! -f "${gcc_bin_dir}/g++" ]]; then ./build.sh ${gcc_version} || exit fi + + # Symbolic link the versioned gcc executables ln --symbolic --force --relative ${gcc_bin_dir}/g++ ${bin_dir}/g++-${gcc_version} || exit ln --symbolic --force --relative ${gcc_bin_dir}/gcc ${bin_dir}/gcc-${gcc_version} || exit + + # Create script that setups the environment path for building with a versioned GCC + gcc_script_name=g++-${gcc_version}-vars.sh + gcc_script_path=${gcc_dir}/${gcc_script_name} + + echo "gcc_mostlyportable_dir=\"${gcc_root_dir}\" \\" > ${gcc_script_path} + echo "PATH=\${gcc_mostlyportable_dir}/bin:\${PATH} \\" >> ${gcc_script_path} + echo "LD_LIBRARY_PATH=\${gcc_mostlyportable_dir}/lib:\${LD_LIBRARY_PATH} \\" >> ${gcc_script_path} + echo "LD_LIBRARY_PATH=\${gcc_mostlyportable_dir}/lib64:\${LD_LIBRARY_PATH} \\" >> ${gcc_script_path} + echo "\$@" >> ${gcc_script_path} + + chmod +x ${gcc_script_path} + + # Symbolic link the script to load the GCC environment + ln --symbolic --force --relative ${gcc_script_path} ${bin_dir}/gcc-${gcc_version}-vars.sh || exit done + ln --symbolic --force --relative "${gcc_bin_dir}/g++" "${bin_dir}/g++" || exit ln --symbolic --force --relative "${gcc_bin_dir}/gcc" "${bin_dir}/gcc" || exit cd "${root_dir}" || exit