This repository was archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 109
/
Copy pathDockerfile
86 lines (69 loc) · 2.82 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
# First build the container:
# docker build -t harvey:Dockerfile .
# (or:
# docker build --progress=plain -t harvey:Dockerfile .
# if you want to see the output from commands (useful for debugging build))
#
# Now run container to build.
# If you want to build from the repo (i.e. for CI), run:
# docker run --rm -it --cap-add SYS_ADMIN --privileged harvey:Dockerfile
# If you want to build from a local folder (e.g. the current directoy), run:
# docker run --rm -it --mount type=bind,source="$(pwd)"/..,target=/usr/local/harvey_local,readonly --cap-add SYS_ADMIN --privileged harvey:Dockerfile
# TODO mahjonng doesn't build becuase of problems with cpp - fix cpp!
FROM ubuntu:21.10
RUN apt-get -y update
RUN apt-get -y upgrade
RUN apt-get install -y build-essential git sudo
ENV HARVEY=/usr/local/harvey
ENV HARVEY_LINUX_BIN=/usr/local/harvey_linux/bin
RUN mkdir -p $HARVEY_LINUX_BIN
########################################################################
# Only use layer cache if the git repo hasn't changed. This ensures we
# always have the latest code, but make use of the cache where possible.
ARG NINEFANS_OWNER=9fans
ARG NINEFANS_REPO=plan9port
ARG NINEFANS_BRANCH=master
ADD https://api.github.com/repos/$NINEFANS_OWNER/$NINEFANS_REPO/git/refs/heads/$NINEFANS_BRANCH version.json
RUN cd /usr/local \
&& git clone -b $NINEFANS_BRANCH https://github.com/$NINEFANS_OWNER/$NINEFANS_REPO.git \
&& cd plan9port \
&& ./INSTALL
ENV PLAN9=/usr/local/plan9port
ENV PATH="${PATH}:${PLAN9}/bin"
# To make rc scripts run
RUN cp ${PLAN9}/bin/rc /bin/rc
########################################################################
# Build ar from 9-cc
# Do this early since it's less likely to change than the harvey repo,
# allowing us to use the cached layers.
ARG NINECC_OWNER=0intro
ARG NINECC_REPO=9-cc
ARG NINECC_BRANCH=master
ADD https://api.github.com/repos/$NINECC_OWNER/$NINECC_REPO/git/refs/heads/$NINECC_BRANCH version.json
RUN cd /usr/local \
&& git clone -b $NINECC_BRANCH https://github.com/$NINECC_OWNER/$NINECC_REPO.git
ENV NINECC=/usr/local/9-cc
WORKDIR $NINECC
COPY 9-cc.patch $NINECC/9-cc.patch
RUN git apply $NINECC/9-cc.patch
RUN if [ `uname -p` = "aarch64" ]; then \
mkdir -p Linux/arm/bin; \
mkdir -p Linux/arm/include; \
mkdir -p Linux/arm/lib; \
else \
mkdir -p Linux/amd64/bin; \
mkdir -p Linux/amd64/include; \
mkdir -p Linux/amd64/lib; \
fi
# Hack up 9-cc to build ar for amd64 (or arm)
RUN ./configure && . ./env
RUN if [ `uname -p` = "aarch64" ]; then \
cp Linux/amd64/include/lib9.h Linux/arm/include/lib9.h; \
cp Linux/amd64/include/fpuctl.h Linux/arm/include/fpuctl.h; \
sed -i 's/arm-gcc/gcc/' mkfiles/mkfile-Linux-arm; \
fi
RUN mk
RUN cp ${NINECC}/src/cmd/iar/o.out $HARVEY_LINUX_BIN/ar
#TEMP!
COPY BUILD_IN_DOCKER /usr/local/
ENTRYPOINT ["bash", "/usr/local/BUILD_IN_DOCKER"]