Deprecate old launcher & locales

This commit is contained in:
daijro 2024-11-21 18:38:29 -06:00
parent c5cad3040c
commit 4f15447e04
16 changed files with 59 additions and 18 deletions

View file

@ -124,10 +124,9 @@ check-arch:
fi
build-launcher: check-arch
cd launcher && bash build.sh $(arch) $(os)
cd legacy/launcher && bash build.sh $(arch) $(os)
package-linux:
make build-launcher arch=$(arch) os=linux;
python3 scripts/package.py linux \
--includes \
settings/chrome.css \
@ -139,7 +138,6 @@ package-linux:
--fonts windows macos linux
package-macos:
make build-launcher arch=$(arch) os=macos;
python3 scripts/package.py macos \
--includes \
settings/chrome.css \
@ -150,7 +148,6 @@ package-macos:
--fonts windows linux
package-windows:
make build-launcher arch=$(arch) os=windows;
python3 scripts/package.py windows \
--includes \
settings/chrome.css \
@ -164,7 +161,7 @@ package-windows:
run-launcher:
rm -rf $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch;
make build-launcher arch=x86_64 os=linux;
cp launcher/dist/launch $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch;
cp legacy/launcher/dist/launch $(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch;
$(cf_source_dir)/obj-x86_64-pc-linux-gnu/dist/bin/launch
run-pw:

6
legacy/README.md Normal file
View file

@ -0,0 +1,6 @@
## Deprecated Assets
##### 2024-11-21
- 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).
- `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).

View file

@ -0,0 +1,49 @@
#!/usr/bin/bash
if [ ! -f browser/locales/shipped-locales ]; then
echo "ERROR: Run this script from the root of the Camoufox source code"
exit 1
fi
rm -rf browser/locales/l10n
mkdir browser/locales/l10n
N=8
for i in $(seq $N); do echo; done
total=$(wc -l < browser/locales/shipped-locales)
echo_status() {
printf "\033[$((($N - $n) + 1))A$@ %40s\r\033[$((($N - $n) + 1))B"
}
generate_locale() {
if echo " en-US ca ja " | grep -q " $1 "; then
echo_status "Skipping locale \"$1\""
sleep 1
echo_status
return
fi
echo_status "Downloading locale \"$1\""
wget -q -O browser/locales/l10n/$1.zip https://hg.mozilla.org/l10n-central/$1/archive/tip.zip
echo_status "Extracting locale \"$1\""
7z x -y -obrowser/locales/l10n browser/locales/l10n/$1.zip > /dev/null
mv browser/locales/l10n/$1-*/ browser/locales/l10n/$1/
rm -f browser/locales/l10n/$1.zip
echo_status "Generating locale \"$1\""
mv browser/locales/l10n/$1/browser/branding/official browser/locales/l10n/$1/browser/branding/camoufox
find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Mozilla Firefox/Camoufox/g' {} \;
find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Mozilla/Camoufox/g' {} \;
find browser/locales/l10n/$1 -type f -exec sed -i -e 's/Firefox/Camoufox/g' {} \;
echo_status "Done"
sleep 0.3
echo_status
}
while read in; do
((n=n%N)); ((n++==0)) && wait
generate_locale $in &
done < browser/locales/shipped-locales
wait
printf "\033[$(($N))A\rGenerated $total locales %-40s\n"

View file

@ -84,13 +84,6 @@ def add_includes_to_package(package_file, includes, fonts, new_file, target):
for file in list_files(root_dir=os.path.join('bundle', 'fonts', font), suffix='*'):
shutil.copy2(file, os.path.join(fonts_dir, os.path.basename(file)))
# Add launcher from launcher/dist/launch to temp_dir
launch_file = 'launch' + ('.exe' if target == 'windows' else '')
shutil.copy2(
os.path.join('launcher', 'dist', launch_file),
os.path.join(temp_dir, launch_file),
)
# Remove unneeded paths
for path in UNNEEDED_PATHS:
if os.path.isdir(os.path.join(target_dir, path)):
@ -116,7 +109,6 @@ def get_args():
parser.add_argument(
'--arch', choices=['x86_64', 'i686', 'arm64'], help='Architecture for Windows build'
)
parser.add_argument('--no-locales', action='store_true', help='Do not package locales')
parser.add_argument('--fonts', nargs='+', help='Font directories to include under fonts/')
return parser.parse_args()
@ -134,10 +126,7 @@ def main():
moz_target = get_moz_target(target=args.os, arch=args.arch)
with temp_cd(src_dir):
# Create package files
if args.no_locales:
run('./mach package')
else:
run('cat browser/locales/shipped-locales | xargs ./mach package-multi-locale --locales')
run('./mach package')
# Find package files
search_path = os.path.abspath(
f'obj-{moz_target}/dist/camoufox-{args.version}-{args.release}.*.{file_ext}'

View file

@ -58,7 +58,7 @@ def main():
src_dir = find_src_dir('.', args.version, args.release)
moz_target = get_moz_target(target='linux', arch='x86_64')
launcher_path = os.path.abspath(os.path.join('.', 'launcher', 'dist', 'launch'))
launcher_path = os.path.abspath(os.path.join('.', 'legacy', 'launcher', 'dist', 'launch'))
with temp_cd(src_dir):
print(f'Looking for file: obj-{moz_target}/dist/bin/camoufox-bin')