DEVenv/Internal/unix_gcc_build.sh

34 lines
1.2 KiB
Bash
Raw Normal View History

2022-07-19 01:45:00 +00:00
#!/bin/bash
2024-04-30 05:54:30 +00:00
# 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
2022-07-19 01:45:00 +00:00
for gcc_version in "$@"
do
image_name=mostlyportable-gcc-image
container_name=mostlyportable-gcc
2024-04-30 05:54:30 +00:00
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
2022-07-19 01:45:00 +00:00
2024-04-30 05:54:30 +00:00
docker cp ${container_name}:/usr/local/docker/mostlyportable-gcc/mostly-built/gcc-mostlyportable-${gcc_version} . || exit
docker container rm ${container_name} || exit
2022-07-19 01:45:00 +00:00
2024-04-30 05:54:30 +00:00
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
2022-07-19 01:45:00 +00:00
done
2024-04-30 05:54:30 +00:00
# if [[ $EUID == 0 ]]; then
# chown --recursive ${USER} gcc-mostlyportable-*
# fi