1
+ ARG UbuntuVersion=20.04
2
+
3
+ FROM ubuntu:$UbuntuVersion
4
+
5
+ ARG Gcc12Version=12.1.0
6
+
7
+ # Download gcc source code
8
+ RUN apt update && apt install -y wget build-essential file flex libz-dev libzstd-dev
9
+ RUN wget https://gcc.gnu.org/pub/gcc/releases/gcc-$Gcc12Version/gcc-$Gcc12Version.tar.gz
10
+ RUN tar xf gcc-$Gcc12Version.tar.gz
11
+ RUN cd /gcc-$Gcc12Version && ./contrib/download_prerequisites
12
+
13
+ # Build x86_64-gcc-12
14
+ RUN mkdir /x86_64-gcc-12
15
+ WORKDIR /x86_64-gcc-12
16
+ RUN /gcc-$Gcc12Version/configure \
17
+ --enable-languages=c,c++ \
18
+ --prefix=/usr \
19
+ --with-gcc-major-version-only \
20
+ --program-suffix=-12 \
21
+ --enable-shared \
22
+ --enable-linker-build-id \
23
+ --libexecdir=/usr/lib \
24
+ --without-included-gettext \
25
+ --enable-threads=posix \
26
+ --libdir=/usr/lib \
27
+ --disable-nls \
28
+ --enable-clocale=gnu \
29
+ --enable-libstdcxx-debug \
30
+ --enable-libstdcxx-time=yes \
31
+ --with-default-libstdcxx-abi=new \
32
+ --enable-gnu-unique-object \
33
+ --disable-vtable-verify \
34
+ --enable-plugin \
35
+ --enable-default-pie \
36
+ --with-system-zlib \
37
+ --enable-libphobos-checking=release \
38
+ --with-target-system-zlib=auto \
39
+ --disable-werror \
40
+ --enable-cet \
41
+ --with-abi=m64 \
42
+ --disable-multilib \
43
+ --with-tune=generic \
44
+ --without-cuda-driver \
45
+ --enable-checking=release \
46
+ --build=x86_64-linux-gnu \
47
+ --host=x86_64-linux-gnu \
48
+ --target=x86_64-linux-gnu
49
+ RUN make -j`nproc`
50
+
51
+ ARG BuildVersion=1
52
+ ARG UbuntuVersion=20.04
53
+
54
+ RUN make install-strip DESTDIR=/gcc-$Gcc12Version-$BuildVersion-ubuntu-$UbuntuVersion
55
+ RUN mkdir -p /gcc-$Gcc12Version-$BuildVersion-ubuntu-$UbuntuVersion/usr/share/gdb/auto-load/usr/lib64 && \
56
+ mv /gcc-$Gcc12Version-$BuildVersion-ubuntu-$UbuntuVersion/usr/lib64/libstdc++.so.6.0.30-gdb.py /gcc-$Gcc12Version-$BuildVersion-ubuntu-$UbuntuVersion/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.30-gdb.py
57
+
58
+ # Generate deb
59
+ WORKDIR /
60
+ COPY DEBIAN/control.m4 /
61
+ RUN mkdir /gcc-$Gcc12Version-$BuildVersion-ubuntu-$UbuntuVersion/DEBIAN
62
+ RUN m4 -P -DUBUNTUVERSION=$UbuntuVersion -DVERSION=$Gcc12Version-$BuildVersion control.m4 > /gcc-$Gcc12Version-$BuildVersion-ubuntu-$UbuntuVersion/DEBIAN/control
63
+ RUN dpkg-deb --build --root-owner-group /gcc-$Gcc12Version-$BuildVersion-ubuntu-$UbuntuVersion
0 commit comments