tor-browser-bundle: redo extensions

This commit is contained in:
Joachim Fasting 2017-09-26 20:28:12 +02:00
parent fe3b95e749
commit 346661d77b
No known key found for this signature in database
GPG Key ID: 66EAB6B14F6B6E0D

View File

@ -2,11 +2,13 @@
, lib , lib
, fetchurl , fetchurl
, fetchgit , fetchgit
, symlinkJoin
, tor , tor
, tor-browser-unwrapped , tor-browser-unwrapped
# Extensions, common # Extensions, common
, unzip
, zip , zip
# HTTPS Everywhere # HTTPS Everywhere
@ -27,11 +29,16 @@ let
sha256 = "0j37mqldj33fnzghxifvy6v8vdwkcz0i4z81prww64md5s8qcsa9"; sha256 = "0j37mqldj33fnzghxifvy6v8vdwkcz0i4z81prww64md5s8qcsa9";
}; };
# Each extension drv produces an output comprising an unpacked .xpi
# named after the extension uuid, as it would appear under
# `firefox/extensions'.
firefoxExtensions = { firefoxExtensions = {
https-everywhere = stdenv.mkDerivation rec { https-everywhere = stdenv.mkDerivation rec {
name = "https-everywhere-${version}"; name = "https-everywhere-${version}";
version = "5.2.21"; version = "5.2.21";
extid = "https-everywhere-eff@eff.org";
src = fetchgit { src = fetchgit {
url = "https://git.torproject.org/https-everywhere.git"; url = "https://git.torproject.org/https-everywhere.git";
rev = "refs/tags/${version}"; rev = "refs/tags/${version}";
@ -44,16 +51,24 @@ let
python27 python27
python27Packages.lxml python27Packages.lxml
rsync rsync
unzip
zip zip
]; ];
buildCommand = '' unpackPhase = ''
cp -dR --no-preserve=mode "$src" src cp -dR --no-preserve=mode "$src" src
cd src cd src
'';
sed -i makexpi.sh -e '104d' # cp -a translations/* fails because the dir is empty ... # Beware: the build expects translations/ to be non-empty (which it
# will be with submodules initialized).
buildPhase = ''
$shell ./makexpi.sh ${version} --no-recurse $shell ./makexpi.sh ${version} --no-recurse
install -m 444 -Dt $out pkg"/"*.xpi '';
installPhase = ''
mkdir $out
unzip -d "$out/$extid" "pkg/https-everywhere-$version-eff.xpi"
''; '';
meta = { meta = {
@ -61,53 +76,98 @@ let
}; };
}; };
noscript = fetchurl { noscript = stdenv.mkDerivation rec {
url = https://secure.informaction.com/download/releases/noscript-5.0.10.xpi; name = "noscript-${version}";
sha256 = "18k5karbaj5mhd9cyjbqgik6044bw88rjalkh6anjanxbn503j6g"; version = "5.0.10";
extid = "{73a6fe31-595d-460b-a920-fcc0f8843232}";
src = fetchurl {
url = "https://secure.informaction.com/download/releases/noscript-${version}.xpi";
sha256 = "18k5karbaj5mhd9cyjbqgik6044bw88rjalkh6anjanxbn503j6g";
};
nativeBuildInputs = [ unzip ];
unpackPhase = ":";
installPhase = ''
mkdir $out
unzip -d "$out/$extid" "$src"
'';
}; };
torbutton = stdenv.mkDerivation rec { torbutton = stdenv.mkDerivation rec {
name = "torbutton-${version}"; name = "torbutton-${version}";
version = "1.9.8.1"; version = "1.9.8.1";
extid = "torbutton@torproject.org";
src = fetchgit { src = fetchgit {
url = "https://git.torproject.org/torbutton.git"; url = "https://git.torproject.org/torbutton.git";
rev = "refs/tags/${version}"; rev = "refs/tags/${version}";
sha256 = "1amp0c9ky0a7fsa0bcbi6n6ginw7s2g3an4rj7kvc1lxmrcsm65l"; sha256 = "1amp0c9ky0a7fsa0bcbi6n6ginw7s2g3an4rj7kvc1lxmrcsm65l";
}; };
nativeBuildInputs = [ zip ]; nativeBuildInputs = [ unzip zip ];
buildCommand = '' unpackPhase = ''
cp -dR --no-preserve=mode "$src" src cp -dR --no-preserve=mode "$src" src
cd src cd src
$shell ./makexpi.sh
install -m 444 -Dt $out pkg"/"*.xpi
''; '';
buildPhase = ''
$shell ./makexpi.sh
'';
installPhase = ''
mkdir $out
unzip -d "$out/$extid" "pkg/torbutton-$version.xpi"
'';
meta = {
homepage = https://gitweb.torproject.org/torbutton.git/;
};
}; };
tor-launcher = stdenv.mkDerivation rec { tor-launcher = stdenv.mkDerivation rec {
name = "tor-launcher-${version}"; name = "tor-launcher-${version}";
version = "0.2.12.3"; version = "0.2.12.3";
extid = "tor-launcher@torproject.org";
src = fetchgit { src = fetchgit {
url = "https://git.torproject.org/tor-launcher.git"; url = "https://git.torproject.org/tor-launcher.git";
rev = "refs/tags/${version}"; rev = "refs/tags/${version}";
sha256 = "0126x48pjiy2zm4l8jzhk70w24hviaz560ffp4lb9x0ar615bc9q"; sha256 = "0126x48pjiy2zm4l8jzhk70w24hviaz560ffp4lb9x0ar615bc9q";
}; };
nativeBuildInputs = [ zip ]; nativeBuildInputs = [ unzip zip ];
buildCommand = '' unpackPhase = ''
cp -dR --no-preserve=mode "$src" src cp -dR --no-preserve=mode "$src" src
cd src cd src
make package
install -m 444 -Dt $out pkg"/"*.xpi
''; '';
buildPhase = ''
make package
'';
installPhase = ''
mkdir $out
unzip -d "$out/$extid" "pkg/tor-launcher-$version.xpi"
'';
meta = {
homepage = https://gitweb.torproject.org/tor-launcher.git/;
};
}; };
}; };
extensionsEnv = symlinkJoin {
name = "tor-browser-extensions";
paths = with firefoxExtensions; [ https-everywhere noscript torbutton tor-launcher ];
};
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "tor-browser-bundle-${version}"; name = "tor-browser-bundle-${version}";
@ -163,18 +223,8 @@ stdenv.mkDerivation rec {
EOF EOF
# Preload extensions # Preload extensions
install -m 444 -D \ # XXX: the fact that ln -s env browser/extensions fails, symlinkJoin seems a little redundant ...
${firefoxExtensions.tor-launcher}/tor-launcher-*.xpi \ ln -s -t browser/extensions ${extensionsEnv}"/"*
browser/extensions/tor-launcher@torproject.org.xpi
install -m 444 -D \
${firefoxExtensions.torbutton}/torbutton-*.xpi \
browser/extensions/torbutton@torproject.org.xpi
install -m 444 -D \
${firefoxExtensions.https-everywhere}/https-everywhere-*-eff.xpi \
browser/extensions/https-everywhere-eff@eff.org.xpi
install -m 444 -D \
${firefoxExtensions.noscript} \
browser/extensions/{73a6fe31-595d-460b-a920-fcc0f8843232}.xpi
# Copy bundle data # Copy bundle data
cat \ cat \