-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from tttapa/gcc-14
GCC 14.1 support
- Loading branch information
Showing
22 changed files
with
324 additions
and
3,649 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,99 @@ | ||
FROM ghcr.io/tttapa/docker-crosstool-ng-multiarch:master | ||
# Crosstool-NG ----------------------------------------------------------------- | ||
|
||
ARG HOST_TRIPLE | ||
FROM centos:7 as ct-ng | ||
|
||
# Install dependencies to build crosstool-ng and the toolchain | ||
RUN yum -y update && \ | ||
yum install -y epel-release && \ | ||
yum install -y autoconf gperf bison file flex texinfo help2man gcc-c++ \ | ||
libtool make patch ncurses-devel python36-devel perl-Thread-Queue bzip2 \ | ||
git wget which xz unzip rsync && \ | ||
yum clean all | ||
|
||
# Add a user called `develop` and add him to the sudo group | ||
RUN useradd -m develop && echo "develop:develop" | chpasswd && \ | ||
usermod -aG wheel develop | ||
|
||
USER develop | ||
WORKDIR /home/develop | ||
|
||
# Install autoconf | ||
RUN wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.72.tar.gz -O- | tar xz && \ | ||
cd autoconf-2.72 && \ | ||
./configure --prefix=/home/develop/.local && \ | ||
make -j$(nproc) && \ | ||
make install && \ | ||
cd .. && \ | ||
rm -rf autoconf-2.72 | ||
ENV PATH=/home/develop/.local/bin:$PATH | ||
|
||
# Build crosstool-ng | ||
RUN git clone -b master --single-branch --depth 1 \ | ||
https://github.com/crosstool-ng/crosstool-ng.git | ||
WORKDIR /home/develop/crosstool-ng | ||
RUN git show --summary && \ | ||
./bootstrap && \ | ||
mkdir build && cd build && \ | ||
../configure --prefix=/home/develop/.local && \ | ||
make -j$(($(nproc) * 2)) && \ | ||
make install && \ | ||
cd .. && rm -rf build | ||
WORKDIR /home/develop | ||
RUN mkdir /home/develop/src | ||
COPY ${HOST_TRIPLE}.defconfig defconfig | ||
COPY ${HOST_TRIPLE}.env .env | ||
RUN ls -lah | ||
|
||
RUN ct-ng defconfig | ||
# Patches | ||
# https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=280707&p=1700861#p1700861 | ||
RUN . ./.env; export DEB_TARGET_MULTIARCH="${HOST_TRIPLE_LIB_DIR}"; \ | ||
V=1 ct-ng build || { cat build.log && false; } && rm -rf .build | ||
RUN wget https://ftp.debian.org/debian/pool/main/b/binutils/binutils_2.41-6.debian.tar.xz -O- | \ | ||
tar xJ debian/patches/129_multiarch_libpath.patch && \ | ||
mkdir -p patches/binutils/2.41 && \ | ||
mv debian/patches/129_multiarch_libpath.patch patches/binutils/2.41 && \ | ||
rm -rf debian | ||
|
||
# Toolchain -------------------------------------------------------------------- | ||
|
||
FROM ct-ng as gcc-build | ||
|
||
ARG HOST_TRIPLE | ||
ARG GCC_VERSION | ||
|
||
# Build the toolchain | ||
COPY --chown=develop:develop ${HOST_TRIPLE}.defconfig . | ||
COPY --chown=develop:develop ${HOST_TRIPLE}.env . | ||
RUN [ -n "${GCC_VERSION}" ] && { echo "CT_GCC_V_${GCC_VERSION}=y" >> ${HOST_TRIPLE}.defconfig; } | ||
RUN cp ${HOST_TRIPLE}.defconfig defconfig && ct-ng defconfig | ||
RUN . ./${HOST_TRIPLE}.env && \ | ||
ct-ng build || { cat build.log && false; } && rm -rf .build | ||
|
||
RUN chmod +w /home/develop/x-tools/${HOST_TRIPLE} | ||
COPY cmake/Common.toolchain.cmake /home/develop/x-tools/${HOST_TRIPLE}/ | ||
COPY cmake/${HOST_TRIPLE}/* /home/develop/x-tools/${HOST_TRIPLE}/ | ||
RUN chmod -w /home/develop/x-tools/${HOST_TRIPLE} | ||
|
||
ENV TOOLCHAIN_PATH=/home/develop/x-tools/${HOST_TRIPLE} | ||
ENV PATH=${TOOLCHAIN_PATH}/bin:$PATH | ||
# Build container -------------------------------------------------------------- | ||
|
||
FROM ubuntu:jammy | ||
|
||
ARG HOST_TRIPLE | ||
|
||
RUN export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get update -y && \ | ||
apt-get install --no-install-recommends -y \ | ||
ninja-build cmake make bison flex \ | ||
tar xz-utils gzip zip unzip bzip2 zstd \ | ||
ca-certificates wget git sudo && \ | ||
apt-get clean autoclean && \ | ||
apt-get autoremove -y && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Add a user called `develop` and add him to the sudo group | ||
RUN useradd -m develop && \ | ||
echo "develop:develop" | chpasswd && \ | ||
adduser develop sudo | ||
|
||
USER develop | ||
WORKDIR /home/develop | ||
|
||
ENV TOOLCHAIN_PATH=/home/develop/opt/x-tools/${HOST_TRIPLE} | ||
ENV PATH=${TOOLCHAIN_PATH}/bin:$PATH | ||
|
||
# Copy the toolchain | ||
COPY --chown=develop:develop --from=gcc-build /home/develop/x-tools /home/develop/opt/x-tools |
Oops, something went wrong.