forked from lovell/sharp-libvips
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathDockerfile
79 lines (69 loc) · 2.2 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
FROM amazonlinux:2
LABEL maintainer="Kleis Auke Wolthuizen <[email protected]>"
# Create Amazon Linux 2 (glibc 2.26) container suitable for cross-compiling Linux ARMv7-A binaries
# Path settings
ENV \
RUSTUP_HOME="/usr/local/rustup" \
CARGO_HOME="/usr/local/cargo" \
PATH="/usr/local/cargo/bin:/x-tools/armv7-unknown-linux-gnueabihf/bin:$PATH"
# Build dependencies
RUN \
yum update -y && \
amazon-linux-extras install epel -y && \
yum group install -y "Development Tools" && \
yum install -y --setopt=tsflags=nodocs \
cmake3 \
gperf \
jq \
openssl-devel \
python3 \
# Needed by crosstool-ng
help2man \
ncurses-devel \
texinfo \
which \
&& \
curl https://sh.rustup.rs -sSf | sh -s -- -y \
--no-modify-path \
--profile minimal \
&& \
rustup target add arm-unknown-linux-gnueabihf && \
cargo install cargo-c --locked && \
ln -s /usr/bin/cmake3 /usr/bin/cmake && \
pip3 install meson ninja packaging tomli
# Download and install crosstool-ng 1.26.0
WORKDIR /crosstool-ng
RUN \
curl -sL https://github.com/crosstool-ng/crosstool-ng/releases/download/crosstool-ng-1.26.0/crosstool-ng-1.26.0.tar.xz | \
tar xJC /crosstool-ng --strip-components=1 && \
./bootstrap && \
./configure --prefix=/usr/local && \
make -j$(nproc) && \
make install && \
cd .. && \
rm -rf crosstool-ng
# Build cross-compiler (GCC 13.2.0 - glibc 2.26)
WORKDIR /x-tools/build
COPY armv7-linux-gnueabihf.config /x-tools/build/.config
RUN \
ct-ng olddefconfig && \
CT_ALLOW_BUILD_AS_ROOT_SURE=y ct-ng build || (cat build.log && exit 1) && \
cd .. && \
rm -rf build
WORKDIR /
# Compiler settings
ENV \
CC="armv7-unknown-linux-gnueabihf-gcc" \
CXX="armv7-unknown-linux-gnueabihf-g++" \
AR="armv7-unknown-linux-gnueabihf-ar" \
STRIP="armv7-unknown-linux-gnueabihf-strip" \
RANLIB="armv7-unknown-linux-gnueabihf-ranlib" \
OBJDUMP="armv7-unknown-linux-gnueabihf-objdump" \
PKG_CONFIG="pkg-config --static" \
PLATFORM="linux-arm" \
CHOST="arm-linux-gnueabihf" \
RUST_TARGET="arm-unknown-linux-gnueabihf" \
FLAGS="-marm -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard" \
MESON="--cross-file=/root/meson.ini"
COPY Toolchain.cmake /root/
COPY meson.ini /root/