public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/mozilla:master commit in: www-client/torbrowser/files/, www-client/torbrowser/
@ 2018-06-18  4:41 Jory Pratt
  0 siblings, 0 replies; 2+ messages in thread
From: Jory Pratt @ 2018-06-18  4:41 UTC (permalink / raw
  To: gentoo-commits

commit:     72d280940ea4e830901e4269996d21b4b7587d44
Author:     Jory A. Pratt <anarchy <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 18 04:40:39 2018 +0000
Commit:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Mon Jun 18 04:40:39 2018 +0000
URL:        https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=72d28094

www-client/torbrowser: Initial ebuild for torbrowser

 www-client/torbrowser/Manifest                     |   3 +
 www-client/torbrowser/files/99torbrowser.example   |  26 ++
 www-client/torbrowser/files/README.tor-launcher    |  33 +++
 www-client/torbrowser/files/Readme.md              |  20 ++
 www-client/torbrowser/files/profile.cfg            |  42 +++
 www-client/torbrowser/metadata.xml                 |  28 ++
 .../torbrowser/torbrowser-52.8.1_p755.ebuild       | 311 +++++++++++++++++++++
 7 files changed, 463 insertions(+)

diff --git a/www-client/torbrowser/Manifest b/www-client/torbrowser/Manifest
new file mode 100644
index 0000000..d254b1b
--- /dev/null
+++ b/www-client/torbrowser/Manifest
@@ -0,0 +1,3 @@
+DIST tor-browser-linux32-7.5.5_en-US.tar.xz 70860112 BLAKE2B 292322f99f2b26b12b9b9bc63057943ff5e6bd8f279b0a505dff8f11caf95aceab65fdc697a2a6c962344033c063f7131273741fba5d9d37750284909cbe6b6d SHA512 439e857d28b8344cda17ed8e10469bad7609682dc286ee985855173bb25c6cf1b4ccb3cdbe748c5d326071171bf6bcacd0dafe893ea2469c261887af44877b42
+DIST tor-browser-linux64-7.5.5_en-US.tar.xz 69037144 BLAKE2B d2c45b85308d082cbcc8f02ba263e1c7e6b83a2278579f72b45b64c0684a6dd4c9f23d657190cc701142b246f8d499ad16f2c33b2738fa5d106004844434d624 SHA512 68f6dae920aa73911f4956ac51ecf587dd1c673a82b6a33c09b0d891d1aefe781c37d668d49f888250d440e9538aa06568d0dc31cdeedd50924c881fb8a6c266
+DIST torbrowser-52.8-patches-01.tar.xz 17756 BLAKE2B 3bc3424bbc47feb4f6e7b09e6c72073a4ef18e3a7cd611555d3c80a7deb166ee1317062305eee4f75d17f3f505edaf639a3bd3ef74443d0a8c73304a780fe151 SHA512 edcf1e4fac5f78788ae3c9b81ae7f746fa04b9c76789e772006ead60a65e19c0bda9582f67f0a1f4fb9cfefc98e20d98d0d29194b0e18bc4c1b1eea578d19b60

diff --git a/www-client/torbrowser/files/99torbrowser.example b/www-client/torbrowser/files/99torbrowser.example
new file mode 100644
index 0000000..4fb07fa
--- /dev/null
+++ b/www-client/torbrowser/files/99torbrowser.example
@@ -0,0 +1,26 @@
+# /etc/env.d/99torbrowser
+#
+# The Tor ControlPort password should be given inside double quotes, inside
+# single quotes, i.e. if the ControlPort password is “secret” (without
+# curly quotes) then we must set the environment variable *exactly* like
+# this:
+# TOR_CONTROL_PASSWD='"secret"'
+# Yes, the variable MUST be double-quoted, then single-quoted, exactly as
+# shown. This is used by TorButton to authenticate to Tor's ControlPort, and
+# is necessary for using TB with a system-installed Tor
+
+TOR_CONTROL_PORT=9051
+TOR_CONTROL_HOST=127.0.0.1
+TOR_CONTROL_PASSWD='"secret"'
+#TOR_CONTROL_COOKIE_AUTH_FILE=/var/run/tor/control.authcookie
+
+# Environment variable to skip TorButton control port verification
+#TOR_SKIP_CONTROLPORTTEST=1
+
+# Environment variable to disable the "TorButton" -> "Open Network Settings..."
+# menu item.
+#TOR_NO_DISPLAY_NETWORK_SETTINGS=1
+
+# Environment variable to disable the "TorButton" -> "Check for Updates..."
+# menu item.
+#TOR_HIDE_UPDATE_CHECK_UI=1

diff --git a/www-client/torbrowser/files/README.tor-launcher b/www-client/torbrowser/files/README.tor-launcher
new file mode 100644
index 0000000..0683733
--- /dev/null
+++ b/www-client/torbrowser/files/README.tor-launcher
@@ -0,0 +1,33 @@
+Using a system-installed Tor process with Tor Browser:
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The Tor ControlPort password should be given inside double quotes, inside
+single quotes, i.e. if the ControlPort password is “secret” (without
+curly quotes) then we must set the environment variable *exactly* like
+this:
+
+TOR_CONTROL_PASSWD='"secret"'
+
+Yes, the variable MUST be double-quoted, then single-quoted, exactly as
+shown. This is used by TorButton and Tor Launcher to authenticate to Tor's
+ControlPort, and is necessary for using TB with a system-installed Tor.
+
+Additionally, if using a system-installed Tor, the following about:config
+options should be set (values in <> mean they are the value taken from your
+torrc):
+
+SETTING NAME                            VALUE
+network.security.ports.banned           [...],<SocksPort>,<ControlPort>
+network.proxy.socks                     127.0.0.1
+network.proxy.socks_port                <SocksPort>
+extensions.torbutton.inserted_button    true
+extensions.torbutton.launch_warning     false
+extensions.torbutton.loglevel           2
+extensions.torbutton.logmethod          0
+extensions.torlauncher.control_port      <ControlPort>
+extensions.torlauncher.loglevel          2
+extensions.torlauncher.logmethod         0
+extensions.torlauncher.prompt_at_startup false
+extensions.torlauncher.start_tor         false
+
+where the '[...]' in the banned_ports option means "leave anything that was
+already in the preference alone, just append the things specified after it".

diff --git a/www-client/torbrowser/files/Readme.md b/www-client/torbrowser/files/Readme.md
new file mode 100644
index 0000000..9227583
--- /dev/null
+++ b/www-client/torbrowser/files/Readme.md
@@ -0,0 +1,20 @@
+# Advanced torbutton functionality
+
+To get the advanced functionality of Torbutton (network information,
+new identity feature), `www-client/torbrowser` needs to access a control port.
+
+![Tor Onion Menu ](https://people.torproject.org/~mikeperry/images/OnionMenu.jpg)
+
+* If you use `www-client/torbrowser`, you need to **adjust and export** the environment variables from
+  [99torbrowser.example](https://github.com/MeisterP/torbrowser-overlay/blob/master/www-client/torbrowser/files/99torbrowser.example).
+  You can do this either with gentoo's `/etc/env.d`
+  [mechanism](https://wiki.gentoo.org/wiki/Handbook:X86/Working/EnvVar#Defining_variables_globally)
+  or on the command line.
+
+  _Tor Network Settings_ and _Check for Tor Browser Update_ functionality is not working with the `www-client/torbrowser`.
+
+* If you use `www-client/torbrowser-launcher`, make sure that the environment variables from
+  [99torbrowser.example](https://github.com/MeisterP/torbrowser-overlay/blob/master/www-client/torbrowser/files/99torbrowser.example)
+  are **unset** and that you **don't** have the system wide tor running on port `9150`.
+
+  With `www-client/torbrowser-launcher`, all menu entries are available and working.

diff --git a/www-client/torbrowser/files/profile.cfg b/www-client/torbrowser/files/profile.cfg
new file mode 100644
index 0000000..d14309a
--- /dev/null
+++ b/www-client/torbrowser/files/profile.cfg
@@ -0,0 +1,42 @@
+//
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/FileUtils.jsm");
+
+var profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
+var certDBFile = profileDir.clone();
+certDBFile.append("cert8.db")
+// If cert8.db isn't there, it's a new profile
+if (!certDBFile.exists()) {
+  var defaultProfileDir = Services.dirsvc.get("GreD", Ci.nsIFile);
+  defaultProfileDir.append("defaults");
+  defaultProfileDir.append("profile");
+  try {
+    copyDir(defaultProfileDir, profileDir);
+  } catch (e) {
+    Components.utils.reportError(e);
+  }
+}
+ 
+function copyDir(aOriginal, aDestination) {
+  var enumerator = aOriginal.directoryEntries;
+  while (enumerator.hasMoreElements()) {
+    var file = enumerator.getNext().QueryInterface(Components.interfaces.nsIFile);
+    if (file.isDirectory()) {
+      var subdir = aDestination.clone();
+      subdir.append(file.leafName);
+      try {
+        subdir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
+        copyDir(file, subdir);
+      } catch (e) {
+        Components.utils.reportError(e);
+      }
+    } else {
+      try {
+        file.copyTo(aDestination, null);
+      } catch (e) {
+        Components.utils.reportError(e);
+      }
+    }
+  }
+}

diff --git a/www-client/torbrowser/metadata.xml b/www-client/torbrowser/metadata.xml
new file mode 100644
index 0000000..86934b2
--- /dev/null
+++ b/www-client/torbrowser/metadata.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="person">
+	<email>poncho@spahan.ch</email>
+	<name>Poncho</name>
+</maintainer>
+<use>
+	<flag name="custom-optimization">Build with user-specified compiler optimizations
+		(-Os, -O0, -O1, -O2, -O3) from CFLAGS (unsupported)</flag>
+	<flag name="gtk2">Use the cairo-gtk2 rendering engine</flag>
+	<flag name="jemalloc">Enable or disable jemalloc</flag>
+	<flag name="system-cairo">Use the system-wide <pkg>x11-libs/cairo</pkg>
+		instead of bundled.</flag>
+	<flag name="system-harfbuzz">Use the system-wide <pkg>media-libs/harfbuzz</pkg>
+		and <pkg>media-gfx/graphite2</pkg> instead of bundled.</flag>
+	<flag name="system-icu">Use the system-wide <pkg>dev-libs/icu</pkg>
+		instead of bundled.</flag>
+	<flag name="system-jpeg">Use the system-wide <pkg>media-libs/libjpeg-turbo</pkg>
+		instead of bundled.</flag>
+	<flag name="system-libevent">Use the system-wide <pkg>dev-libs/libevent</pkg>
+		instead of bundled.</flag>
+	<flag name="system-libvpx">Use the system-wide <pkg>media-libs/libvpx</pkg>
+		instead of bundled.</flag>
+	<flag name="system-sqlite">Use the system-wide <pkg>dev-db/sqlite</pkg>
+		installation with secure-delete enabled</flag>
+</use>
+</pkgmetadata>

diff --git a/www-client/torbrowser/torbrowser-52.8.1_p755.ebuild b/www-client/torbrowser/torbrowser-52.8.1_p755.ebuild
new file mode 100644
index 0000000..bf59995
--- /dev/null
+++ b/www-client/torbrowser/torbrowser-52.8.1_p755.ebuild
@@ -0,0 +1,311 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+WANT_AUTOCONF="2.1"
+MOZ_ESR=1
+
+if [[ ${MOZ_ESR} == 1 ]]; then
+	# ESR releases have slightly different version numbers
+	MOZ_PV="${PV/_p*}esr"
+fi
+
+# see https://gitweb.torproject.org/builders/tor-browser-build.git/tree/projects/firefox/config?h=maint-7.5#n4
+TOR_PV="7.5.5"
+EGIT_COMMIT="tor-browser-${MOZ_PV}-${TOR_PV%.*}-1-build1"
+
+# Patch version
+PATCH="${PN}-52.8-patches-01"
+
+MOZCONFIG_OPTIONAL_GTK2ONLY=1
+MOZCONFIG_OPTIONAL_WIFI=1
+
+inherit git-r3 check-reqs flag-o-matic toolchain-funcs eutils gnome2-utils mozconfig-v6.52 pax-utils autotools
+
+DESCRIPTION="The Tor Browser"
+HOMEPAGE="https://www.torproject.org/projects/torbrowser.html
+	https://gitweb.torproject.org/tor-browser.git"
+
+KEYWORDS="~amd64 ~x86"
+SLOT="0"
+# BSD license applies to torproject-related code like the patches
+# icons are under CCPL-Attribution-3.0
+LICENSE="BSD CC-BY-3.0 MPL-2.0 GPL-2 LGPL-2.1"
+IUSE="hardened test"
+
+EGIT_REPO_URI="https://git.torproject.org/tor-browser.git"
+EGIT_CLONE_TYPE="shallow"
+BASE_SRC_URI="https://dist.torproject.org/${PN}/${TOR_PV}"
+ARCHIVE_SRC_URI="https://archive.torproject.org/tor-package-archive/${PN}/${TOR_PV}"
+PATCH_URIS=( https://dev.gentoo.org/~{anarchy,axs,polynomial-c}/mozilla/patchsets/${PATCH}.tar.xz )
+
+SRC_URI="${SRC_URI}
+	x86? ( ${BASE_SRC_URI}/tor-browser-linux32-${TOR_PV}_en-US.tar.xz
+		${ARCHIVE_SRC_URI}/tor-browser-linux32-${TOR_PV}_en-US.tar.xz )
+	amd64? ( ${BASE_SRC_URI}/tor-browser-linux64-${TOR_PV}_en-US.tar.xz
+		${ARCHIVE_SRC_URI}/tor-browser-linux64-${TOR_PV}_en-US.tar.xz )
+	${PATCH_URIS[@]}"
+
+ASM_DEPEND=">=dev-lang/yasm-1.1"
+
+RDEPEND="
+	>=dev-libs/nspr-4.19
+	!!<=www-client/torbrowser-45.5.1_p607"
+
+DEPEND="${RDEPEND}
+	${ASM_DEPEND}
+	virtual/opengl"
+
+QA_PRESTRIPPED="usr/lib*/${PN}/torbrowser"
+
+BUILD_OBJ_DIR="${S}/torsecure"
+
+pkg_setup() {
+	moz_pkgsetup
+
+	# These should *always* be cleaned up anyway
+	unset DBUS_SESSION_BUS_ADDRESS \
+		DISPLAY \
+		ORBIT_SOCKETDIR \
+		SESSION_MANAGER \
+		XDG_SESSION_COOKIE \
+		XAUTHORITY
+}
+
+pkg_pretend() {
+	# Ensure we have enough disk space to compile
+	if use debug || use test ; then
+		CHECKREQS_DISK_BUILD="8G"
+	else
+		CHECKREQS_DISK_BUILD="4G"
+	fi
+	check-reqs_pkg_setup
+}
+
+src_unpack() {
+	unpack ${A}
+	git-r3_src_unpack
+}
+
+src_prepare() {
+	# Apply gentoo firefox patches
+	eapply "${WORKDIR}/${PN}"
+
+	# Allow user to apply any additional patches without modifing ebuild
+	eapply_user
+
+	# Enable gnomebreakpad
+	if use debug ; then
+		sed -i -e "s:GNOME_DISABLE_CRASH_DIALOG=1:GNOME_DISABLE_CRASH_DIALOG=0:g" \
+			"${S}"/build/unix/run-mozilla.sh || die "sed failed!"
+	fi
+
+	# Ensure that our plugins dir is enabled as default
+	sed -i -e "s:/usr/lib/mozilla/plugins:/usr/lib/nsbrowser/plugins:" \
+		"${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 32bit!"
+	sed -i -e "s:/usr/lib64/mozilla/plugins:/usr/lib64/nsbrowser/plugins:" \
+		"${S}"/xpcom/io/nsAppFileLocationProvider.cpp || die "sed failed to replace plugin path for 64bit!"
+
+	# Fix sandbox violations during make clean, bug 372817
+	sed -e "s:\(/no-such-file\):${T}\1:g" \
+		-i "${S}"/config/rules.mk \
+		-i "${S}"/nsprpub/configure{.in,} \
+		|| die
+
+	# Don't exit with error when some libs are missing which we have in
+	# system.
+	sed '/^MOZ_PKG_FATAL_WARNINGS/s@= 1@= 0@' \
+		-i "${S}"/browser/installer/Makefile.in || die
+
+	# Don't error out when there's no files to be removed:
+	sed 's@\(xargs rm\)$@\1 -f@' \
+		-i "${S}"/toolkit/mozapps/installer/packager.mk || die
+
+	# Keep codebase the same even if not using official branding
+	sed '/^MOZ_DEV_EDITION=1/d' \
+		-i "${S}"/browser/branding/aurora/configure.sh || die
+
+	# Allow user to apply any additional patches without modifing ebuild
+	eapply_user
+
+	# Autotools configure is now called old-configure.in
+	# This works because there is still a configure.in that happens to be for the
+	# shell wrapper configure script
+	eautoreconf old-configure.in
+
+	# Must run autoconf in js/src
+	cd "${S}"/js/src || die
+	eautoconf old-configure.in
+
+	# Need to update jemalloc's configure
+	cd "${S}"/memory/jemalloc/src || die
+	WANT_AUTOCONF= eautoconf
+}
+
+src_configure() {
+	MEXTENSIONS="default"
+
+	mozconfig_init
+	mozconfig_config
+
+	# Add full relro support for hardened
+	use hardened && append-ldflags "-Wl,-z,relro,-z,now"
+
+	mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
+
+	# Rename the install directory and the executable
+	mozconfig_annotate 'torbrowser' --with-app-name=torbrowser
+	mozconfig_annotate 'torbrowser' --with-app-basename=torbrowser
+	# see https://gitweb.torproject.org/tor-browser.git/tree/old-configure.in?h=tor-browser-52.6.0esr-7.5-2#n3917
+	mozconfig_annotate 'torbrowser' --with-tor-browser-version=${TOR_PV}
+	mozconfig_annotate 'torbrowser' --disable-tor-browser-update
+
+	# torbrowser uses a patched nss library
+	# see https://gitweb.torproject.org/tor-browser.git/log/security/nss?h=tor-browser-52.6.0esr-7.5-2
+	mozconfig_annotate 'torbrowser' --without-system-nspr
+	mozconfig_annotate 'torbrowser' --without-system-nss
+
+	echo "mk_add_options MOZ_OBJDIR=${BUILD_OBJ_DIR}" >> "${S}"/.mozconfig
+	echo "mk_add_options XARGS=/usr/bin/xargs" >> "${S}"/.mozconfig
+
+	# Finalize and report settings
+	mozconfig_final
+
+	# workaround for funky/broken upstream configure...
+	SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \
+	emake -f client.mk configure
+}
+
+src_compile() {
+	MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \
+	emake -f client.mk realbuild
+}
+
+src_install() {
+	cd "${BUILD_OBJ_DIR}" || die
+
+	# Pax mark xpcshell for hardened support, only used for startupcache creation.
+	pax-mark m "${BUILD_OBJ_DIR}"/dist/bin/xpcshell
+
+	# see: https://gitweb.torproject.org/builders/tor-browser-build.git/tree/projects/tor-browser/build?h=maint-7.5#n23
+	touch "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/extension-overrides.js" \
+		|| die
+
+	# see: https://gitweb.torproject.org/builders/tor-browser-build.git/tree/projects/tor-browser/build?h=maint-7.5#n158
+	echo "pref(\"extensions.torlauncher.prompt_for_locale\", \"false\");" \
+		>> "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/extension-overrides.js" \
+		|| die
+
+	echo "pref(\"intl.locale.matchOS\", \"false\");" \
+		>> "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/extension-overrides.js" \
+		|| die
+
+	# see: https://gitweb.torproject.org/builders/tor-browser-build.git/tree/projects/tor-browser/build?h=maint-7.5#n196
+	echo "pref(\"general.useragent.locale\", \"en-US\");" \
+		>> "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/000-tor-browser.js" \
+		|| die
+
+	# Reenable defaults/profile functionality
+	# see: https://bugzilla.mozilla.org/show_bug.cgi?id=1234012
+	# see: https://mike.kaply.com/2016/05/24/default-profile-directory-doesnt-work-in-firefox-46/
+	echo "pref(\"general.config.filename\", \"profile.cfg\");" \
+		>> "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/000-tor-browser.js" \
+		|| die
+
+	echo "pref(\"general.config.obscure_value\", 0);" \
+		>> "${BUILD_OBJ_DIR}/dist/bin/browser/defaults/preferences/000-tor-browser.js" \
+		|| die
+
+	insinto ${MOZILLA_FIVE_HOME}
+	doins "${FILESDIR}/profile.cfg"
+
+	MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX%/}/bin/bash}" \
+	emake DESTDIR="${D}" install
+
+	# Install icons and .desktop for menu entry
+	local size sizes icon_path
+	sizes="16 24 32 48 256"
+	icon_path="${S}/browser/branding/official"
+	for size in ${sizes}; do
+		newicon -s ${size} "${icon_path}/default${size}.png" ${PN}.png
+	done
+	# The 128x128 icon has a different name
+	newicon -s 128 "${icon_path}/mozicon128.png" ${PN}.png
+	make_desktop_entry ${PN} "Tor Browser" ${PN} "Network;WebBrowser" "StartupWMClass=Torbrowser"
+
+	# Add StartupNotify=true bug 237317
+	if use startup-notification ; then
+		echo "StartupNotify=true" \
+			>> "${ED}/usr/share/applications/${PN}-${PN}.desktop" \
+			|| die
+	fi
+
+	# Required in order to use plugins and even run torbrowser on hardened.
+	pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/{torbrowser,torbrowser-bin,plugin-container}
+
+	# Profile without the tor-launcher extension
+	# see: https://trac.torproject.org/projects/tor/ticket/10160
+	local profile_dir="${WORKDIR}/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.default"
+
+	docompress -x "${EROOT}/usr/share/doc/${PF}/tor-launcher@torproject.org.xpi"
+	dodoc "${profile_dir}/extensions/tor-launcher@torproject.org.xpi"
+	rm "${profile_dir}/extensions/tor-launcher@torproject.org.xpi" || die "Failed to remove torlauncher extension"
+
+	insinto ${MOZILLA_FIVE_HOME}/defaults/profile
+	doins -r "${profile_dir}"/{extensions,preferences,bookmarks.html}
+
+	# see: https://gitweb.torproject.org/builders/tor-browser-bundle.git/tree/RelativeLink/start-tor-browser#n301
+	dodoc "${FILESDIR}/README.tor-launcher"
+	dodoc "${WORKDIR}/tor-browser_en-US/Browser/TorBrowser/Docs/ChangeLog.txt"
+
+	# see: https://trac.torproject.org/projects/tor/ticket/11751#comment:2
+	# see: https://github.com/Whonix/anon-ws-disable-stacked-tor/blob/master/usr/lib/anon-ws-disable-stacked-tor/torbrowser.sh
+	dodoc "${FILESDIR}/99torbrowser.example"
+}
+
+pkg_preinst() {
+	gnome2_icon_savelist
+
+	# if the apulse libs are available in MOZILLA_FIVE_HOME then apulse
+	# doesn't need to be forced into the LD_LIBRARY_PATH
+	if use pulseaudio && has_version ">=media-sound/apulse-0.1.9" ; then
+		einfo "APULSE found - Generating library symlinks for sound support"
+		local lib
+		pushd "${ED}"${MOZILLA_FIVE_HOME} &>/dev/null || die
+		for lib in ../apulse/libpulse{.so{,.0},-simple.so{,.0}} ; do
+			# a quickpkg rolled by hand will grab symlinks as part of the package,
+			# so we need to avoid creating them if they already exist.
+			if ! [ -L ${lib##*/} ]; then
+				ln -s "${lib}" ${lib##*/} || die
+			fi
+		done
+		popd &>/dev/null || die
+	fi
+}
+
+pkg_postinst() {
+	gnome2_icon_cache_update
+
+	if use pulseaudio && has_version ">=media-sound/apulse-0.1.9" ; then
+		elog "Apulse was detected at merge time on this system and so it will always be"
+		elog "used for sound.  If you wish to use pulseaudio instead please unmerge"
+		elog "media-sound/apulse."
+	fi
+
+	if [[ -z ${REPLACING_VERSIONS} ]]; then
+		ewarn "This patched firefox build is _NOT_ recommended by Tor upstream but uses"
+		ewarn "the exact same sources. Use this only if you know what you are doing!"
+		elog "Torbrowser uses port 9150 to connect to Tor. You can change the port"
+		elog "in the connection settings to match your setup."
+		elog ""
+		elog "To get the advanced functionality of Torbutton (network information,"
+		elog "new identity), Torbrowser needs to access a control port."
+		elog "See 99torbrowser.example in /usr/share/doc/${PF} and"
+		elog "https://github.com/MeisterP/torbrowser-overlay/blob/master/Readme.md"
+		elog "for further information."
+	fi
+}
+
+pkg_postrm() {
+	gnome2_icon_cache_update
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/mozilla:master commit in: www-client/torbrowser/files/, www-client/torbrowser/
@ 2019-04-18 10:55 Jory Pratt
  0 siblings, 0 replies; 2+ messages in thread
From: Jory Pratt @ 2019-04-18 10:55 UTC (permalink / raw
  To: gentoo-commits

commit:     077bcb531439cd1eec06af0bf6754fbd2bc99500
Author:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 18 10:55:09 2019 +0000
Commit:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Thu Apr 18 10:55:09 2019 +0000
URL:        https://gitweb.gentoo.org/proj/mozilla.git/commit/?id=077bcb53

www-client/torbrowser: misc cleanup to code, update fx patchset

Package-Manager: Portage-2.3.63, Repoman-2.3.12
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>

 www-client/torbrowser/Manifest                     |   2 +-
 www-client/torbrowser/files/99torbrowser.example   |  20 +
 www-client/torbrowser/files/profile.cfg            |  42 ++
 ...nge_the_default_Firefox_profile_directory.patch | 425 +++++++++++++++++++++
 ...0.5.0-Do_not_store_data_in_the_app_bundle.patch | 189 +++++++++
 .../torbrowser-60.5.0-nss-fixup-warnings.patch     |  25 ++
 www-client/torbrowser/files/torbrowser-lto.patch   |  32 --
 .../torbrowser/files/torbrowser-profiledir.patch   |  44 ---
 .../files/torbrowser-rust_missing_docs.patch       |  21 -
 ...build => torbrowser-60.6.1.8.0.8.1.1-r1.ebuild} | 117 +++---
 10 files changed, 761 insertions(+), 156 deletions(-)

diff --git a/www-client/torbrowser/Manifest b/www-client/torbrowser/Manifest
index 3a1fff6..4f1ad0f 100644
--- a/www-client/torbrowser/Manifest
+++ b/www-client/torbrowser/Manifest
@@ -1,4 +1,4 @@
-DIST firefox-60.6-patches-01.tar.xz 14548 BLAKE2B 412059a6db015fff0985e637768426f877b33bb6b649c54f1292780b9d871f8fe9bf8e6b150ec36ab3647b4501fa6aec821c089a5d6fa861402f05e948f1a9d4 SHA512 b97da7a7b65bbf53cb6b9f48fc6c07a32cefa9d4b4a79ce57df047f941f5269e21bf09fa56a5f31bbf757ed2d76f8a1fe01d2306c92d20cab979e0a21f895e64
+DIST firefox-60.6-patches-05.tar.xz 35980 BLAKE2B eea4ed2061f36b85bfa0677434f3acf478d9a58ed3130c2b2cab4dc78613e16ff481cc063d71525fc16b01be3cfe17a4a5dcd60c5070205246eb8b2b78387393 SHA512 3a591d68f5911c6547de24e73390478eb389f467a49f4010cd8c295569a09d878ffa2db4a072fe118c1195d1f0acf0adbb7540de14c367cb4cec522b4f1e4b05
 DIST tor-browser-60.6.1esr-8.0-1-build1.tar.gz 386384151 BLAKE2B 18c9a07296317a0e62e40939c9b839850069836f9d489910fc364e1e2929a3218d3a2fc8a521a59d8971b925a09e0c29820a964bc326b0143480f2839b9f72cf SHA512 9a39ed63494cd2be4952312d8160884f2fa35211f3ea54fc2e9dcc737236102938d8c17b3a112420d847b7c7e98d0f33f210afb3d0fd979e21f7e23769372b4b
 DIST tor-browser-linux32-8.0.8_en-US.tar.xz 76761628 BLAKE2B 0c21f3c5718da9fcfe8961a59cd98be495411ea85200294f1918aa9c27af25428e18d7b8a52bab1c27360e6ded221ea981554b7f4130ccd646bc9edb53039f43 SHA512 ebd2b93bdaf87d34cb03ecc2d0811d376a3942de9ea84b6f049358127e91c76aaef4bdd7fcaa9467660e907f9ee5d3fd239f80d7a1667fea2e9b5fbb80355d42
 DIST tor-browser-linux64-8.0.8_en-US.tar.xz 75228720 BLAKE2B 2e368225ca44868b700f1a6c8cb7a0f8f532adbca0f38d998741f5a8e24b76553ab861416724d0101b5b30a8bb305b96d308bfc6315619be4489a8f98ebc979a SHA512 a046d56280b24c3a524b894b94ecacd876d27f732bcc1744a5b194684b1477fcb468e6978a20bee456242708e7f9a4e58a7e82e58f31ed3b84f652689cec546e

diff --git a/www-client/torbrowser/files/99torbrowser.example b/www-client/torbrowser/files/99torbrowser.example
new file mode 100644
index 0000000..e138b30
--- /dev/null
+++ b/www-client/torbrowser/files/99torbrowser.example
@@ -0,0 +1,20 @@
+# /etc/env.d/99torbrowser
+#
+# The Tor ControlPort password should be given inside double quotes, inside
+# single quotes, i.e. if the ControlPort password is “secret” (without
+# curly quotes) then we must set the environment variable *exactly* like
+# this:
+# TOR_CONTROL_PASSWD='"secret"'
+# Yes, the variable MUST be double-quoted, then single-quoted, exactly as
+# shown. This is used by TorButton to authenticate to Tor's ControlPort, and
+# is necessary for using TB with a system-installed Tor
+
+#TOR_SOCKS_HOST=127.0.0.1
+#TOR_SOCKS_PORT=9150
+#TOR_SOCKS_IPC_PATH=/var/run/tor/socks
+
+#TOR_CONTROL_HOST=127.0.0.1
+#TOR_CONTROL_PORT=9151
+#TOR_CONTROL_PASSWD='"secret"'
+#TOR_CONTROL_COOKIE_AUTH_FILE=/var/run/tor/control.authcookie
+#TOR_CONTROL_IPC_PATH=/var/run/tor/control

diff --git a/www-client/torbrowser/files/profile.cfg b/www-client/torbrowser/files/profile.cfg
new file mode 100644
index 0000000..d14309a
--- /dev/null
+++ b/www-client/torbrowser/files/profile.cfg
@@ -0,0 +1,42 @@
+//
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/FileUtils.jsm");
+
+var profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
+var certDBFile = profileDir.clone();
+certDBFile.append("cert8.db")
+// If cert8.db isn't there, it's a new profile
+if (!certDBFile.exists()) {
+  var defaultProfileDir = Services.dirsvc.get("GreD", Ci.nsIFile);
+  defaultProfileDir.append("defaults");
+  defaultProfileDir.append("profile");
+  try {
+    copyDir(defaultProfileDir, profileDir);
+  } catch (e) {
+    Components.utils.reportError(e);
+  }
+}
+ 
+function copyDir(aOriginal, aDestination) {
+  var enumerator = aOriginal.directoryEntries;
+  while (enumerator.hasMoreElements()) {
+    var file = enumerator.getNext().QueryInterface(Components.interfaces.nsIFile);
+    if (file.isDirectory()) {
+      var subdir = aDestination.clone();
+      subdir.append(file.leafName);
+      try {
+        subdir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
+        copyDir(file, subdir);
+      } catch (e) {
+        Components.utils.reportError(e);
+      }
+    } else {
+      try {
+        file.copyTo(aDestination, null);
+      } catch (e) {
+        Components.utils.reportError(e);
+      }
+    }
+  }
+}

diff --git a/www-client/torbrowser/files/torbrowser-60.5.0-Change_the_default_Firefox_profile_directory.patch b/www-client/torbrowser/files/torbrowser-60.5.0-Change_the_default_Firefox_profile_directory.patch
new file mode 100644
index 0000000..3559402
--- /dev/null
+++ b/www-client/torbrowser/files/torbrowser-60.5.0-Change_the_default_Firefox_profile_directory.patch
@@ -0,0 +1,425 @@
+From e5b0afd7fee16e7f755095b8b85296fe401fb04d Mon Sep 17 00:00:00 2001
+From: Poncho <poncho@spahan.ch>
+Date: Wed, 30 Jan 2019 09:55:48 +0100
+Subject: [PATCH 2/4] Revert "Bug 9173: Change the default Firefox profile
+ directory to be TBB-relative."
+
+This reverts commit b82691c60b6a3ade6939b0f68f28de1e3c120292.
+---
+ toolkit/xre/nsXREDirProvider.cpp       | 147 +++++++++++++++++++------
+ toolkit/xre/nsXREDirProvider.h         |  12 +-
+ xpcom/io/nsAppFileLocationProvider.cpp |  97 ++++++++++------
+ 3 files changed, 181 insertions(+), 75 deletions(-)
+
+diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
+index dbbaffd2a15f..00ee37ce9b5f 100644
+--- a/toolkit/xre/nsXREDirProvider.cpp
++++ b/toolkit/xre/nsXREDirProvider.cpp
+@@ -32,7 +32,6 @@
+ #include "nsArrayEnumerator.h"
+ #include "nsEnumeratorUtils.h"
+ #include "nsReadableUtils.h"
+-#include "nsXPCOMPrivate.h"  // for XPCOM_FILE_PATH_SEPARATOR
+ 
+ #include "SpecialSystemDirectory.h"
+ 
+@@ -215,6 +214,9 @@ nsresult nsXREDirProvider::GetUserProfilesRootDir(nsIFile** aResult) {
+   nsresult rv = GetUserDataDirectory(getter_AddRefs(file), false);
+ 
+   if (NS_SUCCEEDED(rv)) {
++#if !defined(XP_UNIX) || defined(XP_MACOSX)
++    rv = file->AppendNative(NS_LITERAL_CSTRING("Profiles"));
++#endif
+     // We must create the profile directory here if it does not exist.
+     nsresult tmp = EnsureDirectoryExists(file);
+     if (NS_FAILED(tmp)) {
+@@ -230,6 +232,9 @@ nsresult nsXREDirProvider::GetUserProfilesLocalDir(nsIFile** aResult) {
+   nsresult rv = GetUserDataDirectory(getter_AddRefs(file), true);
+ 
+   if (NS_SUCCEEDED(rv)) {
++#if !defined(XP_UNIX) || defined(XP_MACOSX)
++    rv = file->AppendNative(NS_LITERAL_CSTRING("Profiles"));
++#endif
+     // We must create the profile directory here if it does not exist.
+     nsresult tmp = EnsureDirectoryExists(file);
+     if (NS_FAILED(tmp)) {
+@@ -1332,42 +1337,84 @@ nsresult nsXREDirProvider::GetProfileDir(nsIFile** aResult) {
+ nsresult nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile,
+                                                     bool aLocal) {
+   // Copied from nsAppFileLocationProvider (more or less)
+-  NS_ENSURE_ARG_POINTER(aFile);
++  nsresult rv;
+   nsCOMPtr<nsIFile> localDir;
+ 
+-  nsresult rv = GetAppDir()->Clone(getter_AddRefs(localDir));
+-  NS_ENSURE_SUCCESS(rv, rv);
+-
+-  int levelsToRemove = 1;  // In FF21+, appDir points to browser subdirectory.
+ #if defined(XP_MACOSX)
+-  levelsToRemove += 2;
++  FSRef fsRef;
++  OSType folderType;
++  if (aLocal) {
++    folderType = kCachedDataFolderType;
++  } else {
++#ifdef MOZ_THUNDERBIRD
++    folderType = kDomainLibraryFolderType;
++#else
++    folderType = kApplicationSupportFolderType;
+ #endif
+-  while (localDir && (levelsToRemove > 0)) {
+-    // When crawling up the hierarchy, components named "." do not count.
+-    nsAutoCString removedName;
+-    rv = localDir->GetNativeLeafName(removedName);
+-    NS_ENSURE_SUCCESS(rv, rv);
+-    bool didRemove = !removedName.Equals(".");
+-
+-    // Remove a directory component.
+-    nsCOMPtr<nsIFile> parentDir;
+-    rv = localDir->GetParent(getter_AddRefs(parentDir));
+-    NS_ENSURE_SUCCESS(rv, rv);
+-    localDir = parentDir;
+-    if (didRemove) --levelsToRemove;
+   }
++  OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef);
++  NS_ENSURE_FALSE(err, NS_ERROR_FAILURE);
+ 
+-  if (!localDir) return NS_ERROR_FAILURE;
++  rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(localDir));
++  NS_ENSURE_SUCCESS(rv, rv);
++
++  nsCOMPtr<nsILocalFileMac> dirFileMac = do_QueryInterface(localDir);
++  NS_ENSURE_TRUE(dirFileMac, NS_ERROR_UNEXPECTED);
+ 
+-  rv = localDir->AppendRelativeNativePath(
+-      NS_LITERAL_CSTRING("TorBrowser" XPCOM_FILE_PATH_SEPARATOR
+-                         "Data" XPCOM_FILE_PATH_SEPARATOR "Browser"));
++  rv = dirFileMac->InitWithFSRef(&fsRef);
+   NS_ENSURE_SUCCESS(rv, rv);
+ 
++  localDir = do_QueryInterface(dirFileMac, &rv);
++#elif defined(XP_IOS)
++  nsAutoCString userDir;
++  if (GetUIKitDirectory(aLocal, userDir)) {
++    rv = NS_NewNativeLocalFile(userDir, true, getter_AddRefs(localDir));
++  } else {
++    rv = NS_ERROR_FAILURE;
++  }
++  NS_ENSURE_SUCCESS(rv, rv);
++#elif defined(XP_WIN)
++  nsString path;
+   if (aLocal) {
+-    rv = localDir->AppendNative(NS_LITERAL_CSTRING("Caches"));
+-    NS_ENSURE_SUCCESS(rv, rv);
++    rv = GetShellFolderPath(FOLDERID_LocalAppData, path);
++    if (NS_FAILED(rv)) rv = GetRegWindowsAppDataFolder(aLocal, path);
++  }
++  if (!aLocal || NS_FAILED(rv)) {
++    rv = GetShellFolderPath(FOLDERID_RoamingAppData, path);
++    if (NS_FAILED(rv)) {
++      if (!aLocal) rv = GetRegWindowsAppDataFolder(aLocal, path);
++    }
++  }
++  NS_ENSURE_SUCCESS(rv, rv);
++
++  rv = NS_NewLocalFile(path, true, getter_AddRefs(localDir));
++#elif defined(XP_UNIX)
++  const char* homeDir = getenv("HOME");
++  if (!homeDir || !*homeDir) return NS_ERROR_FAILURE;
++
++#ifdef ANDROID /* We want (ProfD == ProfLD) on Android. */
++  aLocal = false;
++#endif
++
++  if (aLocal) {
++    // If $XDG_CACHE_HOME is defined use it, otherwise use $HOME/.cache.
++    const char* cacheHome = getenv("XDG_CACHE_HOME");
++    if (cacheHome && *cacheHome) {
++      rv = NS_NewNativeLocalFile(nsDependentCString(cacheHome), true,
++                                 getter_AddRefs(localDir));
++    } else {
++      rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), true,
++                                 getter_AddRefs(localDir));
++      if (NS_SUCCEEDED(rv))
++        rv = localDir->AppendNative(NS_LITERAL_CSTRING(".cache"));
++    }
++  } else {
++    rv = NS_NewNativeLocalFile(nsDependentCString(homeDir), true,
++                               getter_AddRefs(localDir));
+   }
++#else
++#error "Don't know how to get product dir on your platform"
++#endif
+ 
+   NS_IF_ADDREF(*aFile = localDir);
+   return rv;
+@@ -1537,23 +1584,39 @@ nsresult nsXREDirProvider::AppendProfilePath(nsIFile* aFile, bool aLocal) {
+   }
+ 
+   nsAutoCString profile;
++  nsAutoCString appName;
++  nsAutoCString vendor;
+   if (gAppData->profile) {
+     profile = gAppData->profile;
++  } else {
++    appName = gAppData->name;
++    vendor = gAppData->vendor;
+   }
+ 
+-  nsresult rv = NS_ERROR_FAILURE;
++  nsresult rv;
+ 
+ #if defined(XP_MACOSX)
+   if (!profile.IsEmpty()) {
+     rv = AppendProfileString(aFile, profile.get());
+-    NS_ENSURE_SUCCESS(rv, rv);
++  } else {
++    // Note that MacOS ignores the vendor when creating the profile hierarchy -
++    // all application preferences directories live alongside one another in
++    // ~/Library/Application Support/
++    rv = aFile->AppendNative(appName);
+   }
++  NS_ENSURE_SUCCESS(rv, rv);
+ 
+ #elif defined(XP_WIN)
+   if (!profile.IsEmpty()) {
+     rv = AppendProfileString(aFile, profile.get());
+-    NS_ENSURE_SUCCESS(rv, rv);
++  } else {
++    if (!vendor.IsEmpty()) {
++      rv = aFile->AppendNative(vendor);
++      NS_ENSURE_SUCCESS(rv, rv);
++    }
++    rv = aFile->AppendNative(appName);
+   }
++  NS_ENSURE_SUCCESS(rv, rv);
+ 
+ #elif defined(ANDROID)
+   // The directory used for storing profiles
+@@ -1563,6 +1626,11 @@ nsresult nsXREDirProvider::AppendProfilePath(nsIFile* aFile, bool aLocal) {
+   rv = aFile->AppendNative(nsDependentCString("mozilla"));
+   NS_ENSURE_SUCCESS(rv, rv);
+ #elif defined(XP_UNIX)
++  nsAutoCString folder;
++  // Make it hidden (by starting with "."), except when local (the
++  // profile is already under ~/.cache or XDG_CACHE_HOME).
++  if (!aLocal) folder.Assign('.');
++
+   if (!profile.IsEmpty()) {
+     // Skip any leading path characters
+     const char* profileStart = profile.get();
+@@ -1570,16 +1638,29 @@ nsresult nsXREDirProvider::AppendProfilePath(nsIFile* aFile, bool aLocal) {
+ 
+     // On the off chance that someone wanted their folder to be hidden don't
+     // let it become ".."
+-    if (*profileStart == '.') profileStart++;
++    if (*profileStart == '.' && !aLocal) profileStart++;
+ 
+-    // Make it hidden (by starting with ".").
+-    nsAutoCString folder(".");
+     folder.Append(profileStart);
+     ToLowerCase(folder);
+ 
+     rv = AppendProfileString(aFile, folder.BeginReading());
+-    NS_ENSURE_SUCCESS(rv, rv);
++  } else {
++    if (!vendor.IsEmpty()) {
++      folder.Append(vendor);
++      ToLowerCase(folder);
++
++      rv = aFile->AppendNative(folder);
++      NS_ENSURE_SUCCESS(rv, rv);
++
++      folder.Truncate();
++    }
++
++    folder.Append(appName);
++    ToLowerCase(folder);
++
++    rv = aFile->AppendNative(folder);
+   }
++  NS_ENSURE_SUCCESS(rv, rv);
+ 
+ #else
+ #error "Don't know how to get profile path on your platform"
+diff --git a/toolkit/xre/nsXREDirProvider.h b/toolkit/xre/nsXREDirProvider.h
+index 6b92f3812882..5060b33cdded 100644
+--- a/toolkit/xre/nsXREDirProvider.h
++++ b/toolkit/xre/nsXREDirProvider.h
+@@ -48,15 +48,15 @@ class nsXREDirProvider final : public nsIDirectoryServiceProvider2,
+ 
+   void DoShutdown();
+ 
+-  nsresult GetUserAppDataDirectory(nsIFile** aFile) {
++  static nsresult GetUserAppDataDirectory(nsIFile** aFile) {
+     return GetUserDataDirectory(aFile, false);
+   }
+-  nsresult GetUserLocalDataDirectory(nsIFile** aFile) {
++  static nsresult GetUserLocalDataDirectory(nsIFile** aFile) {
+     return GetUserDataDirectory(aFile, true);
+   }
+ 
+   // GetUserDataDirectory gets the profile path from gAppData.
+-  nsresult GetUserDataDirectory(nsIFile** aFile, bool aLocal);
++  static nsresult GetUserDataDirectory(nsIFile** aFile, bool aLocal);
+ 
+   /* make sure you clone it, if you need to do stuff to it */
+   nsIFile* GetGREDir() { return mGREDir; }
+@@ -90,9 +90,9 @@ class nsXREDirProvider final : public nsIDirectoryServiceProvider2,
+  protected:
+   nsresult GetFilesInternal(const char* aProperty,
+                             nsISimpleEnumerator** aResult);
+-  nsresult GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal);
+-  nsresult GetSysUserExtensionsDirectory(nsIFile** aFile);
+-  nsresult GetSysUserExtensionsDevDirectory(nsIFile** aFile);
++  static nsresult GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal);
++  static nsresult GetSysUserExtensionsDirectory(nsIFile** aFile);
++  static nsresult GetSysUserExtensionsDevDirectory(nsIFile** aFile);
+ #if defined(XP_UNIX) || defined(XP_MACOSX)
+   static nsresult GetSystemExtensionsDirectory(nsIFile** aFile);
+ #endif
+diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocationProvider.cpp
+index 2aa5482f5789..f1491595a8ea 100644
+--- a/xpcom/io/nsAppFileLocationProvider.cpp
++++ b/xpcom/io/nsAppFileLocationProvider.cpp
+@@ -14,7 +14,6 @@
+ #include "nsISimpleEnumerator.h"
+ #include "prenv.h"
+ #include "nsCRT.h"
+-#include "nsXPCOMPrivate.h"  // for XPCOM_FILE_PATH_SEPARATOR
+ #if defined(MOZ_WIDGET_COCOA)
+ #include <Carbon/Carbon.h>
+ #include "nsILocalFileMac.h"
+@@ -248,8 +247,9 @@ nsresult nsAppFileLocationProvider::CloneMozBinDirectory(nsIFile** aLocalFile) {
+ // GetProductDirectory - Gets the directory which contains the application data
+ // folder
+ //
+-// UNIX and WIN   : <App Folder>/TorBrowser/Data/Browser
+-// Mac            : <App Folder>/../../TorBrowser/Data/Browser
++// UNIX   : ~/.mozilla/
++// WIN    : <Application Data folder on user's machine>\Mozilla
++// Mac    : :Documents:Mozilla:
+ //----------------------------------------------------------------------------------------
+ nsresult nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
+                                                         bool aLocal) {
+@@ -261,45 +261,49 @@ nsresult nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
+   bool exists;
+   nsCOMPtr<nsIFile> localDir;
+ 
+-  rv = CloneMozBinDirectory(getter_AddRefs(localDir));
+-  NS_ENSURE_SUCCESS(rv, rv);
+-
+-  int levelsToRemove = 1;  // In FF21+, bin dir points to browser subdirectory.
+-#if defined(XP_MACOSX)
+-  levelsToRemove += 2;
+-#endif
+-  while (localDir && (levelsToRemove > 0)) {
+-    // When crawling up the hierarchy, components named "." do not count.
+-    nsAutoCString removedName;
+-    rv = localDir->GetNativeLeafName(removedName);
+-    NS_ENSURE_SUCCESS(rv, rv);
+-    bool didRemove = !removedName.Equals(".");
+-
+-    // Remove a directory component.
+-    nsCOMPtr<nsIFile> parentDir;
+-    rv = localDir->GetParent(getter_AddRefs(parentDir));
+-    NS_ENSURE_SUCCESS(rv, rv);
+-    localDir = parentDir;
+-
+-    if (didRemove) {
+-      --levelsToRemove;
+-    }
++#if defined(MOZ_WIDGET_COCOA)
++  FSRef fsRef;
++  OSType folderType =
++      aLocal ? (OSType)kCachedDataFolderType : (OSType)kDomainLibraryFolderType;
++  OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef);
++  if (err) {
++    return NS_ERROR_FAILURE;
+   }
+-
++  NS_NewLocalFile(EmptyString(), true, getter_AddRefs(localDir));
+   if (!localDir) {
+     return NS_ERROR_FAILURE;
+   }
+-
+-  rv = localDir->AppendRelativeNativePath(
+-      NS_LITERAL_CSTRING("TorBrowser" XPCOM_FILE_PATH_SEPARATOR
+-                         "Data" XPCOM_FILE_PATH_SEPARATOR "Browser"));
+-  NS_ENSURE_SUCCESS(rv, rv);
+-
+-  if (aLocal) {
+-    rv = localDir->AppendNative(NS_LITERAL_CSTRING("Caches"));
+-    NS_ENSURE_SUCCESS(rv, rv);
++  nsCOMPtr<nsILocalFileMac> localDirMac(do_QueryInterface(localDir));
++  rv = localDirMac->InitWithFSRef(&fsRef);
++  if (NS_FAILED(rv)) {
++    return rv;
++  }
++#elif defined(XP_WIN)
++  nsCOMPtr<nsIProperties> directoryService =
++      do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv);
++  if (NS_FAILED(rv)) {
++    return rv;
++  }
++  const char* prop = aLocal ? NS_WIN_LOCAL_APPDATA_DIR : NS_WIN_APPDATA_DIR;
++  rv = directoryService->Get(prop, NS_GET_IID(nsIFile),
++                             getter_AddRefs(localDir));
++  if (NS_FAILED(rv)) {
++    return rv;
++  }
++#elif defined(XP_UNIX)
++  rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true,
++                             getter_AddRefs(localDir));
++  if (NS_FAILED(rv)) {
++    return rv;
+   }
++#else
++#error dont_know_how_to_get_product_dir_on_your_platform
++#endif
+ 
++  rv = localDir->AppendRelativeNativePath(DEFAULT_PRODUCT_DIR);
++  if (NS_FAILED(rv)) {
++    return rv;
++  }
+   rv = localDir->Exists(&exists);
+ 
+   if (NS_SUCCEEDED(rv) && !exists) {
+@@ -318,6 +322,10 @@ nsresult nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
+ //----------------------------------------------------------------------------------------
+ // GetDefaultUserProfileRoot - Gets the directory which contains each user
+ // profile dir
++//
++// UNIX   : ~/.mozilla/
++// WIN    : <Application Data folder on user's machine>\Mozilla\Profiles
++// Mac    : :Documents:Mozilla:Profiles:
+ //----------------------------------------------------------------------------------------
+ nsresult nsAppFileLocationProvider::GetDefaultUserProfileRoot(
+     nsIFile** aLocalFile, bool aLocal) {
+@@ -333,6 +341,23 @@ nsresult nsAppFileLocationProvider::GetDefaultUserProfileRoot(
+     return rv;
+   }
+ 
++#if defined(MOZ_WIDGET_COCOA) || defined(XP_WIN)
++  // These 3 platforms share this part of the path - do them as one
++  rv = localDir->AppendRelativeNativePath(NS_LITERAL_CSTRING("Profiles"));
++  if (NS_FAILED(rv)) {
++    return rv;
++  }
++
++  bool exists;
++  rv = localDir->Exists(&exists);
++  if (NS_SUCCEEDED(rv) && !exists) {
++    rv = localDir->Create(nsIFile::DIRECTORY_TYPE, 0775);
++  }
++  if (NS_FAILED(rv)) {
++    return rv;
++  }
++#endif
++
+   localDir.forget(aLocalFile);
+ 
+   return rv;
+-- 
+2.19.2
+

diff --git a/www-client/torbrowser/files/torbrowser-60.5.0-Do_not_store_data_in_the_app_bundle.patch b/www-client/torbrowser/files/torbrowser-60.5.0-Do_not_store_data_in_the_app_bundle.patch
new file mode 100644
index 0000000..a4e6ae9
--- /dev/null
+++ b/www-client/torbrowser/files/torbrowser-60.5.0-Do_not_store_data_in_the_app_bundle.patch
@@ -0,0 +1,189 @@
+From 0e4105afea7b10cf20ab20cb41b187d7d690ff46 Mon Sep 17 00:00:00 2001
+From: Poncho <poncho@spahan.ch>
+Date: Wed, 30 Jan 2019 09:55:25 +0100
+Subject: [PATCH 1/4] Revert "Bug 13252: Do not store data in the app bundle"
+
+This reverts commit 2ee4d81a2fbcac90996f4f4a99633a0b2d7019bb.
+---
+ toolkit/xre/nsXREDirProvider.cpp       | 43 ++++++++++++---------
+ toolkit/xre/nsXREDirProvider.h         |  6 ---
+ xpcom/io/nsAppFileLocationProvider.cpp | 53 +++++++++++++++-----------
+ 3 files changed, 55 insertions(+), 47 deletions(-)
+
+diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
+index d811da50b63d..dbbaffd2a15f 100644
+--- a/toolkit/xre/nsXREDirProvider.cpp
++++ b/toolkit/xre/nsXREDirProvider.cpp
+@@ -44,8 +44,6 @@
+ #include "mozilla/Preferences.h"
+ #include "mozilla/Telemetry.h"
+ 
+-#include "TorFileUtils.h"
+-
+ #include <stdlib.h>
+ 
+ #ifdef XP_WIN
+@@ -1337,18 +1335,34 @@ nsresult nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile,
+   NS_ENSURE_ARG_POINTER(aFile);
+   nsCOMPtr<nsIFile> localDir;
+ 
+-  nsresult rv = GetTorBrowserUserDataDir(getter_AddRefs(localDir));
++  nsresult rv = GetAppDir()->Clone(getter_AddRefs(localDir));
+   NS_ENSURE_SUCCESS(rv, rv);
+ 
+-#if !defined(ANDROID)
+-#ifdef TOR_BROWSER_DATA_OUTSIDE_APP_DIR
+-  rv = localDir->AppendNative(NS_LITERAL_CSTRING("Browser"));
+-#else
+-  rv = localDir->AppendRelativeNativePath(
+-      NS_LITERAL_CSTRING("Data" XPCOM_FILE_PATH_SEPARATOR "Browser"));
++  int levelsToRemove = 1;  // In FF21+, appDir points to browser subdirectory.
++#if defined(XP_MACOSX)
++  levelsToRemove += 2;
+ #endif
++  while (localDir && (levelsToRemove > 0)) {
++    // When crawling up the hierarchy, components named "." do not count.
++    nsAutoCString removedName;
++    rv = localDir->GetNativeLeafName(removedName);
++    NS_ENSURE_SUCCESS(rv, rv);
++    bool didRemove = !removedName.Equals(".");
++
++    // Remove a directory component.
++    nsCOMPtr<nsIFile> parentDir;
++    rv = localDir->GetParent(getter_AddRefs(parentDir));
++    NS_ENSURE_SUCCESS(rv, rv);
++    localDir = parentDir;
++    if (didRemove) --levelsToRemove;
++  }
++
++  if (!localDir) return NS_ERROR_FAILURE;
++
++  rv = localDir->AppendRelativeNativePath(
++      NS_LITERAL_CSTRING("TorBrowser" XPCOM_FILE_PATH_SEPARATOR
++                         "Data" XPCOM_FILE_PATH_SEPARATOR "Browser"));
+   NS_ENSURE_SUCCESS(rv, rv);
+-#endif
+ 
+   if (aLocal) {
+     rv = localDir->AppendNative(NS_LITERAL_CSTRING("Caches"));
+@@ -1433,15 +1447,6 @@ nsresult nsXREDirProvider::GetUserDataDirectory(nsIFile** aFile, bool aLocal) {
+   return NS_OK;
+ }
+ 
+-nsresult nsXREDirProvider::GetTorBrowserUserDataDir(nsIFile** aFile) {
+-  NS_ENSURE_ARG_POINTER(aFile);
+-  nsCOMPtr<nsIFile> exeFile;
+-  bool per = false;
+-  nsresult rv = GetFile(XRE_EXECUTABLE_FILE, &per, getter_AddRefs(exeFile));
+-  NS_ENSURE_SUCCESS(rv, rv);
+-  return TorBrowser_GetUserDataDir(exeFile, aFile);
+-}
+-
+ nsresult nsXREDirProvider::EnsureDirectoryExists(nsIFile* aDirectory) {
+   bool exists;
+   nsresult rv = aDirectory->Exists(&exists);
+diff --git a/toolkit/xre/nsXREDirProvider.h b/toolkit/xre/nsXREDirProvider.h
+index 6fe9d9ecbce5..6b92f3812882 100644
+--- a/toolkit/xre/nsXREDirProvider.h
++++ b/toolkit/xre/nsXREDirProvider.h
+@@ -87,12 +87,6 @@ class nsXREDirProvider final : public nsIDirectoryServiceProvider2,
+    */
+   nsresult GetProfileDir(nsIFile** aResult);
+ 
+-  /**
+-   * Get the TorBrowser user data directory by calling the
+-   * TorBrowser_GetUserDataDir() utility function.
+-   */
+-  nsresult GetTorBrowserUserDataDir(nsIFile** aFile);
+-
+  protected:
+   nsresult GetFilesInternal(const char* aProperty,
+                             nsISimpleEnumerator** aResult);
+diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocationProvider.cpp
+index 3906c6590090..2aa5482f5789 100644
+--- a/xpcom/io/nsAppFileLocationProvider.cpp
++++ b/xpcom/io/nsAppFileLocationProvider.cpp
+@@ -27,8 +27,6 @@
+ #include <sys/param.h>
+ #endif
+ 
+-#include "TorFileUtils.h"
+-
+ // WARNING: These hard coded names need to go away. They need to
+ // come from localizable resources
+ 
+@@ -250,14 +248,8 @@ nsresult nsAppFileLocationProvider::CloneMozBinDirectory(nsIFile** aLocalFile) {
+ // GetProductDirectory - Gets the directory which contains the application data
+ // folder
+ //
+-#ifdef TOR_BROWSER_DATA_OUTSIDE_APP_DIR
+-// UNIX and WIN   : <App Folder>/../TorBrowser-Data/Browser
+-// Mac            : <App Folder>/../../../TorBrowser-Data/Browser OR
+-//                  ~/Library/Application Support/TorBrowser-Data/Browser
+-#else
+ // UNIX and WIN   : <App Folder>/TorBrowser/Data/Browser
+ // Mac            : <App Folder>/../../TorBrowser/Data/Browser
+-#endif
+ //----------------------------------------------------------------------------------------
+ nsresult nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
+                                                         bool aLocal) {
+@@ -265,25 +257,42 @@ nsresult nsAppFileLocationProvider::GetProductDirectory(nsIFile** aLocalFile,
+     return NS_ERROR_INVALID_ARG;
+   }
+ 
+-  nsresult rv = NS_ERROR_UNEXPECTED;
++  nsresult rv;
+   bool exists;
+-  nsCOMPtr<nsIFile> localDir, exeFile;
++  nsCOMPtr<nsIFile> localDir;
+ 
+-  nsCOMPtr<nsIProperties> directoryService(
+-      do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID, &rv));
+-  NS_ENSURE_SUCCESS(rv, rv);
+-  rv = directoryService->Get(XRE_EXECUTABLE_FILE, NS_GET_IID(nsIFile),
+-                             getter_AddRefs(exeFile));
+-  NS_ENSURE_SUCCESS(rv, rv);
+-  rv = TorBrowser_GetUserDataDir(exeFile, getter_AddRefs(localDir));
++  rv = CloneMozBinDirectory(getter_AddRefs(localDir));
+   NS_ENSURE_SUCCESS(rv, rv);
+ 
+-#ifdef TOR_BROWSER_DATA_OUTSIDE_APP_DIR
+-  rv = localDir->AppendNative(NS_LITERAL_CSTRING("Browser"));
+-#else
+-  rv = localDir->AppendRelativeNativePath(
+-      NS_LITERAL_CSTRING("Data" XPCOM_FILE_PATH_SEPARATOR "Browser"));
++  int levelsToRemove = 1;  // In FF21+, bin dir points to browser subdirectory.
++#if defined(XP_MACOSX)
++  levelsToRemove += 2;
+ #endif
++  while (localDir && (levelsToRemove > 0)) {
++    // When crawling up the hierarchy, components named "." do not count.
++    nsAutoCString removedName;
++    rv = localDir->GetNativeLeafName(removedName);
++    NS_ENSURE_SUCCESS(rv, rv);
++    bool didRemove = !removedName.Equals(".");
++
++    // Remove a directory component.
++    nsCOMPtr<nsIFile> parentDir;
++    rv = localDir->GetParent(getter_AddRefs(parentDir));
++    NS_ENSURE_SUCCESS(rv, rv);
++    localDir = parentDir;
++
++    if (didRemove) {
++      --levelsToRemove;
++    }
++  }
++
++  if (!localDir) {
++    return NS_ERROR_FAILURE;
++  }
++
++  rv = localDir->AppendRelativeNativePath(
++      NS_LITERAL_CSTRING("TorBrowser" XPCOM_FILE_PATH_SEPARATOR
++                         "Data" XPCOM_FILE_PATH_SEPARATOR "Browser"));
+   NS_ENSURE_SUCCESS(rv, rv);
+ 
+   if (aLocal) {
+-- 
+2.19.2
+

diff --git a/www-client/torbrowser/files/torbrowser-60.5.0-nss-fixup-warnings.patch b/www-client/torbrowser/files/torbrowser-60.5.0-nss-fixup-warnings.patch
new file mode 100644
index 0000000..48289b0
--- /dev/null
+++ b/www-client/torbrowser/files/torbrowser-60.5.0-nss-fixup-warnings.patch
@@ -0,0 +1,25 @@
+From f749a3cc5fc0397e5f4c0948dd35beacac17e2d5 Mon Sep 17 00:00:00 2001
+From: Poncho <poncho@spahan.ch>
+Date: Sun, 16 Aug 2015 14:47:29 +0200
+Subject: [PATCH 4/4] security/nss/coreconf/Linux.mk: add -fno-strict-aliasing
+
+taken from nss-3.15-gentoo-fixup-warnings.patch
+---
+ security/nss/coreconf/Linux.mk | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/security/nss/coreconf/Linux.mk b/security/nss/coreconf/Linux.mk
+index bb9db413b411..43355237f98a 100644
+--- a/security/nss/coreconf/Linux.mk
++++ b/security/nss/coreconf/Linux.mk
+@@ -119,6 +119,7 @@ ifdef MOZ_DEBUG_SYMBOLS
+ 		OPTIMIZER += -gdwarf-2
+ 	endif
+ endif
++OPTIMIZER += -fno-strict-aliasing
+ endif
+ 
+ ifndef COMPILER_TAG
+-- 
+2.19.2
+

diff --git a/www-client/torbrowser/files/torbrowser-lto.patch b/www-client/torbrowser/files/torbrowser-lto.patch
deleted file mode 100644
index 2db67db..0000000
--- a/www-client/torbrowser/files/torbrowser-lto.patch
+++ /dev/null
@@ -1,32 +0,0 @@
---- a/security/sandbox/linux/moz.build
-+++ b/security/sandbox/linux/moz.build
-@@ -102,7 +102,12 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc')
- # gcc lto likes to put the top level asm in syscall.cc in a different partition
- # from the function using it which breaks the build.  Work around that by
- # forcing there to be only one partition.
--if '-flto' in CONFIG['OS_CXXFLAGS'] and CONFIG['CC_TYPE'] != 'clang':
-+lto=False
-+for f in CONFIG['OS_CXXFLAGS']:
-+    if f.startswith('-flto'):
-+        lto=True
-+        break
-+if lto and CONFIG['CC_TYPE'] != 'clang':
-     LDFLAGS += ['--lto-partition=one']
- 
- if CONFIG['MOZ_ALSA']:
---- a/build/unix/elfhack/moz.build
-+++ b/build/unix/elfhack/moz.build
-@@ -14,7 +14,12 @@ if not CONFIG['CROSS_COMPILE']:
-         'test-ctors.c',
-     ]
- 
--    if '-flto' in CONFIG['OS_CFLAGS']:
-+    lto=False
-+    for f in CONFIG['OS_CFLAGS']:
-+        if f.startswith('-flto'):
-+            lto=True
-+            break
-+    if lto:
-         SOURCES['test-array.c'].flags += ['-fno-lto']
-         SOURCES['test-ctors.c'].flags += ['-fno-lto']
- 

diff --git a/www-client/torbrowser/files/torbrowser-profiledir.patch b/www-client/torbrowser/files/torbrowser-profiledir.patch
deleted file mode 100644
index bec2495..0000000
--- a/www-client/torbrowser/files/torbrowser-profiledir.patch
+++ /dev/null
@@ -1,44 +0,0 @@
---- a/xpcom/io/TorFileUtils.cpp
-+++ b/xpcom/io/TorFileUtils.cpp
-@@ -81,7 +81,7 @@
-   }
- #endif
- 
--#elif defined(ANDROID)
-+#elif defined(ANDROID) || defined(TOR_BROWSER_DATA_IN_HOME_DIR)
-   // Orfox stores data in the app home directory.
-   const char* homeDir = getenv("HOME");
-   if (!homeDir || !*homeDir)
---- a/toolkit/xre/nsXREDirProvider.cpp
-+++ b/toolkit/xre/nsXREDirProvider.cpp
-@@ -1283,6 +1283,9 @@
- #if !defined(ANDROID)
- #ifdef TOR_BROWSER_DATA_OUTSIDE_APP_DIR
-   rv = localDir->AppendNative(NS_LITERAL_CSTRING("Browser"));
-+#elif defined(TOR_BROWSER_DATA_IN_HOME_DIR)
-+  rv = localDir->AppendRelativeNativePath(NS_LITERAL_CSTRING(MOZ_USER_DIR
-+                                        XPCOM_FILE_PATH_SEPARATOR "torbrowser"));
- #else
-   rv = localDir->AppendRelativeNativePath(NS_LITERAL_CSTRING("Data"
-                                      XPCOM_FILE_PATH_SEPARATOR "Browser"));
-@@ -1291,7 +1294,20 @@
- #endif
- 
-   if (aLocal) {
-+#ifndef TOR_BROWSER_DATA_IN_HOME_DIR
-     rv = localDir->AppendNative(NS_LITERAL_CSTRING("Caches"));
-+#else
-+    const char* cacheHome = getenv("XDG_CACHE_HOME");
-+    if (cacheHome && *cacheHome) {
-+      rv = NS_NewNativeLocalFile(nsDependentCString(cacheHome), true,
-+                                 getter_AddRefs(localDir));
-+    } else {
-+      rv = NS_NewNativeLocalFile(nsDependentCString(PR_GetEnv("HOME")), true,
-+                                 getter_AddRefs(localDir));
-+      rv = localDir->AppendRelativeNativePath(NS_LITERAL_CSTRING(".cache"));
-+    }
-+    rv = localDir->AppendRelativeNativePath(NS_LITERAL_CSTRING("torbrowser"));
-+#endif
-     NS_ENSURE_SUCCESS(rv, rv);
-   }
- 

diff --git a/www-client/torbrowser/files/torbrowser-rust_missing_docs.patch b/www-client/torbrowser/files/torbrowser-rust_missing_docs.patch
deleted file mode 100644
index 6b38618..0000000
--- a/www-client/torbrowser/files/torbrowser-rust_missing_docs.patch
+++ /dev/null
@@ -1,21 +0,0 @@
---- a/servo/components/style_traits/lib.rs
-+++ b/servo/components/style_traits/lib.rs
-@@ -9,7 +9,7 @@
- #![crate_name = "style_traits"]
- #![crate_type = "rlib"]
- 
--#![deny(unsafe_code, missing_docs)]
-+#![deny(unsafe_code)]
- 
- extern crate app_units;
- #[macro_use] extern crate bitflags;
---- a/servo/components/style/lib.rs
-+++ b/servo/components/style/lib.rs
-@@ -23,7 +23,6 @@
- //! [cssparser]: ../cssparser/index.html
- //! [selectors]: ../selectors/index.html
- 
--#![deny(missing_docs)]
- 
- extern crate app_units;
- extern crate arrayvec;

diff --git a/www-client/torbrowser/torbrowser-60.6.1.8.0.8.1.1.ebuild b/www-client/torbrowser/torbrowser-60.6.1.8.0.8.1.1-r1.ebuild
similarity index 77%
rename from www-client/torbrowser/torbrowser-60.6.1.8.0.8.1.1.ebuild
rename to www-client/torbrowser/torbrowser-60.6.1.8.0.8.1.1-r1.ebuild
index 9034134..0690db2 100644
--- a/www-client/torbrowser/torbrowser-60.6.1.8.0.8.1.1.ebuild
+++ b/www-client/torbrowser/torbrowser-60.6.1.8.0.8.1.1-r1.ebuild
@@ -29,9 +29,8 @@ GIT_TAG="tor-browser-${MOZ_PV}-$(ver_rs 3 '-build' ${GIT_TAG})"
 
 DESCRIPTION="The Tor Browser"
 HOMEPAGE="
-https://www.torproject.org/projects/torbrowser.html
-https://gitweb.torproject.org/tor-browser.git
-"
+	https://www.torproject.org/projects/torbrowser.html
+	https://gitweb.torproject.org/tor-browser.git"
 
 SLOT="0"
 # BSD license applies to torproject-related code like the patches
@@ -39,8 +38,8 @@ SLOT="0"
 LICENSE="BSD CC-BY-3.0 MPL-2.0 GPL-2 LGPL-2.1"
 IUSE="hardened hwaccel jack -screenshot selinux test"
 
-SRC_URI="mirror://tor/dist/${PN}/${TOR_PV}"
-PATCH="firefox-${PV%%.*}.6-patches-01"
+SRC_URI="mirror://tor/${PN}/${TOR_PV}"
+PATCH="firefox-${PV%%.*}.6-patches-05"
 PATCH=( https://dev.gentoo.org/~{anarchy,axs,polynomial-c}/mozilla/patchsets/${PATCH}.tar.xz )
 SRC_URI="
 	https://gitweb.torproject.org/tor-browser.git/snapshot/${GIT_TAG}.tar.gz
@@ -55,28 +54,24 @@ SRC_URI="
 "
 RESTRICT="primaryuri"
 
+ASM_DEPEND=">=dev-lang/yasm-1.1"
+
 RDEPEND="
+	>=net-vpn/tor-0.3.3.9
 	system-icu? ( >=dev-libs/icu-60.2 )
 	jack? ( virtual/jack )
-	selinux? ( sec-policy/selinux-mozilla )
-"
+	selinux? ( sec-policy/selinux-mozilla )"
+
 DEPEND="
 	${RDEPEND}
-	>=sys-devel/llvm-4.0.1
-	>=sys-devel/clang-4.0.1
-	>=dev-lang/yasm-1.1
-	virtual/opengl
-"
-RDEPEND="
-	${RDEPEND}
-	>=net-vpn/tor-0.3.3.9
-"
+	amd64? ( ${ASM_DEPEND} virtual/opengl )
+	x86? ( ${ASM_DEPEND} virtual/opengl )"
 
 S="${WORKDIR}/${GIT_TAG}"
 
-QA_PRESTRIPPED="usr/lib*/${PN}/${PN}/${PN}"
+QA_PRESTRIPPED="usr/lib*/${PN}/${PN}"
 
-BUILD_OBJ_DIR="${WORKDIR}/tb"
+BUILD_OBJ_DIR="${WORKDIR}/torb"
 
 llvm_check_deps() {
 	if ! has_version "sys-devel/clang:${LLVM_SLOT}" ; then
@@ -106,9 +101,6 @@ pkg_setup() {
 		XDG_SESSION_COOKIE \
 		XAUTHORITY
 
-	append-cppflags "-DTOR_BROWSER_DATA_IN_HOME_DIR"
-	MOZILLA_FIVE_HOME="/usr/$(get_libdir)/${PN}/${PN}"
-
 	addpredict /proc/self/oom_score_adj
 
 	llvm_pkg_setup
@@ -124,14 +116,14 @@ pkg_pretend() {
 src_prepare() {
 	local PATCHES=(
 		"${WORKDIR}"/firefox
-		"${FILESDIR}"/${PN}-profiledir.patch
-		"${FILESDIR}"/${PN}-lto.patch
-		"${FILESDIR}"/${PN}-rust_missing_docs.patch
-	)
 
-	sed \
-		-e '/Unknown option: %s/ s:raise InvalidOptionError:print:' \
-		-i python/mozbuild/mozbuild/configure/__init__.py
+		# Revert "Change the default Firefox profile directory to be TBB-relative"
+		"${FILESDIR}"/torbrowser-60.5.0-Do_not_store_data_in_the_app_bundle.patch
+		"${FILESDIR}"/torbrowser-60.5.0-Change_the_default_Firefox_profile_directory.patch
+
+		# FIXME: prevent warnings in bundled nss
+		"${FILESDIR}"/torbrowser-60.5.0-nss-fixup-warnings.patch
+	)
 
 	# Enable gnomebreakpad
 	if use debug ; then
@@ -224,25 +216,37 @@ src_configure() {
 	fi
 
 	echo "mk_add_options MOZ_OBJDIR=${BUILD_OBJ_DIR}" >> "${S}"/.mozconfig
-	echo "mk_add_options XARGS=/usr/bin/xargs" >> "${S}"/.mozconfig
-
-	# Default mozilla_five_home no longer valid option
-	sed '/with-default-mozilla-five-home=/d' -i "${S}"/.mozconfig
-	# Rename the install directory and the executable
-	mozconfig_annotate 'torbrowser' --libdir="${EPREFIX}"/usr/$(get_libdir)/${PN}
-	mozconfig_annotate 'torbrowser' --with-app-name=${PN}
-	mozconfig_annotate 'torbrowser' --with-app-basename=${PN}
-	mozconfig_annotate 'torbrowser' --disable-tor-browser-update
-	mozconfig_annotate 'torbrowser' --with-tor-browser-version=${TOR_PV}
-	mozconfig_annotate 'torbrowser' --disable-tor-browser-data-outside-app-dir
-	mozconfig_annotate 'torbrowser' --with-branding=browser/branding/official
-	mozconfig_annotate 'torbrowser' --disable-maintenance-service
+	echo "mk_add_options XARGS="${EPREFIX}"/usr/bin/xargs" >> "${S}"/.mozconfig
+
+	# Use .mozconfig settings from torbrowser (setting this here since it gets overwritten by mozcoreconf-v6.eclass)
+	# see https://gitweb.torproject.org/tor-browser.git/tree/.mozconfig?h=tor-browser-60.2.0esr-8.0-1
+	echo "mk_add_options MOZ_APP_DISPLAYNAME=\"Tor Browser\"" >> "${S}"/.mozconfig
+	echo "mk_add_options MOZILLA_OFFICIAL=1" >> "${S}"/.mozconfig
+	echo "mk_add_options BUILD_OFFICIAL=1" >> "${S}"/.mozconfig
+	mozconfig_annotate 'torbrowser' --enable-official-branding
 	mozconfig_annotate 'torbrowser' --disable-webrtc
 	mozconfig_annotate 'torbrowser' --disable-eme
+	mozconfig_annotate 'torbrowser' --enable-proxy-bypass-protection
+
+	# Rename the binary and set the profile location
+	mozconfig_annotate 'torbrowser' --with-app-name="${PN}"
+	mozconfig_annotate 'torbrowser' --with-app-basename="${PN}"
 
+	# see https://gitweb.torproject.org/tor-browser.git/tree/old-configure.in?h=tor-browser-60.2.0esr-8.0-1#n3205
+	mozconfig_annotate 'torbrowser' --with-tor-browser-version="${TOR_PV}"
+	mozconfig_annotate 'torbrowser' --disable-tor-browser-update
+
+	# torbrowser uses a patched nss library
+	# see https://gitweb.torproject.org/tor-browser.git/log/security/nss?h=tor-browser-60.2.0esr-8.0-1-build1
 	mozconfig_annotate 'torbrowser' --without-system-nspr
 	mozconfig_annotate 'torbrowser' --without-system-nss
 
+	echo "mk_add_options MOZ_OBJDIR=${BUILD_OBJ_DIR}" >> "${S}"/.mozconfig
+	echo "mk_add_options XARGS="${EPREFIX}"/usr/bin/xargs" >> "${S}"/.mozconfig
+
+	# Default mozilla_five_home no longer valid option
+	sed '/with-default-mozilla-five-home=/d' -i "${S}"/.mozconfig
+
 	# Finalize and report settings
 	mozconfig_final
 
@@ -253,16 +257,12 @@ src_configure() {
 
 src_compile() {
 	MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX}/bin/bash}" MOZ_NOSPAM=1 \
-	BUILD_VERBOSE_LOG=1 \
 	./mach build --verbose || die
 }
 
 src_install() {
-	local profile_dir="${WORKDIR}/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.default"
 	cd "${BUILD_OBJ_DIR}" || die
-
-	cat "${profile_dir}"/bookmarks.html > \
-		dist/bin/browser/chrome/en-US/locale/browser/bookmarks.html
+	export LD_LIBRARY_PATH="${BUILD_OBJ_DIR}/dist/bin"
 
 	# Pax mark xpcshell for hardened support, only used for startupcache creation.
 	pax-mark m "${BUILD_OBJ_DIR}"/dist/bin/xpcshell
@@ -287,10 +287,7 @@ src_install() {
 			|| die
 	fi
 
-	sed -e '/extensions\.autoDisableScopes/s:\<0\>:3:' \
-		-i "${BUILD_OBJ_DIR}"/dist/bin/browser/defaults/preferences/000-tor-browser.js \
-		|| die
-
+	# Must ensure we use bundled nss/nspr during signing and not system
 	cd "${S}"
 	MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL:-${EPREFIX}/bin/bash}" MOZ_NOSPAM=1 \
 	DESTDIR="${D}" ./mach install || die
@@ -311,18 +308,22 @@ src_install() {
 	fi
 
 	# Required in order to use plugins and even run torbrowser on hardened.
-	pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/{${PN},${PN}-bin,plugin-container}
+	pax-mark m "${ED}"${MOZILLA_FIVE_HOME}/{${PN},plugin-container}
 
-	# Profile without the tor-launcher extension
-	# see: https://trac.torproject.org/projects/tor/ticket/10160
-
-	rm "${profile_dir}/extensions/tor-launcher@torproject.org.xpi" || die \
-		"Failed to remove torlauncher extension"
+	# Profile with settings and extensions
+	insinto ${MOZILLA_FIVE_HOME}/defaults/profile
+	doins -r "${WORKDIR}"/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.default/{extensions,bookmarks.html}
 
-	insinto ${MOZILLA_FIVE_HOME}/browser
-	doins -r "${profile_dir}"/extensions
+	# see: https://trac.torproject.org/projects/tor/ticket/11751#comment:2
+	# see: https://github.com/Whonix/anon-ws-disable-stacked-tor/blob/master/usr/lib/anon-ws-disable-stacked-tor/torbrowser.sh
+	dodoc "${FILESDIR}/99torbrowser.example"
 
 	dodoc "${WORKDIR}/tor-browser_en-US/Browser/TorBrowser/Docs/ChangeLog.txt"
+
+	# Profile without the tor-launcher extension
+	# see: https://trac.torproject.org/projects/tor/ticket/10160
+	rm "${MOZILLA_FIVE_HOME}/defaults/profile/extensions/tor-launcher@torproject.org.xpi" || die \
+		"Failed to remove torlauncher extension"
 }
 
 pkg_preinst() {


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-04-18 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-18  4:41 [gentoo-commits] proj/mozilla:master commit in: www-client/torbrowser/files/, www-client/torbrowser/ Jory Pratt
  -- strict thread matches above, loose matches on Subject: below --
2019-04-18 10:55 Jory Pratt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox