Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build
Commits:
-
6257416f
by Pier Angelo Vendrame at 2025-03-25T18:07:01+01:00
10 changed files:
- + projects/common/browser-localization
- projects/firefox/rename-branding-strings.py → projects/common/rename-branding-strings.py
- projects/firefox/build
- projects/firefox/config
- projects/geckoview/build
- projects/geckoview/build_ac_fenix
- projects/geckoview/build_apk
- projects/geckoview/build_common
- projects/geckoview/config
- rbm.conf
Changes:
1 | +branding_dir=[% IF c('var/android') %]mobile/android[% ELSE %]browser[% END %]/branding/[% c("var/project_initials") %]-[% c("var/channel") %]
|
|
2 | + |
|
3 | +[% IF c("var/has_l10n") -%]
|
|
4 | + [% IF !c("var/android") -%]
|
|
5 | + supported_locales="[% tmpl(c('var/locales').join(' ')) %]"
|
|
6 | + [% ELSE -%]
|
|
7 | + supported_locales="[% tmpl(c('var/locales_mobile').join(' ')).replace('-r', '-').replace('in', 'id').replace('iw', 'he') %]"
|
|
8 | + [% END %]
|
|
9 | + |
|
10 | + l10ncentral="$HOME/.mozbuild/l10n-central"
|
|
11 | + mkdir "$l10ncentral"
|
|
12 | + [% IF c('input_files_by_name/firefox-l10n') -%]
|
|
13 | + for tarball in $rootdir/[% c('input_files_by_name/firefox-l10n') %]/*; do
|
|
14 | + tar -C "$l10ncentral" -xf "$tarball"
|
|
15 | + done
|
|
16 | + [% END -%]
|
|
17 | + |
|
18 | + [% IF c('input_files_by_name/translation-base-browser') -%]
|
|
19 | + tar -C "$rootdir" -xf "$rootdir/[% c('input_files_by_name/translation-base-browser') %]"
|
|
20 | + pushd "$rootdir/translation-base-browser"
|
|
21 | + ln -s ja ja-JP-mac
|
|
22 | + for lang in $supported_locales; do
|
|
23 | + mv $lang/base-browser.ftl "$l10ncentral/$lang/toolkit/toolkit/global/"
|
|
24 | + done
|
|
25 | + popd
|
|
26 | + [% END -%]
|
|
27 | + |
|
28 | + [% IF c('input_files_by_name/translation-tor-browser') -%]
|
|
29 | + tar -C "$rootdir" -xf "$rootdir/[% c('input_files_by_name/translation-tor-browser') %]"
|
|
30 | + |
|
31 | + [%#
|
|
32 | + # For the purpose of Weblate, all releases share a single brand.ftl and
|
|
33 | + # brand.properties file per locale in the translations repository.
|
|
34 | + # See tor-browser-build#41372.
|
|
35 | + # In brand.ftl, both `-brand-short-name` and `-brand-full-name` should
|
|
36 | + # differ between releases. As such, they have additional entries in the
|
|
37 | + # translations repository file (Weblate):
|
|
38 | + # -brand-short-name for the stable release.
|
|
39 | + # -brand-short-name_alpha for the alpha release.
|
|
40 | + # -brand-short-name_nightly for the nightly release.
|
|
41 | + # And similarly for -brand-full-name.
|
|
42 | + # For the final build, we only want to keep the string that matches the
|
|
43 | + # built release, and remove its suffix if it has one. So for the stable
|
|
44 | + # release we want to keep -brand-short-name. For the alpha release we want
|
|
45 | + # to keep -brand-short-name_alpha instead, and rename it to be
|
|
46 | + # -brand-short-name.
|
|
47 | + #
|
|
48 | + # As such, we parse the brand.ftl file to rename these strings to keep the
|
|
49 | + # version we want using rename-branding-strings.py.
|
|
50 | + #
|
|
51 | + # We do a similar thing with brandShortName and brandFullName in
|
|
52 | + # brand.properties.
|
|
53 | + -%]
|
|
54 | + |
|
55 | + # For the stable release, the suffix is empty.
|
|
56 | + # I.e. we want to select `-brand-short-name` directly.
|
|
57 | + [% IF !c("var/release"); branding_string_suffix = '_' _ c('var/channel'); END -%]
|
|
58 | + |
|
59 | + # Instructions for the script to perform the renames.
|
|
60 | + brand_ftl_renames='{
|
|
61 | + "suffix": "[% branding_string_suffix %]",
|
|
62 | + "ids": ["-brand-short-name", "-brand-full-name"]
|
|
63 | + }'
|
|
64 | + brand_properties_renames='{
|
|
65 | + "suffix": "[% branding_string_suffix %]",
|
|
66 | + "ids": ["brandShortName", "brandFullName"]
|
|
67 | + }'
|
|
68 | + |
|
69 | + pushd "$rootdir/translation-tor-browser"
|
|
70 | + ln -s ja ja-JP-mac
|
|
71 | + for lang in $supported_locales; do
|
|
72 | + mv $lang/tor-browser.ftl "$l10ncentral/$lang/toolkit/toolkit/global/"
|
|
73 | + # Branding.
|
|
74 | + l10n_branding_dir="$l10ncentral/$lang/$branding_dir/"
|
|
75 | + mkdir -p "$l10n_branding_dir"
|
|
76 | + # Convert the translations repository branding files into files that work
|
|
77 | + # for this specific build.
|
|
78 | + python3 $rootdir/rename-branding-strings.py $lang/branding/brand.ftl "$brand_ftl_renames" > "$l10n_branding_dir/brand.ftl"
|
|
79 | + python3 $rootdir/rename-branding-strings.py $lang/brand.properties "$brand_properties_renames" > "$l10n_branding_dir/brand.properties"
|
|
80 | + done
|
|
81 | + popd
|
|
82 | + |
|
83 | + [% IF !c('var/android') -%]
|
|
84 | + # torbutton properties files.
|
|
85 | + # TODO: Remove once we no longer have torbutton locale files.
|
|
86 | + torbutton_locales="toolkit/torbutton/chrome/locale/"
|
|
87 | + torbutton_jar="toolkit/torbutton/jar.mn"
|
|
88 | + for lang in $supported_locales; do
|
|
89 | + mkdir -p "$torbutton_locales/$lang"
|
|
90 | + mv "$rootdir/translation-tor-browser/$lang"/*.properties "$torbutton_locales/$lang/"
|
|
91 | + echo "% locale torbutton $lang %locale/$lang/" >> "$torbutton_jar"
|
|
92 | + echo " locale/$lang (chrome/locale/$lang/*)" >> "$torbutton_jar"
|
|
93 | + done
|
|
94 | + [% END -%]
|
|
95 | + [% ELSIF c('input_files_by_name/translation-mullvad-browser') -%]
|
|
96 | + tar -C "$rootdir" -xf "$rootdir/[% c('input_files_by_name/translation-mullvad-browser') %]"
|
|
97 | + pushd "$rootdir/translation-mullvad-browser"
|
|
98 | + ln -s ja ja-JP-mac
|
|
99 | + for lang in $supported_locales; do
|
|
100 | + cp -Lr $lang "$l10ncentral/"
|
|
101 | + done
|
|
102 | + popd
|
|
103 | + [% END -%]
|
|
104 | +[% ELSE -%]
|
|
105 | + supported_locales=""
|
|
106 | +[% END -%] |
... | ... | @@ -114,97 +114,7 @@ export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system |
114 | 114 | # Create .mozbuild to avoid interactive prompt in configure
|
115 | 115 | mkdir "$HOME/.mozbuild"
|
116 | 116 | |
117 | -branding_dir=browser/branding/[% c("var/branding_directory_prefix") %]-[% c("var/channel") %]
|
|
118 | - |
|
119 | -[% IF c("var/has_l10n") -%]
|
|
120 | - supported_locales="[% tmpl(c('var/locales').join(' ')) %]"
|
|
121 | - |
|
122 | - l10ncentral="$HOME/.mozbuild/l10n-central"
|
|
123 | - mkdir "$l10ncentral"
|
|
124 | - for tarball in $rootdir/[% c('input_files_by_name/firefox-l10n') %]/*; do
|
|
125 | - tar -C "$l10ncentral" -xf "$tarball"
|
|
126 | - done
|
|
127 | - |
|
128 | - tar -C "$rootdir" -xf "$rootdir/[% c('input_files_by_name/translation-base-browser') %]"
|
|
129 | - pushd "$rootdir/translation-base-browser"
|
|
130 | - ln -s ja ja-JP-mac
|
|
131 | - for lang in $supported_locales; do
|
|
132 | - # Fluent
|
|
133 | - mv $lang/base-browser.ftl "$l10ncentral/$lang/toolkit/toolkit/global/"
|
|
134 | - done
|
|
135 | - popd
|
|
136 | - |
|
137 | - [% IF c("var/tor-browser") -%]
|
|
138 | - tar -C "$rootdir" -xf "$rootdir/[% c('input_files_by_name/translation-tor-browser') %]"
|
|
139 | - |
|
140 | - # For the purpose of Weblate, all releases share a single brand.ftl and
|
|
141 | - # brand.properties file per locale in the translations repository.
|
|
142 | - # See tor-browser-build#41372.
|
|
143 | - # In brand.ftl, both `-brand-short-name` and `-brand-full-name` should
|
|
144 | - # differ between releases. As such, they have additional entries in the
|
|
145 | - # translations repository file (Weblate):
|
|
146 | - # -brand-short-name for the stable release.
|
|
147 | - # -brand-short-name_alpha for the alpha release.
|
|
148 | - # -brand-short-name_nightly for the nightly release.
|
|
149 | - # And similarly for -brand-full-name.
|
|
150 | - # For the final build, we only want to keep the string that matches the
|
|
151 | - # built release, and remove its suffix if it has one. So for the stable
|
|
152 | - # release we want to keep -brand-short-name. For the alpha release we want
|
|
153 | - # to keep -brand-short-name_alpha instead, and rename it to be
|
|
154 | - # -brand-short-name.
|
|
155 | - #
|
|
156 | - # As such, we parse the brand.ftl file to rename these strings to keep the
|
|
157 | - # version we want using rename-branding-strings.py.
|
|
158 | - #
|
|
159 | - # We do a similar thing with brandShortName and brandFullName in
|
|
160 | - # brand.properties.
|
|
161 | - |
|
162 | - # Instructions for the script to perform the renames.
|
|
163 | - brand_ftl_renames='{
|
|
164 | - "suffix": "[% c("var/branding_string_suffix") %]",
|
|
165 | - "ids": ["-brand-short-name", "-brand-full-name"]
|
|
166 | - }'
|
|
167 | - brand_properties_renames='{
|
|
168 | - "suffix": "[% c("var/branding_string_suffix") %]",
|
|
169 | - "ids": ["brandShortName", "brandFullName"]
|
|
170 | - }'
|
|
171 | - |
|
172 | - pushd "$rootdir/translation-tor-browser"
|
|
173 | - ln -s ja ja-JP-mac
|
|
174 | - for lang in $supported_locales; do
|
|
175 | - mv $lang/tor-browser.ftl "$l10ncentral/$lang/toolkit/toolkit/global/"
|
|
176 | - # Branding.
|
|
177 | - l10n_branding_dir="$l10ncentral/$lang/$branding_dir/"
|
|
178 | - mkdir -p "$l10n_branding_dir"
|
|
179 | - # Convert the translations repository branding files into files that work
|
|
180 | - # for this specific build.
|
|
181 | - python3 $rootdir/rename-branding-strings.py $lang/branding/brand.ftl "$brand_ftl_renames" > "$l10n_branding_dir/brand.ftl"
|
|
182 | - python3 $rootdir/rename-branding-strings.py $lang/brand.properties "$brand_properties_renames" > "$l10n_branding_dir/brand.properties"
|
|
183 | - done
|
|
184 | - popd
|
|
185 | - |
|
186 | - # torbutton properties files.
|
|
187 | - # TODO: Remove once we no longer have torbutton locale files.
|
|
188 | - torbutton_locales="toolkit/torbutton/chrome/locale/"
|
|
189 | - torbutton_jar="toolkit/torbutton/jar.mn"
|
|
190 | - for lang in $supported_locales; do
|
|
191 | - mkdir -p "$torbutton_locales/$lang"
|
|
192 | - mv "$rootdir/translation-tor-browser/$lang"/*.properties "$torbutton_locales/$lang/"
|
|
193 | - echo "% locale torbutton $lang %locale/$lang/" >> "$torbutton_jar"
|
|
194 | - echo " locale/$lang (chrome/locale/$lang/*)" >> "$torbutton_jar"
|
|
195 | - done
|
|
196 | - [% ELSIF c("var/mullvad-browser") -%]
|
|
197 | - tar -C "$rootdir" -xf "$rootdir/[% c('input_files_by_name/translation-mullvad-browser') %]"
|
|
198 | - pushd "$rootdir/translation-mullvad-browser"
|
|
199 | - ln -s ja ja-JP-mac
|
|
200 | - for lang in $supported_locales; do
|
|
201 | - cp -Lr $lang "$l10ncentral/"
|
|
202 | - done
|
|
203 | - popd
|
|
204 | - [% END -%]
|
|
205 | -[% ELSE -%]
|
|
206 | - supported_locales=""
|
|
207 | -[% END -%]
|
|
117 | +[% INCLUDE 'browser-localization' %]
|
|
208 | 118 | |
209 | 119 | # PyYAML tries to read files as ASCII, otherwise
|
210 | 120 | export LC_ALL=C.UTF-8
|
... | ... | @@ -21,7 +21,6 @@ var: |
21 | 21 | browser_rebase: 1
|
22 | 22 | browser_branch: '[% c("var/browser_series") %]-[% c("var/browser_rebase") %]'
|
23 | 23 | browser_build: 3
|
24 | - branding_directory_prefix: 'tb'
|
|
25 | 24 | copyright_year: '[% exec("git show -s --format=%ci " _ c("git_hash") _ "^{commit}", { exec_noco => 1 }).remove("-.*") %]'
|
26 | 25 | nightly_updates_publish_dir: '[% c("var/nightly_updates_publish_dir_prefix") %]nightly-[% c("var/osname") %]'
|
27 | 26 | gitlab_project: https://gitlab.torproject.org/tpo/applications/tor-browser
|
... | ... | @@ -55,10 +54,6 @@ var: |
55 | 54 | rm -Rf "$rezip_tmpdir"
|
56 | 55 | |
57 | 56 | l10n-changesets: '[% exec("git --no-pager show " _ c("git_hash") _ ":browser/locales/l10n-changesets.json", { exec_noco => 1 }) %]'
|
58 | - # The branding_string_suffix for the alpha and nightly should be
|
|
59 | - # '_alpha' and '_nightly', matching the "suffix" chosen in the
|
|
60 | - # tor-browser:update-translations.yml file.
|
|
61 | - branding_string_suffix: '_[% c("var/channel") %]'
|
|
62 | 57 | |
63 | 58 | steps:
|
64 | 59 | src-tarballs:
|
... | ... | @@ -99,12 +94,6 @@ targets: |
99 | 94 | var:
|
100 | 95 | nightly_updates_publish_dir_prefix: basebrowser-
|
101 | 96 | |
102 | - release:
|
|
103 | - var:
|
|
104 | - # For the stable release, the suffix is empty.
|
|
105 | - # I.e. we want to select `-brand-short-name` directly.
|
|
106 | - branding_string_suffix: ''
|
|
107 | - |
|
108 | 97 | nightly:
|
109 | 98 | git_hash: '[% c("var/project-name") %]-[% c("var/firefox_version") %]-[% c("var/browser_branch") %]'
|
110 | 99 | tag_gpg_id: 0
|
... | ... | @@ -114,7 +103,6 @@ targets: |
114 | 103 | mullvadbrowser:
|
115 | 104 | git_url: https://gitlab.torproject.org/tpo/applications/mullvad-browser.git
|
116 | 105 | var:
|
117 | - branding_directory_prefix: 'mb'
|
|
118 | 106 | gitlab_project: https://gitlab.torproject.org/tpo/applications/mullvad-browser
|
119 | 107 | updater_url: 'https://cdn.mullvad.net/browser/update_responses/update_1/'
|
120 | 108 | nightly_updates_publish_dir_prefix: mullvadbrowser-
|
... | ... | @@ -33,6 +33,7 @@ export MOZ_SOURCE_CHANGESET=[% c("var/git_commit") %] |
33 | 33 | |
34 | 34 | ac_add_options --enable-update-channel=[% c("var/variant") %]
|
35 | 35 | MOZCONFIG_EOF
|
36 | +echo "ac_add_options --with-branding=$branding_dir" >> .mozconfig
|
|
36 | 37 | |
37 | 38 | echo "Starting ./mach configure $(date)"
|
38 | 39 | ./mach configure \
|
1 | 1 | [% IF c('var/has_l10n') -%]
|
2 | 2 | echo "Injecting the Firefox's localization to GV $(date)"
|
3 | - supported_locales="[% tmpl(c('var/locales_mobile').join(' ')).replace('-r', '-').replace('in', 'id').replace('iw', 'he') %]"
|
|
4 | - l10ncentral="$HOME/.mozbuild/l10n-central"
|
|
5 | - mkdir "$l10ncentral"
|
|
6 | - for tarball in $rootdir/[% c('input_files_by_name/firefox-l10n') %]/*; do
|
|
7 | - tar -C "$l10ncentral" -xf "$tarball"
|
|
8 | - done
|
|
9 | - |
|
10 | - # Do not setup our localization files, as we do not provide any frontend
|
|
11 | - # through GeckoView.
|
|
12 | - |
|
13 | 3 | # No quotes on purpose, to pass each locale as an additional argument.
|
14 | 4 | ./mach package-multi-locale --locales en-US $supported_locales
|
15 | 5 | [% END -%]
|
... | ... | @@ -24,7 +24,10 @@ mk_add_options MOZ_PARALLEL_BUILD=[% c("num_procs") %] |
24 | 24 | export MOZ_INCLUDE_SOURCE_INFO=1
|
25 | 25 | export MOZ_SOURCE_REPO="[% c('var/gitlab_project') %]"
|
26 | 26 | export MOZ_SOURCE_CHANGESET=[% c("var/git_commit") %]
|
27 | + |
|
28 | +ac_add_options --enable-update-channel=[% c("var/variant") %]
|
|
27 | 29 | MOZCONFIG_EOF
|
30 | +echo "ac_add_options --with-branding=$branding_dir" >> mozconfig-android-all
|
|
28 | 31 | |
29 | 32 | # We still need to specify --tor-browser-version due to bug 34005.
|
30 | 33 | ./mach configure \
|
... | ... | @@ -47,3 +47,5 @@ cp -rl oss-licenses-plugin/. $gradle_repo |
47 | 47 | export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=system
|
48 | 48 | # Create .mozbuild to avoid interactive prompt in configure
|
49 | 49 | mkdir "$HOME/.mozbuild"
|
50 | + |
|
51 | +[% INCLUDE 'browser-localization' %] |
... | ... | @@ -106,6 +106,11 @@ steps: |
106 | 106 | project: translation
|
107 | 107 | pkg_type: fenix
|
108 | 108 | enable: '[% c("var/has_l10n") %]'
|
109 | + - name: translation-tor-browser
|
|
110 | + project: translation
|
|
111 | + pkg_type: tor-browser
|
|
112 | + enable: '[% c("var/has_l10n") %]'
|
|
113 | + - filename: rename-branding-strings.py
|
|
109 | 114 | - URL: '[% pc("glean", "var/glean_wheels_url/" _ c("var/glean_parser"), { error_if_undef => 1 }) %]'
|
110 | 115 | name: glean-wheels
|
111 | 116 | sha256sum: '[% pc("glean", "var/glean_wheels_sha256sum/" _ c("var/glean_parser"), { error_if_undef => 1 }) %]'
|
... | ... | @@ -164,3 +169,8 @@ input_files: |
164 | 169 | project: translation
|
165 | 170 | pkg_type: fenix
|
166 | 171 | enable: '[% c("var/android_single_arch") && c("var/has_l10n") %]'
|
172 | + - name: translation-tor-browser
|
|
173 | + project: translation
|
|
174 | + pkg_type: tor-browser
|
|
175 | + enable: '[% c("var/android_single_arch") && c("var/has_l10n") %]'
|
|
176 | + - filename: rename-branding-strings.py |
... | ... | @@ -299,6 +299,7 @@ targets: |
299 | 299 | projectname: torbrowser
|
300 | 300 | Project_Name: 'Tor Browser'
|
301 | 301 | ProjectName: TorBrowser
|
302 | + project_initials: tb
|
|
302 | 303 | |
303 | 304 | basebrowser:
|
304 | 305 | var:
|
... | ... | @@ -316,6 +317,7 @@ targets: |
316 | 317 | projectname: mullvadbrowser
|
317 | 318 | Project_Name: 'Mullvad Browser'
|
318 | 319 | ProjectName: MullvadBrowser
|
320 | + project_initials: mb
|
|
319 | 321 | exe_name: mullvadbrowser
|
320 | 322 | mar_channel_id: '[% c("var/projectname") %]-mullvad-[% c("var/channel") %]'
|
321 | 323 | locales:
|