Skip to content

Commit 555138b

Browse files
authored
[opt](build) add download-prebuild-thirdparty.sh (apache#60349)
download-prebuild-thirdparty.sh will download prebuild thirdparty based on your operator system and doris version `sh download-prebuild-thirdparty.sh 4.0`
1 parent ed35cd8 commit 555138b

File tree

1 file changed

+146
-0
lines changed

1 file changed

+146
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
#!/bin/bash
2+
# Licensed to the Apache Software Foundation (ASF) under one
3+
# or more contributor license agreements. See the NOTICE file
4+
# distributed with this work for additional information
5+
# regarding copyright ownership. The ASF licenses this file
6+
# to you under the Apache License, Version 2.0 (the
7+
# "License"); you may not use this file except in compliance
8+
# with the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing,
13+
# software distributed under the License is distributed on an
14+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
# KIND, either express or implied. See the License for the
16+
# specific language governing permissions and limitations
17+
# under the License.
18+
19+
################################################################
20+
# This script will download all thirdparties and java libraries
21+
# which are defined in *vars.sh*, unpack patch them if necessary.
22+
# You can run this script multi-times.
23+
# Things will only be downloaded, unpacked and patched once.
24+
################################################################
25+
26+
set -eo pipefail
27+
28+
VERSION="$1"
29+
30+
if [ -z "$VERSION" ]; then
31+
echo "Usage: sh download-prebuild-thirdparty.sh <version>"
32+
exit 1
33+
fi
34+
35+
# ----------------------------
36+
# Detect OS
37+
# ----------------------------
38+
OS="$(uname -s)"
39+
ARCH="$(uname -m)"
40+
41+
case "$OS" in
42+
Darwin)
43+
PLATFORM="darwin"
44+
;;
45+
Linux)
46+
PLATFORM="linux"
47+
;;
48+
*)
49+
echo "Unsupported OS: $OS"
50+
exit 1
51+
;;
52+
esac
53+
54+
# ----------------------------
55+
# Detect ARCH
56+
# ----------------------------
57+
case "$ARCH" in
58+
x86_64|amd64)
59+
ARCH="x86_64"
60+
;;
61+
arm64|aarch64)
62+
ARCH="arm64"
63+
;;
64+
*)
65+
echo "Unsupported architecture: $ARCH"
66+
exit 1
67+
;;
68+
esac
69+
70+
# ----------------------------
71+
# Resolve base release tag
72+
# ----------------------------
73+
case "$VERSION" in
74+
master|4.0)
75+
RELEASE_TAG="automation"
76+
;;
77+
3.1)
78+
RELEASE_TAG="automation-3.1"
79+
;;
80+
3.0)
81+
RELEASE_TAG="automation-3.0"
82+
;;
83+
2.1)
84+
RELEASE_TAG="automation-2.1"
85+
;;
86+
*)
87+
echo "Unsupported version: $VERSION"
88+
exit 1
89+
;;
90+
esac
91+
92+
# ----------------------------
93+
# Resolve filename
94+
# ----------------------------
95+
FILENAME=""
96+
97+
if [ "$PLATFORM" = "darwin" ]; then
98+
FILENAME="doris-thirdparty-prebuilt-darwin-${ARCH}.tar.xz"
99+
else
100+
if [ "$ARCH" = "arm64" ]; then
101+
case "$VERSION" in
102+
master|4.0)
103+
FILENAME="doris-thirdparty-prebuild-arm64.tar.xz"
104+
;;
105+
3.1)
106+
FILENAME="doris-thirdparty-3.1-prebuild-arm64.tar.xz"
107+
;;
108+
3.0)
109+
FILENAME="doris-thirdparty-3.0-prebuild-arm64.tar.xz"
110+
;;
111+
2.1)
112+
FILENAME="doris-thirdparty-2.1-prebuild-arm64.tar.xz"
113+
;;
114+
esac
115+
else
116+
FILENAME="doris-thirdparty-prebuilt-linux-x86_64.tar.xz"
117+
fi
118+
fi
119+
120+
# ----------------------------
121+
# Final URL
122+
# ----------------------------
123+
URL="https://github.com/apache/doris-thirdparty/releases/download/${RELEASE_TAG}/${FILENAME}"
124+
125+
echo "Detected platform : $PLATFORM"
126+
echo "Detected arch : $ARCH"
127+
echo "Version : $VERSION"
128+
echo "Downloading : $URL"
129+
echo
130+
131+
# ----------------------------
132+
# Download
133+
# ----------------------------
134+
if command -v curl >/dev/null 2>&1; then
135+
curl -fL -o "$FILENAME" "$URL"
136+
elif command -v wget >/dev/null 2>&1; then
137+
wget -O "$FILENAME" "$URL"
138+
else
139+
echo "Error: curl or wget is required"
140+
exit 1
141+
fi
142+
143+
echo
144+
echo "Download completed:"
145+
echo " $(pwd)/$FILENAME"
146+

0 commit comments

Comments
 (0)