-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
74 lines (56 loc) · 2.36 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
FROM gcc:7 AS builder
# Add backport repos
RUN printf "deb http://httpredir.debian.org/debian stretch-backports main non-free\ndeb-src http://httpredir.debian.org/debian stretch-backports main non-free" > /etc/apt/sources.list.d/backports.list
# Install git and up-to-date cmake
RUN apt-get update && apt-get install -y git && apt-get -t stretch-backports install -y cmake
# Clone twili
RUN git clone --recursive --depth=1 --single-branch https://github.com/misson20000/twili.git /root/twili
# Build twili
RUN cd /root/twili/twib && mkdir build && cd build && mkdir prefix && \
cmake -G "Unix Makefiles" .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/root/twili/twib/build/prefix \
-DTWIBD_LIBUSB_BACKEND_ENABLED=OFF && \
make -j4 && make install
FROM devkitpro/devkita64
ENV PATH=$DEVKITPRO/devkitA64/bin:$PATH
# Install GCC for the CC link
RUN sudo apt-get update
RUN sudo apt-get install -y build-essential
# Install Rust
RUN curl https://sh.rustup.rs -sSf > rust-init.rs
RUN chmod +x rust-init.rs
RUN ./rust-init.rs -y --default-toolchain nightly-2019-01-19
RUN rm rust-init.rs
ENV PATH=/root/.cargo/bin:$PATH
RUN rustup component add rust-src
# Install dependencies
RUN cargo install xargo
RUN wget https://github.com/MegatonHammer/linkle/releases/download/v0.2.7/linkle-v0.2.7-x86_64-unknown-linux-musl.tar.gz && tar -xf linkle-*.tar.gz -C /usr/bin/
RUN cargo install --git https://github.com/rusty-horizon/aarch64-horizon-nro-ld.git
# Update devkitA64
RUN (ln -s /proc/mounts /etc/mtab || true); dkp-pacman --noconfirm -Syyu
# Add targets
COPY aarch64-horizon-elf.json /etc/rust-targets/
COPY aarch64-horizon-nro.json /etc/rust-targets/
ENV RUST_TARGET_PATH=/etc/rust-targets/
# Build sysroot
COPY sysroot-builder/ /tmp/sysroot-builder/
# aarch64-horizon-elf
RUN cd /tmp/sysroot-builder/ && \
xargo build --target aarch64-horizon-elf -vv # rerun
# aarch64-horizon-nro
RUN cd /tmp/sysroot-builder/ && \
xargo build --target aarch64-horizon-nro -vv # rerun
# Cleanup
RUN rm -rf /tmp/sysroot-builder/
# Copy twib
COPY --from=builder /root/twili/twib/build/prefix/bin/twib /usr/bin/twib
# Add cargo config
COPY cargo-config.toml /.cargo/config
# Set CC
ENV CC_aarch64-none-elf=aarch64-none-elf-gcc
ENV CC_aarch64-horizon-elf=aarch64-none-elf-gcc
ENV CC_aarch64-horizon-nro=aarch64-none-elf-gcc
# Mount the work directory
WORKDIR workdir
VOLUME workdir