-
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathsetup_macos.sh
More file actions
executable file
·139 lines (118 loc) · 3.47 KB
/
setup_macos.sh
File metadata and controls
executable file
·139 lines (118 loc) · 3.47 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/bin/bash
# If there's a problem, exit with error status
set -e
# Ensure Homebrew is installed to handle system dependencies
if ! command -v brew >/dev/null 2>&1; then
echo "Homebrew is required but not installed. Please install it from https://brew.sh/"
exit 1
fi
# Check if json-c is already installed via Homebrew
if ! command -v json-c >/dev/null 2>&1; then
brew install json-c
fi
# Check if Maven is already installed via Homebrew
if ! command -v mvn >/dev/null 2>&1; then
brew install maven
fi
# Download ICU4C binaries if the cache directory doesn't exist
if [[ ! -d gh-cache ]]
then
mkdir -p gh-cache
fi
# Ensure that the Python `enum` module is installed using a modern, robust check
python3 -c 'import sys
try:
import enum
print("The enum module is already installed")
except ImportError:
print("The enum module is not installed yet")
sys.exit(1)
' || error_code=$?
if [[ ${error_code:-0} -ne 0 ]]
then
# On Mac, `enum` is a standard built-in library for Python 3.4+.
# If this fails, the system Python is likely broken or too old, so we install a fresh python3.
if ! command -v python3 >/dev/null 2>&1; then
brew install python3
fi
fi
# Install a Rust version for icu4x
# Get the current version string (e.g., "rustc 1.83.0")
if [[ "$(rustc --version 2>/dev/null)" != *"1.83"* ]]; then
if command -v rustup &> /dev/null; then
echo "Updating Rust to 1.83..."
rustup install 1.83
else
echo "Error: rustc is not 1.83 and rustup was not found to perform the update."
exit 1
fi
else
echo "rustc 1.83 is already installed."
fi
# Note: The official ICU GitHub releases do NOT contain pre-compiled macOS binaries.
# URLs have been updated to download the source tarballs (-src.tgz).
function download_71_1() {
if [[ ! -f icu4c-71_1-src.tgz ]]
then
curl -L -O https://github.com/unicode-org/icu/releases/download/release-71-1/icu4c-71_1-src.tgz
fi
}
function download_72_1() {
if [[ ! -f icu4c-72_1-src.tgz ]]
then
curl -L -O https://github.com/unicode-org/icu/releases/download/release-72-1/icu4c-72_1-src.tgz
fi
}
function download_73_1() {
if [[ ! -f icu4c-73_1-src.tgz ]]
then
curl -L -O https://github.com/unicode-org/icu/releases/download/release-73-1/icu4c-73_1-src.tgz
fi
}
function download_74_1() {
if [[ ! -f icu4c-74_1-src.tgz ]]
then
curl -L -O https://github.com/unicode-org/icu/releases/download/release-74-1/icu4c-74_1-src.tgz
fi
}
function download_74_2() {
if [[ ! -f icu4c-74_2-src.tgz ]]
then
curl -L -O https://github.com/unicode-org/icu/releases/download/release-74-2/icu4c-74_2-src.tgz
fi
}
function download_75_1() {
if [[ ! -f icu4c-75_1-src.tgz ]]
then
curl -L -O https://github.com/unicode-org/icu/releases/download/release-75-1/icu4c-75_1-src.tgz
fi
}
function download_76_1() {
if [[ ! -f icu4c-76_1-src.tgz ]]
then
curl -L -O https://github.com/unicode-org/icu/releases/download/release-76-1/icu4c-76_1-src.tgz
fi
}
function download_77_1() {
if [[ ! -f icu4c-77_1-src.tgz ]]
then
curl -L -O https://github.com/unicode-org/icu/releases/download/release-77-1/icu4c-77_1-src.tgz
fi
}
function download_78_1() {
if [[ ! -f icu4c-78.1-sources.tgz ]]
then
curl -L -O https://github.com/unicode-org/icu/releases/download/release-78.1/icu4c-78.1-sources.tgz
fi
}
pushd gh-cache
download_71_1
download_72_1
download_73_1
download_74_1
download_74_2
download_75_1
download_76_1
download_77_1
download_78_1
popd