-
Notifications
You must be signed in to change notification settings - Fork 18
/
Dockerfile
63 lines (42 loc) · 1.5 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
FROM debian:bookworm-slim as build_env
ARG DEBIAN_FRONTEND=noninteractive
ENV MARS_BUILD_DIR=/marsdev/build
ENV MARS_INSTALL_DIR=/marsdev/mars
ENV GENDEV=$MARS_INSTALL_DIR
ENV PATH=$PATH:$JAVA_HOME/bin
ENV HOME=/marsdev
# Install prerequisites
RUN apt update && \
apt install -y git build-essential texinfo wget \
openjdk-17-jdk-headless libpng-dev && \
apt clean && \
mkdir -p $MARS_BUILD_DIR && \
mkdir -p $MARS_INSTALL_DIR/bin
COPY ./ $MARS_BUILD_DIR
WORKDIR $MARS_BUILD_DIR
FROM build_env as build_m68k_toolchain
RUN make m68k-toolchain-newlib
FROM build_m68k_toolchain as build_sh_toolchain
RUN make sh-toolchain-newlib
FROM build_sh_toolchain as build_sgdk
RUN make sgdk
FROM build_sgdk as build_x68k_tools
RUN make x68k-tools
FROM build_x68k_tools as build_sik_tools
RUN make sik-tools
FROM build_sik_tools as build_install
RUN make install
# Hack to run rescomp
RUN echo '#!/bin/bash\njava -Duser.dir="`pwd`" -jar $MARS_INSTALL_DIR/bin/rescomp.jar ${@:-1}' > $MARS_INSTALL_DIR/bin/rescomp && chmod +x $MARS_INSTALL_DIR/bin/rescomp
FROM build_install as build_final
WORKDIR /
RUN rm -rf /work $MARS_BUILD_DIR && \
chmod ugo+r -R $HOME && \
chmod ugo+r -R $MARS_INSTALL_DIR && \
chmod ugo+rx -R $MARS_INSTALL_DIR/mars.sh && \
chmod ugo+rx -R $MARS_INSTALL_DIR/bin && \
chmod ugo+rx -R $MARS_INSTALL_DIR/m68k-elf/bin && \
chmod ugo+rx -R $MARS_INSTALL_DIR/sh-elf/bin && \
echo "exec \"\$@\"" >> /marsdev/mars/mars.sh
ENTRYPOINT ["/marsdev/mars/mars.sh"]
CMD make