linux stuff

This commit is contained in:
doyle 2022-07-19 11:45:00 +10:00
parent 7972163d81
commit 39ab3007fc
3 changed files with 84 additions and 0 deletions

20
Installer/unix_gcc_build.sh Executable file
View File

@ -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

View File

@ -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

View File

@ -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)