diff --git a/Installer/unix_gcc_build.sh b/Installer/unix_gcc_build.sh new file mode 100755 index 0000000..4746e1f --- /dev/null +++ b/Installer/unix_gcc_build.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +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 + + mkdir --parent build || exit + docker cp ${container_name}:/usr/local/docker/gcc-mostlyportable-${gcc_version} . || exit + + docker container rm ${container_name} || exit +done + +if [[ $EUID == 0 ]]; then + chown --recursive ${USER} build +fi diff --git a/Installer/unix_gcc_dockerfile b/Installer/unix_gcc_dockerfile new file mode 100644 index 0000000..62895b4 --- /dev/null +++ b/Installer/unix_gcc_dockerfile @@ -0,0 +1,42 @@ +FROM ubuntu:16.04 as builder + +RUN set -ex \ + && apt-get update \ + && apt-get --no-install-recommends --yes install \ + apt-transport-https \ + eatmydata \ + ca-certificates + +# Build tools +RUN set -ex \ + && apt-get update \ + && eatmydata apt-get --no-install-recommends --yes install \ + build-essential \ + g++-multilib \ + git \ + libgmp-dev \ + libz-dev \ + m4 \ + schedtool \ + texinfo \ + texlive \ + wget + +WORKDIR /usr/local/docker + +ARG MOSTLY_PORTABLE_GCC_GIT_BRANCH=master +RUN set -ex \ + && git clone https://github.com/Frogging-Family/mostlyportable-gcc \ + && git checkout $MOSTLY_PORTABLE_GIT_BRANCH + +ARG GCC_VERSION=11.3.0 +ARG BIN_UTILS_VERSION=2.38 +RUN set -ex \ + && cd mostlyportable-gcc \ + && sed --in-place "s/^_use_gcc_git=\".*\"$/_use_gcc_git=\"false\"/" mostlyportable-gcc.cfg \ + && sed --in-place "s/^_gcc_version=\".*\"$/_gcc_version=\"$GCC_VERSION\"/" mostlyportable-gcc.cfg \ + && sed --in-place "s/^_use_binutils_git=\".*\"$/_use_binutils_git=\"false\"/" mostlyportable-gcc.cfg \ + && sed --in-place "s/^_binutils=.*$/_binutils=$BIN_UTILS_VERSION/" mostlyportable-gcc.cfg \ + && sed --in-place "s/^_use_isl_git=\".*\"$/_use_isl_git=\"false\"/" mostlyportable-gcc.cfg \ + && sed --in-place -E "s/^(\s*)(.*)_ldconfmostlyportable;$/\1_ldconfmostlyportable=\"n\"/" mostlyportable-gcc.sh \ + && ./mostlyportable-gcc.sh gcc diff --git a/linux_install.sh b/linux_install.sh index bb0030b..d132536 100755 --- a/linux_install.sh +++ b/linux_install.sh @@ -101,6 +101,28 @@ fi FileSHA256Check "${fd_exe}" "${fd_exe_sha256}" || exit ln --force --symbolic --relative "${fd_exe}" "${bin_dir}" +# GCC +# ------------------------------------------------------------------------------ +gcc_dir=${tools_dir}/gcc-mostlyportable +gcc_version_list=(12.1.0 11.3.0 10.4.0 9.5.0 8.5.0 7.5.0 6.5.0) + +mkdir --parents "${gcc_dir}" +cp "${installer_dir}/unix_gcc_build.sh" "${gcc_dir}/build.sh" +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} + if [[ ! -f "${gcc_bin_dir}/g++" ]]; then + ./build.sh ${gcc_version} || exit + ln -s ${gcc_bin_dir}/g++ ${bin_dir}/g++-${gcc_version} || exit + ln -s ${gcc_bin_dir}/gcc ${bin_dir}/gcc-${gcc_version} || exit + fi + done + ln -s ${gcc_bin_dir}/g++ ${bin_dir}/g++ || exit + ln -s ${gcc_bin_dir}/gcc ${bin_dir}/gcc || exit +cd "${root_dir}" || exit + # LLVM/Clang # ------------------------------------------------------------------------------ llvm_version_list=(11.1.0 12.0.1 13.0.1 14.0.0)