torbrowser: from torbrowser-overlay, linguas_de added

This commit is contained in:
Jörg Deckert 2015-03-05 11:11:34 +01:00
parent 45cbd9092f
commit 1abf90bc07
7 changed files with 1200 additions and 0 deletions

View File

@ -0,0 +1,72 @@
--- torbrowser-31.5.0.orig.ebuild 2015-03-01 13:50:00.000000000 +0100
+++ torbrowser-31.5.0.ebuild 2015-03-05 09:32:28.546289664 +0100
@@ -33,14 +33,21 @@
# 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"
+IUSE="hardened test linguas_de"
BASE_SRC_URI="https://dist.torproject.org/${PN}/${TOR_PV}"
SRC_URI="https://gitweb.torproject.org/tor-browser.git/snapshot/${GIT_TAG}.tar.gz -> ${GIT_TAG}.tar.gz
http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.xz
http://dev.gentoo.org/~axs/distfiles/${PATCH}.tar.xz
- x86? ( ${BASE_SRC_URI}/tor-browser-linux32-${TOR_PV}_en-US.tar.xz )
- amd64? ( ${BASE_SRC_URI}/tor-browser-linux64-${TOR_PV}_en-US.tar.xz )"
+ !linguas_de? (
+ x86? ( ${BASE_SRC_URI}/tor-browser-linux32-${TOR_PV}_en-US.tar.xz )
+ amd64? ( ${BASE_SRC_URI}/tor-browser-linux64-${TOR_PV}_en-US.tar.xz )
+ )
+ linguas_de? (
+ x86? ( ${BASE_SRC_URI}/tor-browser-linux32-${TOR_PV}_de.tar.xz )
+ amd64? ( ${BASE_SRC_URI}/tor-browser-linux64-${TOR_PV}_de.tar.xz )
+ )
+"
ASM_DEPEND=">=dev-lang/yasm-1.1"
@@ -219,9 +226,15 @@
|| die
# see: https://gitweb.torproject.org/builders/tor-browser-bundle.git/tree/gitian/descriptors/linux/gitian-bundle.yml?h=maint-4.0#n148
- echo "pref(\"general.useragent.locale\", \"en-US\");" \
- >> "${S}/${obj_dir}/dist/bin/browser/defaults/preferences/000-tor-browser.js" \
- || die
+ if use linguas_de ; then
+ echo "pref(\"general.useragent.locale\", \"de\");" \
+ >> "${S}/${obj_dir}/dist/bin/browser/defaults/preferences/000-tor-browser.js" \
+ || die
+ else
+ echo "pref(\"general.useragent.locale\", \"en-US\");" \
+ >> "${S}/${obj_dir}/dist/bin/browser/defaults/preferences/000-tor-browser.js" \
+ || die
+ fi
MOZ_MAKE_FLAGS="${MAKEOPTS}" \
emake DESTDIR="${D}" install
@@ -260,7 +273,11 @@
# 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"
+ if use linguas_de ; then
+ local profile_dir="${WORKDIR}/tor-browser_de/Browser/TorBrowser/Data/Browser/profile.default"
+ else
+ local profile_dir="${WORKDIR}/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.default"
+ fi
docompress -x "${EROOT}/usr/share/doc/${PF}/tor-launcher@torproject.org.xpi"
dodoc "${profile_dir}/extensions/tor-launcher@torproject.org.xpi"
@@ -276,7 +293,11 @@
# see: https://gitweb.torproject.org/builders/tor-browser-bundle.git/tree/RelativeLink/RelativeLink.sh?h=maint-4.0#n248
dodoc "${FILESDIR}/README.tor-launcher"
- dodoc "${WORKDIR}/tor-browser_en-US/Browser/TorBrowser/Docs/ChangeLog.txt"
+ if use linguas_de ; then
+ dodoc "${WORKDIR}/tor-browser_de/Browser/TorBrowser/Docs/ChangeLog.txt"
+ else
+ dodoc "${WORKDIR}/tor-browser_en-US/Browser/TorBrowser/Docs/ChangeLog.txt"
+ fi
}
pkg_preinst() {

View File

@ -0,0 +1,10 @@
AUX README.tor-launcher 1594 SHA256 f344dd89d39a7330eb8303f80e89d9a015b3b70e4bc52649e0c8c1cde52a5ec6 SHA512 9faeba83e0910438e9267a203c50d60f69860ab8765b3a6b1f38c153e3578645daf196133923597d2d8b00228b884250b0fb0cc5020978b22386510c6e6559b1 WHIRLPOOL c7d0e9fa5b390d308524f5ac41249acbe6c612ac01ec960e1152c14dd1de1d520c1b52948315995df82a0a524dbcf4371b0466841acd6471c52a5baa8d9aac4b
AUX tor-browser.git-bccc144c21f6069a294038a6559ba46ceb8da2a2.patch 15904 SHA256 890f5b981533541f091ae9c159623107c823804a13afd421e39b664873dc7d65 SHA512 1d7b1633c2424dcfb24ea84ae443c04578ed55dd539b9a606fd98033027e8eba0c743e198db385f6e3a27e4676d5f4d0830f050d8ba1fb1dec50652f26e4f715 WHIRLPOOL f8cedc44db5e80b532e1db351a1438c96f7ed8e84799ed84084d275757fe40c20399d37d7a73e376875590482d2235024c1ac99e4ee31e726d17bd7a5c38213b
AUX torbrowser-24.3.0-allow-lightspark.patch 615 SHA256 904a090199d82d3fea3f96c2e077a08ea7e28ef46a4f4d1e7e6da936b08bafd1 SHA512 35772c3c716fe5004d3306591b9ab1612a78644cb272de473fbf0da91a19075e6a166bb97a8365065828de829dc3b68618a31820f3b0eb7399e2bfe008f797d8 WHIRLPOOL 75ed0e691d9bfb877a368b0946f3cf8007e3201456a47e6d2ddd9b3d295cf782347a8cac45f63242d1bf6cea3a1acdead3b9494d26f52387253fe490be6a598d
DIST firefox-31.0-patches-0.2.tar.xz 4636 SHA256 fdcd4e68093fb905af06cd89aad7042f8a4e695dea9c184351945fcb5872a062 SHA512 2fee84ac6027a1e1317470112df54fef411596a522bca756f82c525b13ba952015e71f2aa05a807fec04c3bd092e8cbebd0c2349e0dc4950b329a88811b00151 WHIRLPOOL 59dc5f3457dc2a0c0c83a0128063da00d127cee13487b112064368de7d98438b7ffeb1dfe362080eca6a82af4834f3e27c6bd887e51b5d59c728ae124b26114d
DIST tor-browser-31.5.0esr-4.0-1-build1.tar.gz 170142149 SHA256 75c39110209cb20d9b83782114edbf3d94e77fa4bf9c2ef0b79ebe8bc6100375 SHA512 d9b692cd5678ea96c3b62f630017057c07a9976fb11102d9f1bb489cf495e6ab890ebc36b756e6efc39b1837804c32efa72c76621bbad563ecb9954bcd61771b WHIRLPOOL d9432bb1dee8e39ba8bdaac252315f83d645cf2374789b2f7eb3f4453bb87b5a67422c3e6f92a81c007db17f6f9069e7f9023051073123c07178fc3fca3e9b5b
DIST tor-browser-linux32-4.0.4_de.tar.xz 43232372 SHA256 954f630c426d3961253d99913926422c62804b9ed058e38ba39e622c670bc9f4 SHA512 1c16dbcf5faefafb9c3b5a93ca8fc85d1a6cdada233cd96ac63f96c110db188e39ee96ca822a8dde1e778fd748dc6a8741f27c698e136606da88c0e01bccaf56 WHIRLPOOL b2a49f38f965708956bd3a32f4a3d1e08d9cf87647bad49c2a62b090fc4923990977f5da1adfa612de7a67356ab17e0b4761836a75e61ebf4b1f88b6f9c9a4dc
DIST tor-browser-linux32-4.0.4_en-US.tar.xz 42884008 SHA256 f527b85a057ae402fa1dc84e6c175071e6448300cd2ebdd0d50494e1dd605185 SHA512 f5846b01d9b6bcac69c188bdb1d2d2fade86aec37c9f2216a6efcb8e95286cee9558acb5d2acf8fb1d36c11540ab460c3159d7f66f36d386d4c5e47e1da4fe16 WHIRLPOOL ae293d1fa156058b0f475c230723d8b3a7844ba50c98e3a21e0251d2e634802fde8facb56e28c8168e023d33dc75278e8421429de42bf9b7e8b06db8dd659e8c
DIST tor-browser-linux64-4.0.4_de.tar.xz 42429892 SHA256 58942a6979ef817f6a645eeb6e1be869b4793ea64f59aec989de88fdae7b44ba SHA512 5d3341d82a15b1e65ef0160e358eadca239764c90e6b3d8b0526cbc97f20d3df1d359219791e33fb976c7d11a2ade2c4e529abed658c5dacb10ceed8ae01e294 WHIRLPOOL 61d82917e9a86ec1eaade3aa8abe6e6e401d53407cd61d061b11b8d84bcd39e149038edc1ea4788f64148c7f58cf6502addba900049ffb45ad88abd524dee411
DIST tor-browser-linux64-4.0.4_en-US.tar.xz 42068548 SHA256 0f0a07905daaf714322bc54cf25ed0e3b8ef91aeb937ab0df2d39010c9ee7b82 SHA512 8dbed4d037ad4927811089ce05c0411c71d6f7fb6614d9131a4554c00630a397b9c88ea31c0389ffb813297ed77a69ed158a2cc5186a7df8b0d8728b35e480ba WHIRLPOOL 40f93d1fb610095dd8762ffb41d5d989d5e357c7ddb8dd8a07b3dd87962988e25fe07de8fa5bbe995f8ca2f368f395dd6a0e0bcb12a43fe4a8cd8f48feeb51b2
EBUILD torbrowser-31.5.0.ebuild 10670 SHA256 c27eccf48212314d182c47a19fce7bef3e1f3535ed59414b7d9aa5f7bdea5daa SHA512 2f7891db7e8cc613a240c9491c151ee5cefe56f2a37f9c9e55601b041d345c3fa071d68efb006700c265a9a4cd0c0bad0bc0a427035d92d31843a8c0b29d72f7 WHIRLPOOL abc0eb3003b4e22a0d9a0df1a663b1f944e8ae5a2f0657b54b824b5cb9c42c307606efb157d18cdb5729a5c522ed3a219233c4c75e4696efabc36f6c6aec0dd1

View File

@ -0,0 +1,37 @@
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 TorButtom to authenticate to Tor's ControlPort, and
is necessary for using TBB with a 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
extensions.torbutton.banned_ports [...],<SocksPort>,<ControlPort>
extensions.torbutton.block_disk false
extensions.torbutton.custom.socks_host 127.0.0.1
extensions.torbutton.custom.socks_port <SocksPort>
extensions.torbutton.inserted_button true
extensions.torbutton.launch_warning false
extensions.torbutton.loglevel 2
extensions.torbutton.logmethod 0
extensions.torbutton.settings_method custom
extensions.torbutton.socks_port <SocksPort>
extensions.torbutton.use_privoxy false
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".

View File

@ -0,0 +1,430 @@
From bccc144c21f6069a294038a6559ba46ceb8da2a2 Mon Sep 17 00:00:00 2001
From: Kathy Brade <brade@pearlcrescent.com>
Date: Fri, 18 Oct 2013 15:20:06 -0400
Subject: [PATCH] Bug #9173: Change the default Firefox profile directory to
be TBB-relative.
This should eliminate our need to rely on a wrapper script that sets $HOME and
launches Firefox with -profile.
---
toolkit/xre/nsXREDirProvider.cpp | 153 +++++++-------------------------
toolkit/xre/nsXREDirProvider.h | 10 +--
xpcom/io/moz.build | 4 +
xpcom/io/nsAppFileLocationProvider.cpp | 81 ++++++++---------
4 files changed, 81 insertions(+), 167 deletions(-)
diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
index 88a4348..4835541 100644
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -30,6 +30,7 @@
#include "nsArrayEnumerator.h"
#include "nsEnumeratorUtils.h"
#include "nsReadableUtils.h"
+#include "nsXPCOMPrivate.h" // for XPCOM_FILE_PATH_SEPARATOR
#include "mozilla/Services.h"
#include "mozilla/Omnijar.h"
#include "mozilla/Preferences.h"
@@ -188,9 +189,6 @@ nsXREDirProvider::GetUserProfilesRootDir(nsIFile** aResult,
aProfileName, aAppName, aVendorName);
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)) {
@@ -213,9 +211,6 @@ nsXREDirProvider::GetUserProfilesLocalDir(nsIFile** aResult,
aProfileName, aAppName, aVendorName);
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)) {
@@ -1143,82 +1138,45 @@ nsresult
nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal)
{
// Copied from nsAppFileLocationProvider (more or less)
- nsresult rv;
+ NS_ENSURE_ARG_POINTER(aFile);
nsCOMPtr<nsIFile> localDir;
-#if defined(XP_MACOSX)
- FSRef fsRef;
- OSType folderType;
- if (aLocal) {
- folderType = kCachedDataFolderType;
- } else {
-#ifdef MOZ_THUNDERBIRD
- folderType = kDomainLibraryFolderType;
-#else
- folderType = kApplicationSupportFolderType;
-#endif
- }
- OSErr err = ::FSFindFolder(kUserDomain, folderType, kCreateFolder, &fsRef);
- NS_ENSURE_FALSE(err, NS_ERROR_FAILURE);
-
- rv = NS_NewNativeLocalFile(EmptyCString(), true, getter_AddRefs(localDir));
+ nsresult rv = GetAppDir()->Clone(getter_AddRefs(localDir));
NS_ENSURE_SUCCESS(rv, rv);
- nsCOMPtr<nsILocalFileMac> dirFileMac = do_QueryInterface(localDir);
- NS_ENSURE_TRUE(dirFileMac, NS_ERROR_UNEXPECTED);
+ 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(".");
- rv = dirFileMac->InitWithFSRef(&fsRef);
- NS_ENSURE_SUCCESS(rv, rv);
+ // Remove a directory component.
+ nsCOMPtr<nsIFile> parentDir;
+ rv = localDir->GetParent(getter_AddRefs(parentDir));
+ NS_ENSURE_SUCCESS(rv, rv);
+ localDir = parentDir;
- localDir = do_QueryInterface(dirFileMac, &rv);
-#elif defined(XP_WIN)
- nsString path;
- if (aLocal) {
- rv = GetShellFolderPath(CSIDL_LOCAL_APPDATA, path);
- if (NS_FAILED(rv))
- rv = GetRegWindowsAppDataFolder(aLocal, path);
+ if (didRemove)
+ --levelsToRemove;
}
- if (!aLocal || NS_FAILED(rv)) {
- rv = GetShellFolderPath(CSIDL_APPDATA, 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(MOZ_WIDGET_GONK)
- rv = NS_NewNativeLocalFile(NS_LITERAL_CSTRING("/data/b2g"), true,
- getter_AddRefs(localDir));
-#elif defined(XP_UNIX)
- const char* homeDir = getenv("HOME");
- if (!homeDir || !*homeDir)
+ if (!localDir)
return NS_ERROR_FAILURE;
-#ifdef ANDROID /* We want (ProfD == ProfLD) on Android. */
- aLocal = false;
-#endif
+ rv = localDir->AppendRelativeNativePath(NS_LITERAL_CSTRING("TorBrowser"
+ XPCOM_FILE_PATH_SEPARATOR "Data"
+ XPCOM_FILE_PATH_SEPARATOR "Browser"));
+ NS_ENSURE_SUCCESS(rv, rv);
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));
+ rv = localDir->AppendNative(NS_LITERAL_CSTRING("Caches"));
+ NS_ENSURE_SUCCESS(rv, rv);
}
-#else
-#error "Don't know how to get product dir on your platform"
-#endif
NS_IF_ADDREF(*aFile = localDir);
return rv;
@@ -1431,48 +1389,25 @@ nsXREDirProvider::AppendProfilePath(nsIFile* aFile,
}
nsAutoCString profile;
- nsAutoCString appName;
- nsAutoCString vendor;
if (aProfileName && !aProfileName->IsEmpty()) {
profile = *aProfileName;
- } else if (aAppName) {
- appName = *aAppName;
- if (aVendorName) {
- vendor = *aVendorName;
- }
} else if (gAppData->profile) {
profile = gAppData->profile;
- } else {
- appName = gAppData->name;
- vendor = gAppData->vendor;
}
- nsresult rv;
+ nsresult rv = NS_ERROR_FAILURE;
#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
@@ -1484,12 +1419,6 @@ nsXREDirProvider::AppendProfilePath(nsIFile* aFile,
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();
@@ -1498,31 +1427,17 @@ nsXREDirProvider::AppendProfilePath(nsIFile* aFile,
// On the off chance that someone wanted their folder to be hidden don't
// let it become ".."
- if (*profileStart == '.' && !aLocal)
+ if (*profileStart == '.')
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 4a9f9a0..054075c 100644
--- a/toolkit/xre/nsXREDirProvider.h
+++ b/toolkit/xre/nsXREDirProvider.h
@@ -56,16 +56,16 @@ public:
nsresult GetProfileDefaultsDir(nsIFile* *aResult);
- static nsresult GetUserAppDataDirectory(nsIFile* *aFile) {
+ nsresult GetUserAppDataDirectory(nsIFile* *aFile) {
return GetUserDataDirectory(aFile, false, nullptr, nullptr, nullptr);
}
- static nsresult GetUserLocalDataDirectory(nsIFile* *aFile) {
+ nsresult GetUserLocalDataDirectory(nsIFile* *aFile) {
return GetUserDataDirectory(aFile, true, nullptr, nullptr, nullptr);
}
// By default GetUserDataDirectory gets profile path from gAppData,
// but that can be overridden by using aProfileName/aAppName/aVendorName.
- static nsresult GetUserDataDirectory(nsIFile** aFile, bool aLocal,
+ nsresult GetUserDataDirectory(nsIFile** aFile, bool aLocal,
const nsACString* aProfileName,
const nsACString* aAppName,
const nsACString* aVendorName);
@@ -101,8 +101,8 @@ public:
protected:
nsresult GetFilesInternal(const char* aProperty, nsISimpleEnumerator** aResult);
- static nsresult GetUserDataDirectoryHome(nsIFile* *aFile, bool aLocal);
- static nsresult GetSysUserExtensionsDirectory(nsIFile* *aFile);
+ nsresult GetUserDataDirectoryHome(nsIFile* *aFile, bool aLocal);
+ nsresult GetSysUserExtensionsDirectory(nsIFile* *aFile);
#if defined(XP_UNIX) || defined(XP_MACOSX)
static nsresult GetSystemExtensionsDirectory(nsIFile** aFile);
#endif
diff --git a/xpcom/io/moz.build b/xpcom/io/moz.build
index cc467f9..609068b 100644
--- a/xpcom/io/moz.build
+++ b/xpcom/io/moz.build
@@ -126,4 +126,8 @@ FINAL_LIBRARY = 'xpcom_core'
if CONFIG['OS_ARCH'] == 'Linux' and 'lib64' in CONFIG['libdir']:
DEFINES['HAVE_USR_LIB64_DIR'] = True
+LOCAL_INCLUDES += [
+ '../build'
+]
+
GENERATED_INCLUDES += ['..']
diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocationProvider.cpp
index 1a38589..83f9836 100644
--- a/xpcom/io/nsAppFileLocationProvider.cpp
+++ b/xpcom/io/nsAppFileLocationProvider.cpp
@@ -13,6 +13,7 @@
#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>
@@ -284,9 +285,8 @@ NS_METHOD nsAppFileLocationProvider::CloneMozBinDirectory(nsIFile **aLocalFile)
//----------------------------------------------------------------------------------------
// GetProductDirectory - Gets the directory which contains the application data folder
//
-// UNIX : ~/.mozilla/
-// WIN : <Application Data folder on user's machine>\Mozilla
-// Mac : :Documents:Mozilla:
+// UNIX and WIN : <App Folder>/TorBrowser/Data/Browser
+// Mac : <App Folder>/../../TorBrowser/Data/Browser
//----------------------------------------------------------------------------------------
NS_METHOD nsAppFileLocationProvider::GetProductDirectory(nsIFile **aLocalFile, bool aLocal)
{
@@ -297,32 +297,43 @@ NS_METHOD nsAppFileLocationProvider::GetProductDirectory(nsIFile **aLocalFile, b
bool exists;
nsCOMPtr<nsIFile> localDir;
-#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;
- 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
+ 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 (!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);
+ }
- rv = localDir->AppendRelativeNativePath(DEFAULT_PRODUCT_DIR);
- if (NS_FAILED(rv)) return rv;
rv = localDir->Exists(&exists);
if (NS_SUCCEEDED(rv) && !exists)
@@ -339,10 +350,6 @@ NS_METHOD nsAppFileLocationProvider::GetProductDirectory(nsIFile **aLocalFile, b
//----------------------------------------------------------------------------------------
// 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:
//----------------------------------------------------------------------------------------
NS_METHOD nsAppFileLocationProvider::GetDefaultUserProfileRoot(nsIFile **aLocalFile, bool aLocal)
{
@@ -355,18 +362,6 @@ NS_METHOD nsAppFileLocationProvider::GetDefaultUserProfileRoot(nsIFile **aLocalF
rv = GetProductDirectory(getter_AddRefs(localDir), aLocal);
if (NS_FAILED(rv)) 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
-
*aLocalFile = localDir;
NS_ADDREF(*aLocalFile);
--
1.7.10.4

View File

@ -0,0 +1,14 @@
From: Julian Ospald <hasufell@gentoo.org>
Date: Sun Feb 16 17:11:39 UTC 2014
Subject: allow lightspark
--- tor-browser/dom/plugins/base/nsPluginHost.cpp
+++ tor-browser/dom/plugins/base/nsPluginHost.cpp
@@ -1821,6 +1821,7 @@
// libgnashplugin.so, libflashplayer.so, Flash Player-10.4-10.5.plugin,
// NPSWF32.dll, NPSWF64.dll
if (strstr(leafStr, "libgnashplugin") == leafStr ||
+ strstr(leafStr, "liblightsparkplugin") == leafStr ||
strstr(leafStr, "libflashplayer") == leafStr ||
strstr(leafStr, "Flash Player") == leafStr ||
strstr(leafStr, "NPSWF") == leafStr) {

View File

@ -0,0 +1,329 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
WANT_AUTOCONF="2.1"
MOZ_ESR="1"
MY_PN="firefox"
if [[ ${MOZ_ESR} == 1 ]]; then
# ESR releases have slightly version numbers
MOZ_PV="${PV}esr"
fi
# see https://gitweb.torproject.org/builders/tor-browser-bundle.git/tree/gitian/versions?h=maint-4.0
TOR_PV="4.0.4"
GIT_TAG="tor-browser-${MOZ_PV}-4.0-1-build1"
# Patch version
PATCH="${MY_PN}-31.0-patches-0.2"
MOZCONFIG_OPTIONAL_WIFI=1
MOZCONFIG_OPTIONAL_JIT="enabled"
inherit check-reqs flag-o-matic toolchain-funcs eutils gnome2-utils mozconfig-v5.31 multilib 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 linguas_de"
BASE_SRC_URI="https://dist.torproject.org/${PN}/${TOR_PV}"
SRC_URI="https://gitweb.torproject.org/tor-browser.git/snapshot/${GIT_TAG}.tar.gz -> ${GIT_TAG}.tar.gz
http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.xz
http://dev.gentoo.org/~axs/distfiles/${PATCH}.tar.xz
!linguas_de? (
x86? ( ${BASE_SRC_URI}/tor-browser-linux32-${TOR_PV}_en-US.tar.xz )
amd64? ( ${BASE_SRC_URI}/tor-browser-linux64-${TOR_PV}_en-US.tar.xz )
)
linguas_de? (
x86? ( ${BASE_SRC_URI}/tor-browser-linux32-${TOR_PV}_de.tar.xz )
amd64? ( ${BASE_SRC_URI}/tor-browser-linux64-${TOR_PV}_de.tar.xz )
)
"
ASM_DEPEND=">=dev-lang/yasm-1.1"
CDEPEND=">=dev-libs/nss-3.17.1
>=dev-libs/nspr-4.10.6"
DEPEND="${CDEPEND}
amd64? ( ${ASM_DEPEND}
virtual/opengl )
x86? ( ${ASM_DEPEND}
virtual/opengl )"
QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/${MY_PN}/firefox"
S="${WORKDIR}/${GIT_TAG}"
# See mozcoreconf-2.eclass
mozversion_is_new_enough() {
if [[ $(get_version_component_range 1) -ge 17 ]] ; then
return 0
fi
return 1
}
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
if use jit && [[ -n ${PROFILE_IS_HARDENED} ]]; then
ewarn "You are emerging this package on a hardened profile with USE=jit enabled."
ewarn "This is horribly insecure as it disables all PAGEEXEC restrictions."
ewarn "Please ensure you know what you are doing. If you don't, please consider"
ewarn "emerging the package with USE=-jit"
fi
}
src_prepare() {
# Apply gentoo firefox patches
EPATCH_SUFFIX="patch" \
EPATCH_FORCE="yes" \
epatch "${WORKDIR}/firefox"
# Revert "Change the default Firefox profile directory to be TBB-relative"
epatch -R "${FILESDIR}/tor-browser.git-bccc144c21f6069a294038a6559ba46ceb8da2a2.patch"
# FIXME: https://trac.torproject.org/projects/tor/ticket/10925
# Except lightspark-plugin from blocklist
epatch "${FILESDIR}"/${PN}-24.3.0-allow-lightspark.patch
# Allow user to apply any additional patches without modifing ebuild
epatch_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
eautoreconf
# Must run autoconf in js/src
cd "${S}"/js/src || die
eautoconf
}
src_configure() {
MOZILLA_FIVE_HOME="${EPREFIX}"/usr/$(get_libdir)/${PN}/${MY_PN}
MEXTENSIONS="default"
####################################
#
# mozconfig, CFLAGS and CXXFLAGS setup
#
####################################
mozconfig_init
mozconfig_config
# Add full relro support for hardened
use hardened && append-ldflags "-Wl,-z,relro,-z,now"
mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
mozconfig_annotate '' --disable-mailnews
# Other ff-specific settings
mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
# Rename the install directory and the executable
mozconfig_annotate 'torbrowser' --libdir="${EPREFIX}"/usr/$(get_libdir)/${PN}
mozconfig_annotate 'torbrowser' --with-app-name=torbrowser
mozconfig_annotate 'torbrowser' --with-app-basename=torbrowser
# see https://gitweb.torproject.org/tor-browser.git/tree/configure.in?h=tor-browser-31.3.0esr-4.0-1#n6401
mozconfig_annotate 'torbrowser' --disable-tor-browser-update
mozconfig_annotate 'torbrowser' --with-tor-browser-version=${TOR_PV}
# Finalize and report settings
mozconfig_final
if [[ $(gcc-major-version) -lt 4 ]]; then
append-cxxflags -fno-stack-protector
elif [[ $(gcc-major-version) -gt 4 || $(gcc-minor-version) -gt 3 ]]; then
if use amd64 || use x86; then
append-flags -mno-avx
fi
fi
}
src_compile() {
CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL}" \
emake -f client.mk
}
src_install() {
MOZILLA_FIVE_HOME="${EPREFIX}"/usr/$(get_libdir)/${PN}/${MY_PN}
DICTPATH="\"${EPREFIX}/usr/share/myspell\""
# MOZ_BUILD_ROOT, and hence OBJ_DIR change depending on arch, compiler etc.
local obj_dir="$(echo */config.log)"
obj_dir="${obj_dir%/*}"
cd "${S}/${obj_dir}" || die
# Pax mark xpcshell for hardened support, only used for startupcache creation.
pax-mark m "${S}/${obj_dir}"/dist/bin/xpcshell
# Add an emty default prefs for mozconfig-3.eclass
touch "${S}/${obj_dir}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
|| die
# Set default path to search for dictionaries.
echo "pref(\"spellchecker.dictionary_path\", ${DICTPATH});" \
>> "${S}/${obj_dir}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
|| die
# Disable adobe-flash by default
sed -i -e 's:pref("plugin.state.flash", 1);:pref("plugin.state.flash", 0);:g' \
"${S}/${obj_dir}/dist/bin/browser/defaults/preferences/000-tor-browser.js" \
|| die
# see: https://gitweb.torproject.org/builders/tor-browser-bundle.git/tree/gitian/descriptors/linux/gitian-bundle.yml?h=maint-4.0#n148
if use linguas_de ; then
echo "pref(\"general.useragent.locale\", \"de\");" \
>> "${S}/${obj_dir}/dist/bin/browser/defaults/preferences/000-tor-browser.js" \
|| die
else
echo "pref(\"general.useragent.locale\", \"en-US\");" \
>> "${S}/${obj_dir}/dist/bin/browser/defaults/preferences/000-tor-browser.js" \
|| die
fi
MOZ_MAKE_FLAGS="${MAKEOPTS}" \
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} "TorBrowser" ${PN} "Network;WebBrowser"
# 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}/plugin-container
# Required in order for jit to work on hardened, as of torbroser-31
use jit && pax-mark pm "${ED}"${MOZILLA_FIVE_HOME}/{torbrowser,torbrowser-bin}
# We dont want development files
rm -r "${ED}"/usr/include "${ED}${MOZILLA_FIVE_HOME}"/{idl,include,lib,sdk} \
|| die "Failed to remove sdk and headers"
# revdep-rebuild entry
insinto /etc/revdep-rebuild
echo "SEARCH_DIRS_MASK=${MOZILLA_FIVE_HOME}" >> ${T}/10${PN}
doins "${T}"/10${PN} || die
# Profile without the tor-launcher extension
# see: https://trac.torproject.org/projects/tor/ticket/10160
if use linguas_de ; then
local profile_dir="${WORKDIR}/tor-browser_de/Browser/TorBrowser/Data/Browser/profile.default"
else
local profile_dir="${WORKDIR}/tor-browser_en-US/Browser/TorBrowser/Data/Browser/profile.default"
fi
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"
# Force remote Tor check since the control port might not be available
echo "pref(\"extensions.torbutton.local_tor_check\", false);" \
>> "${profile_dir}/preferences/extension-overrides.js" \
|| die
insinto ${MOZILLA_FIVE_HOME}/browser/defaults/profile
doins -r "${profile_dir}"/{extensions,preferences,bookmarks.html}
# see: https://gitweb.torproject.org/builders/tor-browser-bundle.git/tree/RelativeLink/RelativeLink.sh?h=maint-4.0#n248
dodoc "${FILESDIR}/README.tor-launcher"
if use linguas_de ; then
dodoc "${WORKDIR}/tor-browser_de/Browser/TorBrowser/Docs/ChangeLog.txt"
else
dodoc "${WORKDIR}/tor-browser_en-US/Browser/TorBrowser/Docs/ChangeLog.txt"
fi
}
pkg_preinst() {
gnome2_icon_savelist
}
pkg_postinst() {
echo
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!"
echo
elog "Torbrowser uses port 9150 to connect to Tor. You can change the port"
elog "in the connection settings to match your setup."
echo
if [[ "${REPLACING_VERSIONS}" ]] && [[ "${REPLACING_VERSIONS}" < "31.2.0" ]]; then
echo
ewarn "Since this is a major upgrade, you need to start with a fresh profile."
ewarn "Either move or remove your profile in \"~/.mozilla/torbrowser/\""
ewarn "and let Torbrowser generate a new one."
echo
fi
gnome2_icon_cache_update
}
pkg_postrm() {
gnome2_icon_cache_update
}

View File

@ -0,0 +1,308 @@
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="5"
WANT_AUTOCONF="2.1"
MOZ_ESR="1"
MY_PN="firefox"
if [[ ${MOZ_ESR} == 1 ]]; then
# ESR releases have slightly version numbers
MOZ_PV="${PV}esr"
fi
# see https://gitweb.torproject.org/builders/tor-browser-bundle.git/tree/gitian/versions?h=maint-4.0
TOR_PV="4.0.4"
GIT_TAG="tor-browser-${MOZ_PV}-4.0-1-build1"
# Patch version
PATCH="${MY_PN}-31.0-patches-0.2"
MOZCONFIG_OPTIONAL_WIFI=1
MOZCONFIG_OPTIONAL_JIT="enabled"
inherit check-reqs flag-o-matic toolchain-funcs eutils gnome2-utils mozconfig-v5.31 multilib 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"
BASE_SRC_URI="https://dist.torproject.org/${PN}/${TOR_PV}"
SRC_URI="https://gitweb.torproject.org/tor-browser.git/snapshot/${GIT_TAG}.tar.gz -> ${GIT_TAG}.tar.gz
http://dev.gentoo.org/~anarchy/mozilla/patchsets/${PATCH}.tar.xz
http://dev.gentoo.org/~axs/distfiles/${PATCH}.tar.xz
x86? ( ${BASE_SRC_URI}/tor-browser-linux32-${TOR_PV}_en-US.tar.xz )
amd64? ( ${BASE_SRC_URI}/tor-browser-linux64-${TOR_PV}_en-US.tar.xz )"
ASM_DEPEND=">=dev-lang/yasm-1.1"
CDEPEND=">=dev-libs/nss-3.17.1
>=dev-libs/nspr-4.10.6"
DEPEND="${CDEPEND}
amd64? ( ${ASM_DEPEND}
virtual/opengl )
x86? ( ${ASM_DEPEND}
virtual/opengl )"
QA_PRESTRIPPED="usr/$(get_libdir)/${PN}/${MY_PN}/firefox"
S="${WORKDIR}/${GIT_TAG}"
# See mozcoreconf-2.eclass
mozversion_is_new_enough() {
if [[ $(get_version_component_range 1) -ge 17 ]] ; then
return 0
fi
return 1
}
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
if use jit && [[ -n ${PROFILE_IS_HARDENED} ]]; then
ewarn "You are emerging this package on a hardened profile with USE=jit enabled."
ewarn "This is horribly insecure as it disables all PAGEEXEC restrictions."
ewarn "Please ensure you know what you are doing. If you don't, please consider"
ewarn "emerging the package with USE=-jit"
fi
}
src_prepare() {
# Apply gentoo firefox patches
EPATCH_SUFFIX="patch" \
EPATCH_FORCE="yes" \
epatch "${WORKDIR}/firefox"
# Revert "Change the default Firefox profile directory to be TBB-relative"
epatch -R "${FILESDIR}/tor-browser.git-bccc144c21f6069a294038a6559ba46ceb8da2a2.patch"
# FIXME: https://trac.torproject.org/projects/tor/ticket/10925
# Except lightspark-plugin from blocklist
epatch "${FILESDIR}"/${PN}-24.3.0-allow-lightspark.patch
# Allow user to apply any additional patches without modifing ebuild
epatch_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
eautoreconf
# Must run autoconf in js/src
cd "${S}"/js/src || die
eautoconf
}
src_configure() {
MOZILLA_FIVE_HOME="${EPREFIX}"/usr/$(get_libdir)/${PN}/${MY_PN}
MEXTENSIONS="default"
####################################
#
# mozconfig, CFLAGS and CXXFLAGS setup
#
####################################
mozconfig_init
mozconfig_config
# Add full relro support for hardened
use hardened && append-ldflags "-Wl,-z,relro,-z,now"
mozconfig_annotate '' --enable-extensions="${MEXTENSIONS}"
mozconfig_annotate '' --disable-mailnews
# Other ff-specific settings
mozconfig_annotate '' --with-default-mozilla-five-home=${MOZILLA_FIVE_HOME}
# Rename the install directory and the executable
mozconfig_annotate 'torbrowser' --libdir="${EPREFIX}"/usr/$(get_libdir)/${PN}
mozconfig_annotate 'torbrowser' --with-app-name=torbrowser
mozconfig_annotate 'torbrowser' --with-app-basename=torbrowser
# see https://gitweb.torproject.org/tor-browser.git/tree/configure.in?h=tor-browser-31.3.0esr-4.0-1#n6401
mozconfig_annotate 'torbrowser' --disable-tor-browser-update
mozconfig_annotate 'torbrowser' --with-tor-browser-version=${TOR_PV}
# Finalize and report settings
mozconfig_final
if [[ $(gcc-major-version) -lt 4 ]]; then
append-cxxflags -fno-stack-protector
elif [[ $(gcc-major-version) -gt 4 || $(gcc-minor-version) -gt 3 ]]; then
if use amd64 || use x86; then
append-flags -mno-avx
fi
fi
}
src_compile() {
CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getLD)" \
MOZ_MAKE_FLAGS="${MAKEOPTS}" SHELL="${SHELL}" \
emake -f client.mk
}
src_install() {
MOZILLA_FIVE_HOME="${EPREFIX}"/usr/$(get_libdir)/${PN}/${MY_PN}
DICTPATH="\"${EPREFIX}/usr/share/myspell\""
# MOZ_BUILD_ROOT, and hence OBJ_DIR change depending on arch, compiler etc.
local obj_dir="$(echo */config.log)"
obj_dir="${obj_dir%/*}"
cd "${S}/${obj_dir}" || die
# Pax mark xpcshell for hardened support, only used for startupcache creation.
pax-mark m "${S}/${obj_dir}"/dist/bin/xpcshell
# Add an emty default prefs for mozconfig-3.eclass
touch "${S}/${obj_dir}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
|| die
# Set default path to search for dictionaries.
echo "pref(\"spellchecker.dictionary_path\", ${DICTPATH});" \
>> "${S}/${obj_dir}/dist/bin/browser/defaults/preferences/all-gentoo.js" \
|| die
# Disable adobe-flash by default
sed -i -e 's:pref("plugin.state.flash", 1);:pref("plugin.state.flash", 0);:g' \
"${S}/${obj_dir}/dist/bin/browser/defaults/preferences/000-tor-browser.js" \
|| die
# see: https://gitweb.torproject.org/builders/tor-browser-bundle.git/tree/gitian/descriptors/linux/gitian-bundle.yml?h=maint-4.0#n148
echo "pref(\"general.useragent.locale\", \"en-US\");" \
>> "${S}/${obj_dir}/dist/bin/browser/defaults/preferences/000-tor-browser.js" \
|| die
MOZ_MAKE_FLAGS="${MAKEOPTS}" \
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} "TorBrowser" ${PN} "Network;WebBrowser"
# 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}/plugin-container
# Required in order for jit to work on hardened, as of torbroser-31
use jit && pax-mark pm "${ED}"${MOZILLA_FIVE_HOME}/{torbrowser,torbrowser-bin}
# We dont want development files
rm -r "${ED}"/usr/include "${ED}${MOZILLA_FIVE_HOME}"/{idl,include,lib,sdk} \
|| die "Failed to remove sdk and headers"
# revdep-rebuild entry
insinto /etc/revdep-rebuild
echo "SEARCH_DIRS_MASK=${MOZILLA_FIVE_HOME}" >> ${T}/10${PN}
doins "${T}"/10${PN} || die
# 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"
# Force remote Tor check since the control port might not be available
echo "pref(\"extensions.torbutton.local_tor_check\", false);" \
>> "${profile_dir}/preferences/extension-overrides.js" \
|| die
insinto ${MOZILLA_FIVE_HOME}/browser/defaults/profile
doins -r "${profile_dir}"/{extensions,preferences,bookmarks.html}
# see: https://gitweb.torproject.org/builders/tor-browser-bundle.git/tree/RelativeLink/RelativeLink.sh?h=maint-4.0#n248
dodoc "${FILESDIR}/README.tor-launcher"
dodoc "${WORKDIR}/tor-browser_en-US/Browser/TorBrowser/Docs/ChangeLog.txt"
}
pkg_preinst() {
gnome2_icon_savelist
}
pkg_postinst() {
echo
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!"
echo
elog "Torbrowser uses port 9150 to connect to Tor. You can change the port"
elog "in the connection settings to match your setup."
echo
if [[ "${REPLACING_VERSIONS}" ]] && [[ "${REPLACING_VERSIONS}" < "31.2.0" ]]; then
echo
ewarn "Since this is a major upgrade, you need to start with a fresh profile."
ewarn "Either move or remove your profile in \"~/.mozilla/torbrowser/\""
ewarn "and let Torbrowser generate a new one."
echo
fi
gnome2_icon_cache_update
}
pkg_postrm() {
gnome2_icon_cache_update
}