mirror of
				https://github.com/XRPLF/clio.git
				synced 2025-11-04 03:45:50 +00:00 
			
		
		
		
	I started with really simple pre-commit hooks and will add more on top. Important files: - `.pre-commit-config.yaml` - the config for pre-commit - `.github/workflows/pre-commit.yml` - runs pre-commit hooks in branches and `develop` - `.github/workflows/pre-commit-autoupdate.yml` - autoupdates pre-commit hooks once in a month
		
			
				
	
	
		
			75 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			3.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
FROM ubuntu:focal as build
 | 
						|
 | 
						|
ARG DEBIAN_FRONTEND=noninteractive
 | 
						|
ARG TARGETARCH
 | 
						|
ARG UBUNTU_VERSION=20.04
 | 
						|
ARG GCC_VERSION=12.3.0
 | 
						|
ARG BUILD_VERSION=1
 | 
						|
 | 
						|
RUN apt update && apt install -y wget build-essential file flex libz-dev libzstd-dev
 | 
						|
RUN wget https://gcc.gnu.org/pub/gcc/releases/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.gz \
 | 
						|
    && tar xf gcc-$GCC_VERSION.tar.gz \
 | 
						|
    && cd /gcc-$GCC_VERSION && ./contrib/download_prerequisites
 | 
						|
 | 
						|
RUN mkdir /${TARGETARCH}-gcc-12
 | 
						|
WORKDIR /${TARGETARCH}-gcc-12
 | 
						|
RUN /gcc-$GCC_VERSION/configure \
 | 
						|
    --with-pkgversion="clio-build-$BUILD_VERSION https://github.com/XRPLF/clio" \
 | 
						|
    --enable-languages=c,c++ \
 | 
						|
    --prefix=/usr \
 | 
						|
    --with-gcc-major-version-only \
 | 
						|
    --program-suffix=-12 \
 | 
						|
    --enable-shared \
 | 
						|
    --enable-linker-build-id \
 | 
						|
    --libexecdir=/usr/lib \
 | 
						|
    --without-included-gettext \
 | 
						|
    --enable-threads=posix \
 | 
						|
    --libdir=/usr/lib \
 | 
						|
    --disable-nls \
 | 
						|
    --enable-clocale=gnu \
 | 
						|
    --enable-libstdcxx-backtrace=yes \
 | 
						|
    --enable-libstdcxx-debug \
 | 
						|
    --enable-libstdcxx-time=yes \
 | 
						|
    --with-default-libstdcxx-abi=new \
 | 
						|
    --enable-gnu-unique-object \
 | 
						|
    --disable-vtable-verify \
 | 
						|
    --enable-plugin \
 | 
						|
    --enable-default-pie \
 | 
						|
    --with-system-zlib \
 | 
						|
    --enable-libphobos-checking=release \
 | 
						|
    --with-target-system-zlib=auto \
 | 
						|
    --disable-werror \
 | 
						|
    --enable-cet \
 | 
						|
    --disable-multilib \
 | 
						|
    --without-cuda-driver \
 | 
						|
    --enable-checking=release \
 | 
						|
    && make -j`nproc` \
 | 
						|
    && make install-strip DESTDIR=/gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION \
 | 
						|
    && mkdir -p /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION/usr/share/gdb/auto-load/usr/lib64 \
 | 
						|
    && mv /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION/usr/lib64/libstdc++.so.6.0.30-gdb.py /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION/usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.30-gdb.py
 | 
						|
 | 
						|
# Generate deb
 | 
						|
WORKDIR /
 | 
						|
COPY control.m4 /
 | 
						|
COPY ld.so.conf /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION/etc/ld.so.conf.d/1-gcc-12.conf
 | 
						|
 | 
						|
RUN mkdir /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION/DEBIAN \
 | 
						|
    && m4 -P -DUBUNTU_VERSION=$UBUNTU_VERSION -DVERSION=$GCC_VERSION-$BUILD_VERSION -DTARGETARCH=$TARGETARCH control.m4 > /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION/DEBIAN/control \
 | 
						|
    && dpkg-deb --build --root-owner-group /gcc-$GCC_VERSION-$BUILD_VERSION-ubuntu-$UBUNTU_VERSION /gcc12.deb
 | 
						|
 | 
						|
# Create final image
 | 
						|
FROM ubuntu:focal as gcc
 | 
						|
COPY --from=build /gcc12.deb /
 | 
						|
 | 
						|
# Make gcc-12 available but also leave gcc12.deb for others to copy if needed
 | 
						|
RUN apt update && apt-get install -y binutils libc6-dev \
 | 
						|
    && dpkg -i /gcc12.deb
 | 
						|
 | 
						|
RUN update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100 \
 | 
						|
    && update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-12 100 \
 | 
						|
    && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 \
 | 
						|
    && update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-12 100 \
 | 
						|
    && update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-12 100 \
 | 
						|
    && update-alternatives --install /usr/bin/gcov-dump gcov-dump /usr/bin/gcov-dump-12 100 \
 | 
						|
    && update-alternatives --install /usr/bin/gcov-tool gcov-tool /usr/bin/gcov-tool-12 100
 |