Skip to content

Commit 8d0452d

Browse files
committed
tor-browser: fix mozconfig and install components
1 parent 1042597 commit 8d0452d

File tree

2 files changed

+52
-5
lines changed

2 files changed

+52
-5
lines changed

tur/tor-browser/build.sh

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,53 @@ TERMUX_PKG_HOMEPAGE=https://www.torproject.org/
22
TERMUX_PKG_DESCRIPTION="Tor Browser Bundle: anonymous browsing using Firefox and Tor"
33
TERMUX_PKG_LICENSE="MPL-2.0"
44
TERMUX_PKG_MAINTAINER="@termux"
5-
TERMUX_PKG_VERSION="128.2.0esr-14.0-1-build3"
5+
TERMUX_PKG_GIT_BRANCH="tor-browser-128.2.0esr-14.0-1-build5"
6+
TERMUX_PKG_VERSION="14.0a5"
67
TERMUX_PKG_SRCURL=git+https://gitlab.torproject.org/tpo/applications/tor-browser
78
# ffmpeg and pulseaudio are dependencies through dlopen(3):
89
TERMUX_PKG_DEPENDS="ffmpeg, fontconfig, freetype, gdk-pixbuf, glib, gtk3, libandroid-shmem, libandroid-spawn, libc++, libcairo, libevent, libffi, libice, libicu, libjpeg-turbo, libnspr, libnss, libpixman, libsm, libvpx, libwebp, libx11, libxcb, libxcomposite, libxdamage, libxext, libxfixes, libxrandr, libxtst, pango, pulseaudio, tor, zlib"
910
TERMUX_PKG_BUILD_DEPENDS="libcpufeatures, libice, libsm"
1011
TERMUX_PKG_BUILD_IN_SRC=true
11-
TERMUX_PKG_AUTO_UPDATE=true
12-
TERMUX_PKG_GIT_BRANCH="tor-browser-$TERMUX_PKG_VERSION"
13-
TERMUX_PKG_UPDATE_TAG_TYPE="newest-tag"
12+
# TERMUX_PKG_AUTO_UPDATE=true
13+
# TODO: termux_pkg_auto_update() to detect the appropriate TERMUX_PKG_GIT_BRANCH
14+
# perhaps can be done by searching the directory of https://dist.torproject.org/torbrowser/$TERMUX_PKG_VERSION/
15+
16+
17+
# tor-browser needed components beside the firefox browser itself
18+
# for more details, see the relationship between tor-browser and tor-browser-build
19+
# https://gitlab.torproject.org/tpo/applications/team/-/wikis/Development-Information/Tor-Browser/Tor-Browser-Repository-Overview
20+
# also https://gitlab.torproject.org/tpo/applications/tor-browser-build
21+
# Here, we skip the hassle and extract directly from a release file.
22+
termux_step_handle_host_build() {
23+
# app logo
24+
mkdir -p "$TERMUX_PREFIX/share/pixmaps"
25+
cp "browser/branding/tb-release/content/about-logo.svg" "$TERMUX_PREFIX/share/pixmaps/tor-browser.svg"
26+
# component files
27+
local install_dir="$TERMUX_PREFIX/lib/tor-browser"
28+
mkdir -p "$install_dir"
29+
wget https://dist.torproject.org/torbrowser/${TERMUX_PKG_VERSION}/tor-browser-linux-x86_64-${TERMUX_PKG_VERSION}.tar.xz -O ./tor-browser-bin.tar.xz
30+
if [[ "$(tar -tf ./tor-browser-bin.tar.xz | grep -E '^([^/]+/){2}[^/]+/$' | wc -l)" -ne 8 ]]; then
31+
termux_error_exit "The number of folders in tor-browser has changed and please recheck the official release file.
32+
If still in doubt, check the official tor-browser-build repo.
33+
In particular, https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/tree/main/projects/browser."
34+
fi
35+
for folder in .config TorBrowser distribution fontconfig fonts icons; do
36+
tar -C "$install_dir/" -xvf ./tor-browser-bin.tar.xz tor-browser/Browser/${folder} --strip-components=2
37+
done
38+
rm ./tor-browser-bin.tar.xz
39+
# handle architecture-dependent binaries
40+
rm -rf "$install_dir/TorBrowser/Tor/"*
41+
ln -s "$TERMUX_PREFIX/bin/tor" "$install_dir/TorBrowser/Tor/tor"
42+
# TODO: TorBrowser/Tor/pluggable-transports, probably can be copied from
43+
# https://dist.torproject.org/torbrowser/${TERMUX_PKG_VERSION}/tor-expert-bundle-android-${TERMUX_ARCH}-${TERMUX_PKG_VERSION}.tar.xz
44+
# but not familiar how to test it, therefore not implemented.
45+
}
46+
47+
48+
##############################
49+
# Firefox build script below #
50+
# update when rebased #
51+
##############################
1452

1553
termux_step_post_get_source() {
1654
local f="media/ffvpx/config_unix_aarch64.h"

tur/tor-browser/mozconfig.cfg

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ac_add_options --with-sysroot=@TERMUX_PREFIX@
55
ac_add_options --custom-rust-target-triple=@CARGO_TARGET_NAME@
66

77
# Branding
8-
ac_add_options --with-branding=browser/branding/official
8+
ac_add_options --with-branding=browser/branding/tb-release
99

1010
# System libraries
1111
ac_add_options --enable-system-ffi
@@ -43,3 +43,12 @@ ac_add_options --without-wasm-sandboxed-libraries
4343

4444
# System addons
4545
ac_add_options --allow-addon-sideload
46+
47+
# TOR
48+
ac_add_options --disable-strip
49+
ac_add_options --disable-install-strip
50+
51+
ac_add_options --with-base-browser-version=dev-build
52+
ac_add_options --disable-base-browser-update
53+
54+
ac_add_options --with-app-name=tor-browser

0 commit comments

Comments
 (0)