-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
setup.sh
executable file
·255 lines (226 loc) · 7.05 KB
/
setup.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
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
#!/bin/bash
# Copyright (c) 2024 Alex313031.
YEL='\033[1;33m' # Yellow
CYA='\033[1;96m' # Cyan
RED='\033[1;31m' # Red
GRE='\033[1;32m' # Green
c0='\033[0m' # Reset Text
bold='\033[1m' # Bold Text
underline='\033[4m' # Underline Text
# Error handling
yell() { echo "$0: $*" >&2; }
die() { yell "$*"; exit 111; }
try() { "$@" || die "${RED}Failed $*"; }
# --help
displayHelp () {
printf "\n" &&
printf "${bold}${GRE}Script to copy Mercury source files over the Mozilla source tree.${c0}\n" &&
printf "${bold}${YEL}Use the --win flag to copy the Windows mozconfig${c0}\n" &&
printf "${bold}${YEL}Use the --cross flag to copy the Windows cross-compile mozconfig${c0}\n" &&
printf "${bold}${YEL}Use the --cross-avx2 flag to copy the Windows AVX2 cross-compile mozconfig${c0}\n" &&
printf "${bold}${YEL}Use the --sse3 flag to make an SSE3 build${c0}\n" &&
printf "${bold}${YEL}Use the --win-sse3 flag to make an SSE3 Windows build${c0}\n" &&
printf "${bold}${YEL}Use the --sse4 flag to make an SSE4.1 build${c0}\n" &&
printf "${bold}${YEL}Use the --win-sse4 flag to make an SSE4.1 Windows build${c0}\n" &&
printf "${bold}${YEL}Use the --avx2 flag to make an AVX2 build${c0}\n" &&
printf "${bold}${YEL}Use the --win-avx2 flag to make an AVX2 Windows build${c0}\n" &&
printf "${bold}${YEL}Use the --debug flag to make a debug Linux build${c0}\n" &&
printf "${bold}${YEL}Use the --win-debug flag to make a debug Windows build${c0}\n" &&
printf "${bold}${YEL}Use the --mac flag to make a MacOS x64 build${c0}\n" &&
printf "${bold}${YEL}Use the --mac-arm flag to make a MacOS arm64 build${c0}\n" &&
printf "${bold}${YEL}Use the --mac-cross flag to to copy the MacOS x64 cross-compile mozconfig${c0}\n" &&
printf "${bold}${YEL}Use the --mac-arm-cross flag to to copy the MacOS arm64 cross-compile mozconfig${c0}\n" &&
printf "${bold}${YEL}Use the --arm64 flag to make a Linux arm64 build${c0}\n" &&
printf "${bold}${YEL}Use the --help flag to show this help${c0}\n" &&
printf "\n"
}
case $1 in
--help) displayHelp; exit 0;;
esac
# mozilla source dir env variable
if [ -z "${HG_SRC_DIR}" ]; then
HG_SRC_DIR="$HOME/mozilla-unified"
export HG_SRC_DIR
else
HG_SRC_DIR="${HG_SRC_DIR}"
export HG_SRC_DIR
fi
printf "\n" &&
printf "${YEL}Copying Mercury source files over the Mozilla tree...${c0}\n" &&
cp -r -v ./app/. ${HG_SRC_DIR}/browser/app/ &&
cp -r -v ./browser/. ${HG_SRC_DIR}/browser/ &&
cp -r -v ./build/. ${HG_SRC_DIR}/build/ &&
cp -r -v ./devtools/. ${HG_SRC_DIR}/devtools/ &&
cp -r -v ./ipc/. ${HG_SRC_DIR}/ipc/ &&
cp -r -v ./moz.build ${HG_SRC_DIR}/ &&
cp -r -v ./netwerk/. ${HG_SRC_DIR}/netwerk/ &&
cp -r -v ./other-licenses/. ${HG_SRC_DIR}/other-licenses/ &&
mkdir -p -v ${HG_SRC_DIR}/policies &&
cp -r -v ./policies/. ${HG_SRC_DIR}/policies/ &&
cp -r -v ./toolkit/. ${HG_SRC_DIR}/toolkit/ &&
cp -r -v ./testing/. ${HG_SRC_DIR}/testing/ &&
cp -v ./mozconfigs/ga ${HG_SRC_DIR} &&
cp -v ./mozconfigs/mozconfig ${HG_SRC_DIR} &&
copyWin () {
printf "\n" &&
printf "${GRE}Copying Windows (Native Build) mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/mozconfig-win ${HG_SRC_DIR}/mozconfig
}
case $1 in
--win) copyWin;
esac
copyWinCross () {
printf "\n" &&
printf "${GRE}Copying Windows (Cross Compile) mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/mozconfig-win-cross ${HG_SRC_DIR}/mozconfig
}
case $1 in
--cross) copyWinCross;
esac
copySSE3 () {
printf "\n" &&
printf "${GRE}Copying SSE3 mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/mozconfig-sse3 ${HG_SRC_DIR}/mozconfig
}
case $1 in
--sse3) copySSE3;
esac
copyWinSSE3 () {
printf "\n" &&
printf "${GRE}Copying Windows SSE3 mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/mozconfig-win-sse3 ${HG_SRC_DIR}/mozconfig
}
case $1 in
--win-sse3) copyWinSSE3;
esac
copySSE41 () {
printf "\n" &&
printf "${GRE}Copying SSE4.1 mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/mozconfig-sse4 ${HG_SRC_DIR}/mozconfig
}
case $1 in
--sse4) copySSE41;
esac
copyWinSSE41 () {
printf "\n" &&
printf "${GRE}Copying Windows SSE4.1 mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/mozconfig-win-sse4 ${HG_SRC_DIR}/mozconfig
}
case $1 in
--win-sse4) copyWinSSE41;
esac
copyAVX2 () {
printf "\n" &&
printf "${GRE}Copying AVX2 mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/context.py ${HG_SRC_DIR}/python/mozbuild/mozbuild/frontend/ &&
cp -v mozconfigs/mozconfig-avx2 ${HG_SRC_DIR}/mozconfig
}
case $1 in
--avx2) copyAVX2;
esac
copyWinAVX2 () {
printf "\n" &&
printf "${GRE}Copying Windows AVX2 mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/context.py ${HG_SRC_DIR}/python/mozbuild/mozbuild/frontend/ &&
cp -v mozconfigs/mozconfig-win-avx2 ${HG_SRC_DIR}/mozconfig
}
case $1 in
--win-avx2) copyWinAVX2;
esac
copyWinCrossAVX2 () {
printf "\n" &&
printf "${GRE}Copying Windows AVX2 (Cross Compile) mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/context.py ${HG_SRC_DIR}/python/mozbuild/mozbuild/frontend/ &&
cp -v mozconfigs/mozconfig-win-avx2-cross ${HG_SRC_DIR}/mozconfig
}
case $1 in
--cross-avx2) copyWinCrossAVX2;
esac
copyDebug () {
printf "\n" &&
printf "${GRE}Copying debug mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/mozconfig-debug ${HG_SRC_DIR}/mozconfig
}
case $1 in
--debug) copyDebug;
esac
copyWinDebug () {
printf "\n" &&
printf "${GRE}Copying Windows debug mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/mozconfig-win-debug ${HG_SRC_DIR}/mozconfig
}
case $1 in
--win-debug) copyWinDebug;
esac
copyMac () {
printf "\n" &&
printf "${GRE}Copying MacOS x64 mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/context.py ${HG_SRC_DIR}/python/mozbuild/mozbuild/frontend/ &&
cp -v mozconfigs/mozconfig-macos-x64 ${HG_SRC_DIR}/mozconfig
}
case $1 in
--mac) copyMac;
esac
copyMacArm () {
printf "\n" &&
printf "${GRE}Copying MacOS ARM64 mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/mozconfig-macos-arm64 ${HG_SRC_DIR}/mozconfig
}
case $1 in
--mac-arm) copyMacArm;
esac
copyMacCross () {
printf "\n" &&
printf "${GRE}Copying MacOS x64 (Cross Compile) mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/context.py ${HG_SRC_DIR}/python/mozbuild/mozbuild/frontend/ &&
cp -v mozconfigs/mozconfig-macos-x64-cross ${HG_SRC_DIR}/mozconfig
}
case $1 in
--mac-cross) copyMacCross;
esac
copyMacArmCross () {
printf "\n" &&
printf "${GRE}Copying MacOS ARM64 (Cross Compile) mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/mozconfig-macos-arm64-cross ${HG_SRC_DIR}/mozconfig
}
case $1 in
--mac-arm-cross) copyMacArmCross;
esac
copyLinuxArm64 () {
printf "\n" &&
printf "${GRE}Copying Linux ARM64 mozconfig${c0}\n" &&
printf "\n" &&
cp -v mozconfigs/context.py ${HG_SRC_DIR}/python/mozbuild/mozbuild/frontend/ &&
cp -v mozconfigs/mozconfig-arm64 ${HG_SRC_DIR}/mozconfig
}
case $1 in
--arm64) copyLinuxArm64;
esac
printf "\n" &&
printf "${GRE}Done!\n" &&
printf "\n" &&
printf "${YEL}Setting aliases\n" &&
export EDITOR=nano &&
export VISUAL=nano &&
alias hgpurge='hg purge' &&
alias hgrebase='hg update --clean' &&
printf "\n" &&
printf "${YEL}Look in this file to see the aliases and what they're for.\n" &&
printf "\n" &&
printf "${GRE}Enjoy Mercury!\n" &&
tput sgr0