forked from CODeRUS/docker-sailfishos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·113 lines (93 loc) · 3.96 KB
/
build.sh
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
108
109
110
111
112
113
#!/usr/bin/env bash
set -euxo pipefail
# env
export $(egrep -v '^#' env | xargs -d '\n')
export DOCKER_BUILDKIT=1
SDK_NAME="Sailfish_OS-$TARGET_VERSION-Platform_SDK_Chroot-i486.tar.bz2"
SDK_URL="http://releases.sailfishos.org/sdk/installers/$SDK_VERSION/$SDK_NAME"
TOOLING_NAME="Sailfish_OS-$TARGET_VERSION-Sailfish_SDK_Tooling-i486.tar.7z"
TOOLING_TAR_NAME="Sailfish_OS-$TARGET_VERSION-Sailfish_SDK_Tooling-i486.tar"
TOOLING_URL="https://releases.sailfishos.org/sdk/targets/$TOOLING_NAME"
TARGET_ARMV7HL_NAME="Sailfish_OS-$TARGET_VERSION-Sailfish_SDK_Target-armv7hl.tar.7z"
TARGET_ARMV7HL_URL="https://releases.sailfishos.org/sdk/targets/$TARGET_ARMV7HL_NAME"
TARGET_I486_NAME="Sailfish_OS-$TARGET_VERSION-Sailfish_SDK_Target-i486.tar.7z"
TARGET_I486_URL="https://releases.sailfishos.org/sdk/targets/$TARGET_I486_NAME"
TARGET_AARCH64_NAME="Sailfish_OS-$TARGET_VERSION-Sailfish_SDK_Target-aarch64.tar.7z"
TARGET_AARCH64_URL="https://releases.sailfishos.org/sdk/targets/$TARGET_AARCH64_NAME"
echo "== ⚙️ Download zips"
mkdir -p target
if [ ! -f "target/$SDK_NAME" ] ; then
curl --fail "$SDK_URL" -o "target/$SDK_NAME"
curl --fail "$SDK_URL.md5" -o "target/$SDK_NAME.md5"
(cd target && md5sum -c "$SDK_NAME.md5")
fi
if [ ! -f "target/$TOOLING_NAME" ] ; then
curl --fail "$TOOLING_URL" -o "target/$TOOLING_NAME"
curl --fail "$TOOLING_URL.md5sum" -o "target/$TOOLING_NAME.md5"
(cd target && md5sum -c "$TOOLING_NAME.md5")
fi
if [ ! -f "target/$TARGET_ARMV7HL_NAME" ] ; then
curl --fail "$TARGET_ARMV7HL_URL" -o "target/$TARGET_ARMV7HL_NAME"
curl --fail "$TARGET_ARMV7HL_URL.md5sum" -o "target/$TARGET_ARMV7HL_NAME.md5"
(cd target && md5sum -c "$TARGET_ARMV7HL_NAME.md5")
fi
if [ ! -f "target/$TARGET_I486_NAME" ] ; then
curl --fail "$TARGET_I486_URL" -o "target/$TARGET_I486_NAME"
curl --fail "$TARGET_I486_URL.md5sum" -o "target/$TARGET_I486_NAME.md5"
(cd target && md5sum -c "$TARGET_I486_NAME.md5")
fi
if [ ! -f "target/$TARGET_AARCH64_NAME" ] ; then
curl --fail "$TARGET_AARCH64_URL" -o "target/$TARGET_AARCH64_NAME"
curl --fail "$TARGET_AARCH64_URL.md5sum" -o "target/$TARGET_AARCH64_NAME.md5"
(cd target && md5sum -c "$TARGET_AARCH64_NAME.md5")
fi
echo "== ⚙️ Building images"
docker import "target/$SDK_NAME" "$SDK_BASE_IMAGE-import:$TARGET_VERSION"
docker build \
-f base.Dockerfile \
--build-arg "TARGET_VERSION=$TARGET_VERSION" \
--build-arg "SDK_BASE_IMAGE=$SDK_BASE_IMAGE-import:$TARGET_VERSION" \
-t "$SDK_BASE_IMAGE:$TARGET_VERSION" \
-t "$SDK_BASE_IMAGE:latest" \
.
docker rmi "$SDK_BASE_IMAGE-import:$TARGET_VERSION"
docker build \
-f tooling.Dockerfile \
--build-arg "TARGET_VERSION=$TARGET_VERSION" \
--build-arg "SDK_BASE_IMAGE=$SDK_BASE_IMAGE" \
--build-arg "TOOLING_NAME=$TOOLING_NAME" \
-t "$SDK_TOOLING_IMAGE:$TARGET_VERSION" \
-t "$SDK_TOOLING_IMAGE:latest" \
.
docker build \
-f armv7hl.Dockerfile \
--build-arg "TARGET_VERSION=$TARGET_VERSION" \
--build-arg "SDK_TOOLING_IMAGE=$SDK_TOOLING_IMAGE" \
--build-arg "TARGET_ARMV7HL_NAME=$TARGET_ARMV7HL_NAME" \
-t "$SDK_IMAGE:$TARGET_VERSION-armv7hl" \
-t "$SDK_IMAGE:armv7hl" \
.
docker build \
-f i486.Dockerfile \
--build-arg "TARGET_VERSION=$TARGET_VERSION" \
--build-arg "SDK_TOOLING_IMAGE=$SDK_TOOLING_IMAGE" \
--build-arg "TARGET_I486_NAME=$TARGET_I486_NAME" \
-t "$SDK_IMAGE:$TARGET_VERSION-i486" \
-t "$SDK_IMAGE:i486" \
.
docker build \
-f aarch64.Dockerfile \
--build-arg "TARGET_VERSION=$TARGET_VERSION" \
--build-arg "SDK_TOOLING_IMAGE=$SDK_TOOLING_IMAGE" \
--build-arg "TARGET_AARCH64_NAME=$TARGET_AARCH64_NAME" \
-t "$SDK_IMAGE:$TARGET_VERSION-aarch64" \
-t "$SDK_IMAGE:aarch64" \
.
docker build \
-f all.Dockerfile \
--build-arg "TARGET_VERSION=$TARGET_VERSION" \
--build-arg "SDK_IMAGE=$SDK_IMAGE" \
--build-arg "TARGET_I486_NAME=$TARGET_I486_NAME" \
-t "$SDK_IMAGE:$TARGET_VERSION" \
-t "$SDK_IMAGE:latest" \
.