-
Notifications
You must be signed in to change notification settings - Fork 12
/
Dockerfile
107 lines (96 loc) · 3.77 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
FROM ubuntu:22.04
MAINTAINER Matt Godbolt <[email protected]>
ARG DEBIAN_FRONTEND=noninteractive
# Annoyingly crosstool whinges if it's run as root.
RUN mkdir -p /opt && mkdir -p /home/gcc-user && useradd gcc-user && chown gcc-user /opt /home/gcc-user
RUN apt-get clean -y && apt-get check -y
## for nightly build of cross compiler with GNAT (Ada), we need "a matching"
## compiler. So using gcc-13 for master is not working. So we have a *hardcoded*
## snapshot below that should be "good enough". When there's a failure caused by
## GNAT, it's probably time to bump the snapshot.
RUN apt-get update -y -q && apt-get upgrade -y -q && apt-get upgrade -y -q && \
apt-get install -y -q \
autoconf \
automake \
libtool \
bison \
bzip2 \
curl \
file \
flex \
git \
gawk \
binutils-multiarch \
gperf \
help2man \
libc6-dev-i386 \
libncurses5-dev \
libtool-bin \
linux-libc-dev \
make \
ninja-build \
device-tree-compiler \
patch \
rsync \
s3cmd \
sed \
subversion \
texinfo \
wget \
unzip \
autopoint \
gettext \
vim \
zlib1g-dev \
software-properties-common \
xz-utils && \
cd /tmp && \
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip -q awscliv2.zip && \
./aws/install && \
rm -rf aws* && \
mkdir -p /opt/compiler-explorer/ && \
cd /opt/compiler-explorer && \
curl "https://s3.amazonaws.com/compiler-explorer/opt/gcc-11.4.0.tar.xz" -o gcc11.tar.xz && \
curl "https://s3.amazonaws.com/compiler-explorer/opt/gcc-12.3.0.tar.xz" -o gcc12.tar.xz && \
curl "https://s3.amazonaws.com/compiler-explorer/opt/gcc-13.2.0.tar.xz" -o gcc13.tar.xz && \
curl "https://s3.amazonaws.com/compiler-explorer/opt/gcc-14.2.0.tar.xz" -o gcc14.tar.xz && \
curl "https://s3.amazonaws.com/compiler-explorer/opt/gcc-trunk-20240920.tar.xz" -o gcc-trunk.tar.xz && \
tar Jxf gcc11.tar.xz && \
tar Jxf gcc12.tar.xz && \
tar Jxf gcc13.tar.xz && \
tar Jxf gcc14.tar.xz && \
tar Jxf gcc-trunk.tar.xz && \
mv gcc-trunk-20240920/ gcc-trunk && \
rm gcc*.tar.xz
## Beware of the "trunk" download. It is useful when a cross compiler really
## needs a very recent base compiler (e.g. GNAT). The hardcoded filename for
## trunk will only work for some time as we are expiring them after a few days.
## Need for host GCC version to be ~= latest cross GCC being built.
## This is at least needed for building cross-GNAT (Ada) as the GNAT runtime has no
## requirement on a minimal supported version (e.g. need GCC 12 to build any GNAT runtime).
## This is only true for cross compiler. Native compiler can use host's runtime
## and bootstrap everything.
ENV PATH="/opt/compiler-explorer/gcc-14.2.0/bin:${PATH}"
ENV LD_LIBRARY_PATH="/opt/compiler-explorer/gcc-14.2.0/lib64:${PATH}"
WORKDIR /opt
## This patch is needed to force ct-ng to not error out because we are setting
## LD_LIBRARY_PATH. There's no easy way to have ct-ng use a particular compiler
## (...). If we have strange behavior, maybe we'll have to look at this.
## Couldn't see anything suspicious (yet).
COPY build/patches/crosstool-ng/ld_library_path.patch ./
## TAG is pointing to a specific ct-ng revision (usually the current dev one
## when updating this script or ct-ng)
RUN TAG=78980241378010f4983e320df76b5edf58a62ab7 && \
curl -sL https://github.com/crosstool-ng/crosstool-ng/archive/${TAG}.zip --output crosstool-ng-master.zip && \
unzip crosstool-ng-master.zip && \
cd crosstool-ng-${TAG} && \
patch -p1 < ../ld_library_path.patch && \
./bootstrap && \
./configure --prefix=/opt/crosstool-ng-latest && \
make -j$(nproc) && \
make install
RUN mkdir -p /opt/.build/tarballs
COPY build /opt/
RUN chown -R gcc-user /opt
USER gcc-user