Merge pull request #247788 from andersk/mozillavpn

This commit is contained in:
Franz Pletz 2023-08-08 05:53:52 +02:00 committed by GitHub
commit 8ba72f7ca7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,9 +2,10 @@
, cargo , cargo
, cmake , cmake
, fetchFromGitHub , fetchFromGitHub
, fetchpatch
, go , go
, lib , lib
, libgcrypt
, libgpg-error
, libsecret , libsecret
, pkg-config , pkg-config
, polkit , polkit
@ -24,29 +25,17 @@
let let
pname = "mozillavpn"; pname = "mozillavpn";
version = "2.15.0"; version = "2.16.0";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "mozilla-mobile"; owner = "mozilla-mobile";
repo = "mozilla-vpn-client"; repo = "mozilla-vpn-client";
rev = "v${version}"; rev = "v${version}";
fetchSubmodules = true; fetchSubmodules = true;
hash = "sha256-eyYrA8ysfmXxlHNUBkGU9ioYrnbx3L1wP9byNz9L/MA="; hash = "sha256-Yd53QUnoZ+5imt8kWpfGL6mkWeEFvqRrTpSu6efGgOA=";
}; };
patches = [ patches = [ ];
# Force version downgrade for openssl and openssl-sys crates
(fetchpatch {
url = "https://github.com/mozilla-mobile/mozilla-vpn-client/commit/5911071ea37d12401af32dcdf2a542ca5049bf2f.patch";
hash = "sha256-b3yOgn3Et0sYpqzUUdmlGIbzZSz13Q9HW56hyQqRnHc=";
revert = true;
})
# [2.15] Restore qtglean/Cargo.lock
(fetchpatch {
url = "https://github.com/mozilla-mobile/mozilla-vpn-client/pull/7026/commits/13c1b77ee4249883a33b6ac240b3ca143b485ba1.patch";
hash = "sha256-L4D71zreDMLAIbP4x1as9QdNmMC1snUZSwlkKehg5yM=";
})
];
netfilter-goModules = (buildGoModule { netfilterGoModules = (buildGoModule {
inherit pname version src patches; inherit pname version src patches;
modRoot = "linux/netfilter"; modRoot = "linux/netfilter";
vendorHash = "sha256-Cmo0wnl0z5r1paaEf1MhCPbInWeoMhGjnxCxGh0cyO8="; vendorHash = "sha256-Cmo0wnl0z5r1paaEf1MhCPbInWeoMhGjnxCxGh0cyO8=";
@ -56,19 +45,19 @@ let
inherit src patches; inherit src patches;
name = "${pname}-${version}-extension-bridge"; name = "${pname}-${version}-extension-bridge";
preBuild = "cd extension/bridge"; preBuild = "cd extension/bridge";
hash = "sha256-R/9ePEhc4qVgg3WC5ng+cD88K/N3PTnx4QWyaZZfRds="; hash = "sha256-WKnc2nGXJVhzNluh0RFSdmPtGdo2QnNuEJ7r5xJCGi0=";
}; };
signatureDeps = rustPlatform.fetchCargoTarball { signatureDeps = rustPlatform.fetchCargoTarball {
inherit src patches; inherit src patches;
name = "${pname}-${version}-signature"; name = "${pname}-${version}-signature";
preBuild = "cd signature"; preBuild = "cd signature";
hash = "sha256-27g2qnnUrxbThM1cHZquQgWQLWDtZaBnlf8PjvQtBJU="; hash = "sha256-XlOnUB0TO6rrLkWU9eT1sTOcDtJdz4yi/ejKcEfFcFc=";
}; };
qtgleanDeps = rustPlatform.fetchCargoTarball { qtgleanDeps = rustPlatform.fetchCargoTarball {
inherit src patches; inherit src patches;
name = "${pname}-${version}-qtglean"; name = "${pname}-${version}-qtglean";
preBuild = "cd qtglean"; preBuild = "cd qtglean";
hash = "sha256-cW+nf+Dho+eSzOBo3xhxki7NXpg0wd5ZM9OMA6iOUl4="; hash = "sha256-BU++ZWb4Fp8LS2woohuDSD2iYo/3rBO6xgeLzyrdLkU=";
}; };
in in
@ -76,8 +65,9 @@ stdenv.mkDerivation {
inherit pname version src patches; inherit pname version src patches;
buildInputs = [ buildInputs = [
libgcrypt
libgpg-error
libsecret libsecret
polkit
qt5compat qt5compat
qtbase qtbase
qtnetworkauth qtnetworkauth
@ -85,6 +75,7 @@ stdenv.mkDerivation {
qtwebsockets qtwebsockets
]; ];
nativeBuildInputs = [ nativeBuildInputs = [
cargo
cmake cmake
go go
pkg-config pkg-config
@ -92,8 +83,8 @@ stdenv.mkDerivation {
python3.pkgs.glean-parser python3.pkgs.glean-parser
python3.pkgs.pyyaml python3.pkgs.pyyaml
python3.pkgs.setuptools python3.pkgs.setuptools
qttools
rustPlatform.cargoSetupHook rustPlatform.cargoSetupHook
cargo
rustc rustc
wrapQtAppsHook wrapQtAppsHook
]; ];
@ -117,22 +108,15 @@ stdenv.mkDerivation {
dontCargoSetupPostUnpack = true; dontCargoSetupPostUnpack = true;
postPatch = '' postPatch = ''
substituteInPlace src/apps/vpn/platforms/linux/daemon/org.mozilla.vpn.dbus.service --replace /usr/bin/mozillavpn "$out/bin/mozillavpn"
substituteInPlace scripts/addon/build.py \
--replace 'qtbinpath = args.qtpath' 'qtbinpath = "${qttools.dev}/bin"' \
--replace 'rcc = os.path.join(qtbinpath, rcc_bin)' 'rcc = "${qtbase.dev}/libexec/rcc"'
substituteInPlace src/apps/vpn/cmake/linux.cmake \ substituteInPlace src/apps/vpn/cmake/linux.cmake \
--replace '/etc/xdg/autostart' "$out/etc/xdg/autostart" \ --replace '/etc/xdg/autostart' "$out/etc/xdg/autostart" \
--replace '${"$"}{POLKIT_POLICY_DIR}' "$out/share/polkit-1/actions" \
--replace '/usr/share/dbus-1' "$out/share/dbus-1" \ --replace '/usr/share/dbus-1' "$out/share/dbus-1" \
--replace '${"$"}{SYSTEMD_UNIT_DIR}' "$out/lib/systemd/system" --replace '${"$"}{SYSTEMD_UNIT_DIR}' "$out/lib/systemd/system"
substituteInPlace extension/CMakeLists.txt \ substituteInPlace extension/CMakeLists.txt \
--replace '/etc' "$out/etc" --replace '/etc' "$out/etc"
ln -s '${netfilter-goModules}' linux/netfilter/vendor ln -s '${netfilterGoModules}' linux/netfilter/vendor
pushd extension/bridge pushd extension/bridge
cargoDepsCopy="$extensionBridgeDepsCopy" cargoSetupPostPatchHook cargoDepsCopy="$extensionBridgeDepsCopy" cargoSetupPostPatchHook