FROM ubuntu:22.04 RUN apt-get -y update && apt-get install -y --no-install-recommends git curl ca-certificates build-essential sudo RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y ENV PATH="/root/.cargo/bin:${PATH}" # Not sure why/if this is needed ENV LIBRARY_PATH=/usr/lib # Make sure we compile to the right target ENV OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu # Clone source repo RUN git clone https://github.com/rust-lang/rustc_codegen_gcc.git # Setup rustup RUN cd rustc_codegen_gcc && rustup show # Install gcc RUN curl -LO https://github.com/cross-cg-gcc-tools/cross-gcc/releases/latest/download/gcc-m68k-13.deb RUN dpkg -i gcc-m68k-13.deb # Set gcc path in the rustc_codegen project RUN echo 'gcc-path = "/usr/lib"' > rustc_codegen_gcc/config.toml # Git config is needed for ./y.sh prepare RUN git config --global user.email "user@example.com" RUN git config --global user.name "User" # Apply hacky patch COPY 0001-Hackery.patch /tmp/0001-Hackery.patch RUN cd rustc_codegen_gcc && patch -p1 < /tmp/0001-Hackery.patch && rm /tmp/0001-Hackery.patch # Build project # See https://github.com/rust-lang/rustc_codegen_gcc/blob/master/doc/tips.md#how-to-build-a-cross-compiling-libgccjit RUN cd rustc_codegen_gcc && ./y.sh prepare --cross RUN cd rustc_codegen_gcc && ./y.sh build --sysroot --features compiler_builtins/no-f16-f128 --target-triple m68k-unknown-linux-gnu --target /rustc_codegen_gcc/target_specs/m68k-unknown-linux-gnu.json # Build "megapong" PoC RUN git clone https://github.com/ricky26/rust-mega-drive.git COPY 0001-Patches-to-run-with-gcc.patch /tmp/rust-mega-drive.patch RUN cd rust-mega-drive && patch -p1