Skip to content

Commit 4f15447

Browse files
committed
Deprecate old launcher & locales
1 parent c5cad30 commit 4f15447

16 files changed

+59
-18
lines changed

Makefile

+2-5
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,9 @@ check-arch:
124124
fi
125125

126126
build-launcher: check-arch
127-
cd launcher && bash build.sh $(arch) $(os)
127+
cd legacy/launcher && bash build.sh $(arch) $(os)
128128

129129
package-linux:
130-
make build-launcher arch=$(arch) os=linux;
131130
python3 scripts/package.py linux \
132131
--includes \
133132
settings/chrome.css \
@@ -139,7 +138,6 @@ package-linux:
139138
--fonts windows macos linux
140139

141140
package-macos:
142-
make build-launcher arch=$(arch) os=macos;
143141
python3 scripts/package.py macos \
144142
--includes \
145143
settings/chrome.css \
@@ -150,7 +148,6 @@ package-macos:
150148
--fonts windows linux
151149

152150
package-windows:
153-
make build-launcher arch=$(arch) os=windows;
154151
python3 scripts/package.py windows \
155152
--includes \
156153
settings/chrome.css \
@@ -164,7 +161,7 @@ package-windows:
164161
run-launcher:
165162
rm -rf $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch;
166163
make build-launcher arch=x86_64 os=linux;
167-
cp launcher/dist/launch $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch;
164+
cp legacy/launcher/dist/launch $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch;
168165
$(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch
169166

170167
run-pw:

legacy/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Deprecated Assets
2+
3+
##### 2024-11-21
4+
5+
- Old launcher has been deprecated due to it not supporting non-Linux platforms, and for using FF's debugging protocol to load addons [#90](https://github.com/daijro/camoufox/issues/90).
6+
- `generate-locales.sh` (based on [LibreWolf's locale build system](https://gitlab.com/librewolf-community/browser/source/-/blob/3dc56de7b0665724bf3842198cebe961c42a81e0/scripts/generate-locales.sh)) was deprecated due to "Camoufox" leaking to the page [#90](https://github.com/daijro/camoufox/issues/90).
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

legacy/scripts/generate-locales.sh

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/usr/bin/bash
2+
3+
if [ ! -f browser/locales/shipped-locales ]; then
4+
echo "ERROR: Run this script from the root of the Camoufox source code"
5+
exit 1
6+
fi
7+
8+
rm -rf browser/locales/l10n
9+
mkdir browser/locales/l10n
10+
11+
N=8
12+
for i in $(seq $N); do echo; done
13+
total=$(wc -l < browser/locales/shipped-locales)
14+
15+
echo_status() {
16+
printf "\033[$((($N - $n) + 1))A$@ %40s\r\033[$((($N - $n) + 1))B"
17+
}
18+
19+
generate_locale() {
20+
if echo " en-US ca ja " | grep -q " $1 "; then
21+
echo_status "Skipping locale \"$1\""
22+
sleep 1
23+
echo_status
24+
return
25+
fi
26+
echo_status "Downloading locale \"$1\""
27+
wget -q -O browser/locales/l10n/$1.zip https://hg.mozilla.org/l10n-central/$1/archive/tip.zip
28+
echo_status "Extracting locale \"$1\""
29+
7z x -y -obrowser/locales/l10n browser/locales/l10n/$1.zip > /dev/null
30+
mv browser/locales/l10n/$1-*/ browser/locales/l10n/$1/
31+
rm -f browser/locales/l10n/$1.zip
32+
echo_status "Generating locale \"$1\""
33+
mv browser/locales/l10n/$1/browser/branding/official browser/locales/l10n/$1/browser/branding/camoufox
34+
find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Mozilla Firefox/Camoufox/g' {} \;
35+
find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Mozilla/Camoufox/g' {} \;
36+
find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Firefox/Camoufox/g' {} \;
37+
echo_status "Done"
38+
sleep 0.3
39+
echo_status
40+
}
41+
42+
while read in; do
43+
((n=n%N)); ((n++==0)) && wait
44+
generate_locale $in &
45+
done < browser/locales/shipped-locales
46+
47+
wait
48+
49+
printf "\033[$(($N))A\rGenerated $total locales %-40s\n"

scripts/package.py

+1-12
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,6 @@ def add_includes_to_package(package_file, includes, fonts, new_file, target):
8484
for file in list_files(root_dir=os.path.join('bundle', 'fonts', font), suffix='*'):
8585
shutil.copy2(file, os.path.join(fonts_dir, os.path.basename(file)))
8686

87-
# Add launcher from launcher/dist/launch to temp_dir
88-
launch_file = 'launch' + ('.exe' if target == 'windows' else '')
89-
shutil.copy2(
90-
os.path.join('launcher', 'dist', launch_file),
91-
os.path.join(temp_dir, launch_file),
92-
)
93-
9487
# Remove unneeded paths
9588
for path in UNNEEDED_PATHS:
9689
if os.path.isdir(os.path.join(target_dir, path)):
@@ -116,7 +109,6 @@ def get_args():
116109
parser.add_argument(
117110
'--arch', choices=['x86_64', 'i686', 'arm64'], help='Architecture for Windows build'
118111
)
119-
parser.add_argument('--no-locales', action='store_true', help='Do not package locales')
120112
parser.add_argument('--fonts', nargs='+', help='Font directories to include under fonts/')
121113
return parser.parse_args()
122114

@@ -134,10 +126,7 @@ def main():
134126
moz_target = get_moz_target(target=args.os, arch=args.arch)
135127
with temp_cd(src_dir):
136128
# Create package files
137-
if args.no_locales:
138-
run('./mach package')
139-
else:
140-
run('cat browser/locales/shipped-locales | xargs ./mach package-multi-locale --locales')
129+
run('./mach package')
141130
# Find package files
142131
search_path = os.path.abspath(
143132
f'obj-{moz_target}/dist/camoufox-{args.version}-{args.release}.*.{file_ext}'

scripts/run-pw.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def main():
5858
src_dir = find_src_dir('.', args.version, args.release)
5959
moz_target = get_moz_target(target='linux', arch='x86_64')
6060

61-
launcher_path = os.path.abspath(os.path.join('.', 'launcher', 'dist', 'launch'))
61+
launcher_path = os.path.abspath(os.path.join('.', 'legacy', 'launcher', 'dist', 'launch'))
6262

6363
with temp_cd(src_dir):
6464
print(f'Looking for file: obj-{moz_target}/dist/bin/camoufox-bin')

0 commit comments

Comments
 (0)