@@ -15,28 +15,82 @@ realpath() {
15
15
cd " ${OLDPWD} " || exit 1
16
16
}
17
17
18
+ buildenv_from_download_server () { # 2.6
19
+ http_code=$( curl -sI -w " %{http_code}" " https://downloads.mixxx.org/dependencies/${1} /macOS/${2} .zip" -o /dev/null)
20
+ if [ " $http_code " -ne 200 ]; then
21
+ >&2 echo " Downloading failed with HTTP status code: $http_code "
22
+ exit 1
23
+ fi
24
+ curl " https://downloads.mixxx.org/dependencies/${1} /macOS/${2} .zip" -o " ${3} .zip"
25
+ OBSERVED_SHA256=$( shasum -a 256 " ${3} .zip" | cut -f 1 -d' ' )
26
+ if [[ " $OBSERVED_SHA256 " == " $4 " ]]; then
27
+ >&2 echo " Download matched expected SHA256 sum $4 "
28
+ echo " ${3} .zip"
29
+ else
30
+ >&2 echo " ERROR: Download did not match expected SHA256 checksum!"
31
+ >&2 echo " Expected $4 "
32
+ >&2 echo " Got $OBSERVED_SHA256 "
33
+ exit 1
34
+ fi
35
+ }
36
+
37
+ buildenv_from_gh_release () {
38
+ part=0
39
+ trap ' find . -name "mixxx-deps-${1}-${3}-${2}.*" -delete && exit' SIGINT SIGABRT
40
+ part_uri=" https://github.com/acolombier/vcpkg/releases/download/${1} -${2} /mixxx-deps-${1} -${3} -${2} .zip.part0${part} "
41
+ while true ; do
42
+ http_code=$( curl -sI -w " %{http_code}" " $part_uri " -o /dev/null)
43
+ if [ " $http_code " -ne 200 ] && [ " $http_code " -ne 302 ]; then
44
+ if [ " $part " = 0 ]; then
45
+ >&2 echo " Downloading $part_uri failed with HTTP status code: $http_code "
46
+ exit 1
47
+ else
48
+ break
49
+ fi
50
+ fi
51
+ curl -L " ${part_uri} " -o " $( basename " ${part_uri} " ) "
52
+ part=$(( part + 1 ))
53
+ part_uri=" https://github.com/acolombier/vcpkg/releases/download/${1} -${2} /mixxx-deps-${1} -${3} -${2} .zip.part0${part} "
54
+ done
55
+
56
+ cat mixxx-deps-" ${1} -${3} -${2} " .zip.part* > " ${4} "
57
+ find . -name " mixxx-deps-${1} -${3} -${2} .zip.part*" -delete
58
+
59
+ expected_sha256=$( curl -L " https://github.com/acolombier/vcpkg/releases/download/${1} -${2} /mixxx-deps-${1} -${3} -${2} .zip.sha256" )
60
+ observed_sha256=$( shasum -a 256 " ${4} " | cut -f 1 -d' ' )
61
+
62
+ if [ " $expected_sha256 " = " $observed_sha256 " ]; then
63
+ >&2 echo " Download matched expected SHA256 sum"
64
+ rm -f " mixxx-deps-${1} -${3} -${2} .sha256"
65
+ else
66
+ >&2 echo " ERROR: Download did not match expected SHA256 checksum!"
67
+ find . -name " mixxx-deps-${1} -${3} -${2} .*" -delete
68
+ exit 1
69
+ fi
70
+ }
71
+
18
72
# some hackery is required to be compatible with both bash and zsh
19
73
THIS_SCRIPT_NAME=${BASH_SOURCE[0]}
20
74
[ -z " $THIS_SCRIPT_NAME " ] && THIS_SCRIPT_NAME=$0
21
75
76
+ VCPKG_COMMIT_SHA=" d3b6db3"
77
+ BUILDENV_MINOR_VERSION=" 2.6"
78
+
22
79
if [ -n " ${BUILDENV_ARM64} " ]; then
23
80
VCPKG_TARGET_TRIPLET=" arm64-osx-min1100-release"
24
- BUILDENV_BRANCH=" 2.5-rel"
25
- BUILDENV_NAME=" mixxx-deps-2.5-arm64-osx-min1100-release-40c29ff"
81
+ BUILDENV_BRANCH_SUFFIX=" -rel"
26
82
BUILDENV_SHA256=" b76685e77f681baf8fdc5037297b0f16d323a405d09ce276d8844304530278e1"
27
83
else
28
84
if [ -n " ${BUILDENV_RELEASE} " ]; then
29
85
VCPKG_TARGET_TRIPLET=" x64-osx-min1100-release"
30
- BUILDENV_BRANCH=" 2.5-rel"
31
- BUILDENV_NAME=" mixxx-deps-2.5-x64-osx-min1100-release-40c29ff"
86
+ BUILDENV_BRANCH_SUFFIX=" -rel"
32
87
BUILDENV_SHA256=" a9b7dd2cb9ab00db6d05ac1f05aab933ed0ab2697f71db1a1bad70305befcf1b"
33
88
else
34
89
VCPKG_TARGET_TRIPLET=" x64-osx-min1100"
35
- BUILDENV_BRANCH=" 2.5"
36
- BUILDENV_NAME=" mixxx-deps-2.5-x64-osx-min1100-c15790e"
37
90
BUILDENV_SHA256=" 0252293436efed1b043d5c6ee384a9502ca0ade712eff95b2c0d2199d94598bb"
38
91
fi
39
92
fi
93
+ BUILDENV_NAME=" mixxx-deps-${BUILDENV_MINOR_VERSION} -${VCPKG_TARGET_TRIPLET} -${VCPKG_COMMIT_SHA} "
40
94
41
95
MIXXX_ROOT=" $( realpath " $( dirname " $THIS_SCRIPT_NAME " ) /.." ) "
42
96
@@ -56,22 +110,14 @@ case "$1" in
56
110
mkdir -p " ${BUILDENV_BASEPATH} "
57
111
if [ ! -d " ${BUILDENV_PATH} " ]; then
58
112
if [ " $1 " != " --profile" ]; then
59
- echo " Build environment $BUILDENV_NAME not found in mixxx repository, downloading https://downloads.mixxx.org/dependencies/${BUILDENV_BRANCH} /macOS/${BUILDENV_NAME} .zip"
60
- http_code=$( curl -sI -w " %{http_code}" " https://downloads.mixxx.org/dependencies/${BUILDENV_BRANCH} /macOS/${BUILDENV_NAME} .zip" -o /dev/null)
61
- if [ " $http_code " -ne 200 ]; then
62
- echo " Downloading failed with HTTP status code: $http_code "
63
- exit 1
64
- fi
65
- curl " https://downloads.mixxx.org/dependencies/${BUILDENV_BRANCH} /macOS/${BUILDENV_NAME} .zip" -o " ${BUILDENV_PATH} .zip"
66
- OBSERVED_SHA256=$( shasum -a 256 " ${BUILDENV_PATH} .zip" | cut -f 1 -d' ' )
67
- if [[ " $OBSERVED_SHA256 " == " $BUILDENV_SHA256 " ]]; then
68
- echo " Download matched expected SHA256 sum $BUILDENV_SHA256 "
113
+ if [ " $BUILDENV_SRC " = " gh" ]; then
114
+ echo " Build environment $BUILDENV_NAME not found in mixxx repository, downloading from Mixxx's VCPKG repo"
115
+ buildenv_from_gh_release " ${BUILDENV_MINOR_VERSION} " " ${VCPKG_COMMIT_SHA} " " ${VCPKG_TARGET_TRIPLET} " " ${BUILDENV_PATH} .zip"
69
116
else
70
- echo " ERROR: Download did not match expected SHA256 checksum!"
71
- echo " Expected $BUILDENV_SHA256 "
72
- echo " Got $OBSERVED_SHA256 "
73
- exit 1
117
+ echo " Build environment $BUILDENV_NAME not found in mixxx repository, downloading from Mixxx download server"
118
+ buildenv_from_download_server " ${BUILDENV_BRANCH}${BUILDENV_BRANCH_SUFFIX} " " ${BUILDENV_NAME} " " ${BUILDENV_PATH} " " ${BUILDENV_SHA256} "
74
119
fi
120
+
75
121
echo " "
76
122
echo " Extracting ${BUILDENV_NAME} .zip..."
77
123
unzip " ${BUILDENV_PATH} .zip" -d " ${BUILDENV_BASEPATH} " && \
0 commit comments