-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.rust
107 lines (96 loc) · 5.52 KB
/
Dockerfile.rust
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# ARG needs repeating for every FROM statement
ARG SFOS_VERSION=latest
ARG EXTRA_TARGETS=3.4.0.24
ARG SFOS_ARCH=armv7hl
FROM coderus/sailfishos-platform-sdk-$SFOS_ARCH:$SFOS_VERSION
ARG SFOS_VERSION=latest
ARG EXTRA_TARGETS=3.4.0.24
ARG SFOS_ARCH=armv7hl
ARG RUST_TARGET=armv7-unknown-linux-gnueabihf
ARG RUST_VERSION=1.52.1+git3-1
ARG RUST_STD_VERSION=1.0+git3-1
RUN for TARGET_VERSION in $EXTRA_TARGETS; do \
sdk-assistant -y create SailfishOS-$TARGET_VERSION-$SFOS_ARCH \
https://releases.sailfishos.org/sdk/targets/Sailfish_OS-$TARGET_VERSION-Sailfish_SDK_Target-$SFOS_ARCH.tar.7z --tooling SailfishOS-$SFOS_VERSION ;\
done
# Put back the original SailfishOS chrooting script,
# because CodeRUS has overriden this. We only need this during buildtime,
# not at runtime, so it doesn't matter
COPY mer-tooling-chroot /srv/mer/toolings/SailfishOS-$SFOS_VERSION/mer-tooling-chroot
RUN for TARGET_VERSION in $EXTRA_TARGETS $SFOS_VERSION; do \
echo Install develpkgs in SailfishOS-$TARGET_VERSION-$SFOS_ARCH ;\
sdk-manage develpkg install SailfishOS-$TARGET_VERSION-$SFOS_ARCH \
sqlcipher-devel \
qtmozembed-qt5-devel \
sqlite-devel \
openssl-libs \
openssl-devel \
openssl-static \
dbus-devel \
libnemotransferengine-qt5-devel \
tcl \
; \
done
# Required by sccache for i486 for some reason.
RUN sdk-manage tooling maintain SailfishOS-$SFOS_VERSION \
zypper install -y openssl-devel
RUN sudo zypper install -y openssl-devel
RUN sdk-manage tooling maintain SailfishOS-$SFOS_VERSION \
zypper ar --gpgcheck-allow-unsigned -f https://nas.rubdos.be/~rsmet/sailfish-repo/ rubdos
RUN sdk-manage tooling maintain SailfishOS-$SFOS_VERSION \
zypper install --from rubdos -y rust=$RUST_VERSION cargo=$RUST_VERSION rust-std-static-aarch64-unknown-linux-gnu==$RUST_VERSION rust-std-static-armv7-unknown-linux-gnueabihf==$RUST_VERSION rust-std-static-i686-unknown-linux-gnu==$RUST_VERSION
RUN for TARGET_VERSION in $EXTRA_TARGETS $SFOS_VERSION; do \
echo Install Rust in SailfishOS-$TARGET_VERSION-$SFOS_ARCH ;\
sdk-manage target maintain SailfishOS-$TARGET_VERSION-$SFOS_ARCH \
zypper ar --gpgcheck-allow-unsigned -f https://nas.rubdos.be/~rsmet/sailfish-repo/ rubdos && \
if [ "$SFOS_ARCH" == "i486" ]; then \
sdk-manage target maintain SailfishOS-$TARGET_VERSION-$SFOS_ARCH \
zypper install --from rubdos -y rust=$RUST_VERSION cargo=$RUST_VERSION rust-std-static-i686-unknown-linux-gnu==$RUST_VERSION ; \
elif [ "$SFOS_ARCH" == "armv7hl" ]; then \
sdk-manage target maintain SailfishOS-$TARGET_VERSION-$SFOS_ARCH \
zypper install --repo rubdos -y rust=$RUST_VERSION cargo=$RUST_VERSION rust-std-static-armv7-unknown-linux-gnueabihf==$RUST_STD_VERSION rust-std-static-i686-unknown-linux-gnu==$RUST_STD_VERSION ; \
elif [ "$SFOS_ARCH" == "aarch64" ]; then \
sdk-manage target maintain SailfishOS-$TARGET_VERSION-$SFOS_ARCH \
zypper install --repo rubdos -y rust=$RUST_VERSION cargo=$RUST_VERSION rust-std-static-aarch64-unknown-linux-gnu==$RUST_STD_VERSION rust-std-static-i686-unknown-linux-gnu==$RUST_STD_VERSION ; \
fi && \
sdk-manage develpkg list SailfishOS-$TARGET_VERSION-$SFOS_ARCH \
rust && \
sb2 -t SailfishOS-$TARGET_VERSION-$SFOS_ARCH rustc --version ;\
done
COPY sccache sccache
USER root
RUN chown -R mersdk:mersdk sccache
USER mersdk
RUN for TARGET_VERSION in $EXTRA_TARGETS $SFOS_VERSION; do \
echo "Installing sccache 0.2.15 (0.3.0 requires Rust 1.58) for SailfishOS $TARGET_VERSION" &&\
export PKG_CONFIG_ALLOW_CROSS_i686_unknown_linux_gnu=1 &&\
export PKG_CONFIG_ALLOW_CROSS_armv7_unknown_linux_gnueabihf=1 &&\
export PKG_CONFIG_ALLOW_CROSS_aarch64_unknown_linux_gnu=1 &&\
export HOST_CC=host-cc &&\
export HOST_CXX=host-cxx &&\
export CC_i686_unknown_linux_gnu=host-cc &&\
export LD_i686_unknown_linux_gnu=host-cc &&\
export CXX_i686_unknown_linux_gnu=host-cc &&\
export PATH=/opt/cross/bin/:$PATH &&\
export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=armv7hl-meego-linux-gnueabi-gcc &&\
export CC_armv7_unknown_linux_gnueabihf=armv7hl-meego-linux-gnueabi-gcc &&\
export CXX_armv7_unknown_linux_gnueabihf=armv7hl-meego-linux-gnueabi-g++ &&\
export AR_armv7_unknown_linux_gnueabihf=armv7hl-meego-linux-gnueabi-ar &&\
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-meego-linux-gnu-gcc &&\
export CC_aarch64_unknown_linux_gnu=aarch64-meego-linux-gnu-gcc &&\
export CXX_aarch64_unknown_linux_gnu=aarch64-meego-linux-gnu-g++ &&\
export AR_aarch64_unknown_linux_gnu=aarch64-meego-linux-gnu-ar &&\
export SB2_RUST_TARGET_TRIPLE=$RUST_TARGET &&\
export OPENSSL_STATIC=true &&\
sb2 -t SailfishOS-$TARGET_VERSION-$SFOS_ARCH \
cargo clean --manifest-path sccache/Cargo.toml && \
sb2 -t SailfishOS-$TARGET_VERSION-$SFOS_ARCH \
cargo build -j 1 --release --manifest-path sccache/Cargo.toml && \
sudo cp sccache/target/$RUST_TARGET/release/sccache /srv/mer/targets/SailfishOS-$TARGET_VERSION-$SFOS_ARCH/usr/local/bin/ ;\
done && sudo rm -rf .cargo
RUN sudo rm -rf sccache
RUN sudo rm -rf /srv/mer/targets/SailfishOS-$SFOS_VERSION-$SFOS_ARCH/var/cache/zypp/*
# Hack for 4.3
RUN if [[ "$SFOS_VERSION" == "4.3.0.12" ]]; then \
echo "--http1.1" > .curlrc; \
fi