From a55d847171ccdfbc6bf956657a8c0ca159ccda27 Mon Sep 17 00:00:00 2001 From: Vignesh Pai <57759856+vigneshpai2003@users.noreply.github.com> Date: Thu, 26 Sep 2024 15:06:05 +0530 Subject: [PATCH] riseup-vpn: 0.21.11 -> 0.24.8 --- .../bitmask-vpn/build_release.patch | 17 +++ pkgs/tools/networking/bitmask-vpn/default.nix | 61 +++++----- .../networking/bitmask-vpn/fix_paths.patch | 13 +++ .../bitmask-vpn/gui_gui_qmlcache.qrc | 107 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 +- 5 files changed, 172 insertions(+), 28 deletions(-) create mode 100644 pkgs/tools/networking/bitmask-vpn/build_release.patch create mode 100644 pkgs/tools/networking/bitmask-vpn/fix_paths.patch create mode 100644 pkgs/tools/networking/bitmask-vpn/gui_gui_qmlcache.qrc diff --git a/pkgs/tools/networking/bitmask-vpn/build_release.patch b/pkgs/tools/networking/bitmask-vpn/build_release.patch new file mode 100644 index 000000000000..ecb53f39e2e3 --- /dev/null +++ b/pkgs/tools/networking/bitmask-vpn/build_release.patch @@ -0,0 +1,17 @@ +diff --git a/bitmask.pro b/bitmask.pro +index f377bb4..3c71a71 100644 +--- a/bitmask.pro ++++ b/bitmask.pro +@@ -4,9 +4,9 @@ QT += quickcontrols2 svg + CONFIG += qt staticlib + CONFIG += c++17 strict_c++ + CONFIG += qtquickcompiler +-CONFIG+=force_debug_info +-CONFIG+=debug_and_release +-#CONFIG+=release ++#CONFIG+=force_debug_info ++#CONFIG+=debug_and_release ++CONFIG+=release + windows:CONFIG -= console + unix:DEBUG:CONFIG += debug + lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5") \ No newline at end of file diff --git a/pkgs/tools/networking/bitmask-vpn/default.nix b/pkgs/tools/networking/bitmask-vpn/default.nix index 264bddf5b0f9..8a21a3b2f3eb 100644 --- a/pkgs/tools/networking/bitmask-vpn/default.nix +++ b/pkgs/tools/networking/bitmask-vpn/default.nix @@ -1,7 +1,7 @@ { lib , stdenv +, substituteAll , fetchFromGitLab -, mkDerivation , buildGoModule , wrapQtAppsHook , python3Packages @@ -13,32 +13,29 @@ , iproute2 , iptables , procps -, qmltermwidget , qtbase , qtdeclarative -, qtgraphicaleffects -, qtinstaller -, qtquickcontrols -, qtquickcontrols2 +, qtsvg , qttools +, qtwayland , CoreFoundation , Security , provider ? "riseup" }: let - version = "0.21.11"; + version = "0.24.8"; src = fetchFromGitLab { domain = "0xacab.org"; owner = "leap"; repo = "bitmask-vpn"; - rev = version; - sha256 = "sha256-mhmKG6Exxh64oeeeLezJYWEw61iIHLasHjLomd2L8P4="; + rev = "8b3ac473f64b6de0262fbf945ff25af8029134f1"; + sha256 = "sha256-nYMfO091w6H7LyY1+aYubFppg4/3GiZZm4e+0m9Gb3k="; }; # bitmask-root is only used on GNU/Linux # and may one day be replaced by pkg/helper - bitmask-root = mkDerivation { + bitmask-root = stdenv.mkDerivation { inherit src version; sourceRoot = "${src.name}/helpers"; pname = "bitmask-root"; @@ -70,6 +67,18 @@ buildGoModule rec { pname = "${provider}-vpn"; vendorHash = null; + patches = [ + # This patch fixes the paths in the build script generated by qmake + # to use the correct paths for qmlcachegen and lrelease + (substituteAll { + src = ./fix_paths.patch; + inherit qtbase qtdeclarative qttools; + }) + + # Don't build the debug version + ./build_release.patch + ]; + postPatch = '' substituteInPlace pkg/pickle/helpers.go \ --replace /usr/share $out/share @@ -77,7 +86,7 @@ buildGoModule rec { # Using $PROVIDER is not working, # thus replacing directly into the vendor.conf substituteInPlace providers/vendor.conf \ - --replace "provider = riseup" "provider = ${provider}" + --replace "provider = bitmask" "provider = ${provider}" substituteInPlace branding/templates/debian/app.desktop-template \ --replace "Icon=icon" "Icon=${pname}" @@ -87,7 +96,7 @@ buildGoModule rec { '' + lib.optionalString stdenv.hostPlatform.isLinux '' substituteInPlace pkg/helper/linux.go \ --replace /usr/sbin/openvpn ${openvpn}/bin/openvpn - substituteInPlace pkg/vpn/launcher_linux.go \ + substituteInPlace pkg/launcher/launcher_linux.go \ --replace /usr/sbin/openvpn ${openvpn}/bin/openvpn \ --replace /usr/sbin/bitmask-root ${bitmask-root}/bin/bitmask-root \ --replace /usr/bin/lxpolkit /run/wrappers/bin/polkit-agent-helper-1 \ @@ -98,21 +107,20 @@ buildGoModule rec { cmake pkg-config python3Packages.wrapPython - qmake - qtquickcontrols2 - qttools which wrapQtAppsHook - ] ++ lib.optional (!stdenv.hostPlatform.isLinux) qtinstaller; + qmake + qttools + qtsvg + ]; buildInputs = [ qtbase - qmltermwidget qtdeclarative - qtgraphicaleffects - qtquickcontrols - qtquickcontrols2 - ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreFoundation Security ]; + qtsvg + ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreFoundation Security ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ qtwayland ]; + # FIXME: building on Darwin currently fails # due to missing debug symbols for Qt, # this should be fixable once darwin.apple_sdk >= 10.13 @@ -123,13 +131,12 @@ buildGoModule rec { buildPhase = '' runHook preBuild - make gen_providers_json - make generate - # Remove timestamps in comments - sed -i -e '/^\/\//d' pkg/config/version/version.go + # TODO: this is a hack that copies the qrc file that should by built by qmlcachegen + # qmlcachegen is in qtdeclarative/libexec, but qmake is in qtbase/bin + # but qmake searches for qmlcachegen in qtbase/libexec which leads to the error + mkdir -p build/qt + cp ${./gui_gui_qmlcache.qrc} build/qt/gui_gui_qmlcache.qrc - # Not using -j$NIX_BUILD_CORES because the Makefile's rules - # are not thread-safe: lib/libgoshim.h is used before being built. make build runHook postBuild diff --git a/pkgs/tools/networking/bitmask-vpn/fix_paths.patch b/pkgs/tools/networking/bitmask-vpn/fix_paths.patch new file mode 100644 index 000000000000..afc444952fbb --- /dev/null +++ b/pkgs/tools/networking/bitmask-vpn/fix_paths.patch @@ -0,0 +1,13 @@ +diff --git a/gui/build.sh b/gui/build.sh +index a858a81..ac43f52 100755 +--- a/gui/build.sh ++++ b/gui/build.sh +@@ -94,6 +94,8 @@ function buildQmake { + mkdir -p $QTBUILD + $QMAKE -early QMAKE_CC=$CC QMAKE_CXX=$CXX QMAKE_LINK=$CXX -o "$QTBUILD/Makefile" CONFIG+=release VENDOR_PATH="${VENDOR_PATH}" $PROJECT + #CONFIG=+force_debug_info CONFIG+=debug CONFIG+=debug_and_release ++ sed -i 's|@qtbase@/libexec/qmlcachegen|@qtdeclarative@/libexec/qmlcachegen|g' $QTBUILD/Makefile ++ sed -i 's|@qtbase@/bin/lrelease|@qttools@/bin/lrelease|g' $QTBUILD/Makefile + } + + function renameOutput { \ No newline at end of file diff --git a/pkgs/tools/networking/bitmask-vpn/gui_gui_qmlcache.qrc b/pkgs/tools/networking/bitmask-vpn/gui_gui_qmlcache.qrc new file mode 100644 index 000000000000..dd68f646d1fc --- /dev/null +++ b/pkgs/tools/networking/bitmask-vpn/gui_gui_qmlcache.qrc @@ -0,0 +1,107 @@ + + + + ../../gui/main.qml + ../../gui/qtquickcontrols2.conf + ../../gui/themes/themes.js + ../../gui/themes/theme-riseup.js + ../../gui/themes/Riseup.qml + ../../gui/themes/theme-calyx.js + ../../gui/themes/Calyx.qml + ../../gui/themes/Bitmask.qml + ../../gui/themes/ThemeObject.qml + ../../gui/components/MainView.qml + ../../gui/components/ThemedPage.qml + ../../gui/components/Splash.qml + ../../gui/components/FadeBehavior.qml + ../../gui/components/Home.qml + ../../gui/components/Header.qml + ../../gui/components/Footer.qml + ../../gui/components/About.qml + ../../gui/components/MaterialRadioButton.qml + ../../gui/components/MaterialRadioIndicator.qml + ../../gui/components/WrappedRadioButton.qml + ../../gui/components/MaterialCheckBox.qml + ../../gui/components/StatusBox.qml + ../../gui/components/Systray.qml + ../../gui/components/Help.qml + ../../gui/components/Locations.qml + ../../gui/components/SignalIcon.qml + ../../gui/components/Preferences.qml + ../../gui/components/BoldLabel.qml + ../../gui/components/LightLabel.qml + ../../gui/components/VPNButtonBase.qml + ../../gui/components/VPNMouseArea.qml + ../../gui/components/VerticalSpacer.qml + ../../gui/components/Icon.qml + ../../gui/components/VPNState.qml + ../../gui/components/InitErrors.qml + ../../gui/components/ErrorBox.qml + ../../gui/components/MotdBox.qml + ../../gui/resources/icon-noshield.svg + ../../gui/resources/location.svg + ../../gui/resources/settings.svg + ../../gui/resources/power.svg + ../../gui/resources/language.svg + ../../gui/resources/lightning.svg + ../../gui/resources/close.svg + ../../gui/resources/donate.svg + ../../gui/resources/tools.svg + ../../gui/resources/help.svg + ../../gui/resources/about.svg + ../../gui/resources/bridge.svg + ../../gui/resources/gear-fill.svg + ../../gui/resources/reception-0.svg + ../../gui/resources/reception-2.svg + ../../gui/resources/reception-4.svg + ../../gui/resources/reception-0@24.svg + ../../gui/resources/reception-4@24.svg + ../../gui/resources/arrow-left.svg + ../../gui/resources/globe.svg + ../../gui/resources/spy.gif + ../../gui/resources/quit.svg + ../../gui/resources/alert.svg + ../../gui/resources/angle-right.svg + ../../gui/resources/snowflake.svg + ../../gui/resources/button_green.png + ../../gui/resources/button_yellow.png + ../../gui/resources/button_red.png + ../../gui/resources/ravens.svg + ../../gui/resources/ravens.gif + ../../gui/resources/riseup-icon.svg + ../../gui/resources/riseup_connected_bg.png + ../../gui/resources/riseup_connecting_bg.png + ../../gui/resources/riseup_disconnected_bg.png + ../../gui/resources/riseup_green_shield.svg + ../../gui/resources/calyx/calyx-shield-green.png + ../../gui/resources/calyx/calyx-hand.png + ../../gui/resources/calyx/calyx-red-shield.png + ../../gui/resources/calyx/calyx-yellow-shield.png + ../../gui/resources/bitmask/splash_logo.png + ../../gui/resources/bitmask/state_connected.png + ../../gui/resources/bitmask/state_connecting.png + ../../gui/resources/bitmask/state_disconnected.png + ../../gui/resources/bitmask/bitmask_connected_bg.png + ../../gui/resources/bitmask/bitmask_connecting_bg.png + ../../gui/resources/bitmask/bitmask_disconnected_bg.png + ../../gui/resources/fonts/Poppins-Regular.ttf + ../../gui/resources/fonts/Poppins-Bold.ttf + ../../gui/resources/fonts/Montserrat-SemiBold.ttf + ../../gui/resources/fonts/Roboto-Regular.ttf + ../../gui/resources/fonts/Roboto-Bold.ttf + ../../gui/assets/icon/png/black/vpn_off.png + ../../gui/assets/icon/png/black/vpn_on.png + ../../gui/assets/icon/png/black/vpn_wait_0.png + ../../gui/assets/icon/png/black/vpn_wait_1.png + ../../gui/assets/icon/png/black/vpn_wait_2.png + ../../gui/assets/icon/png/black/vpn_wait_3.png + ../../gui/assets/icon/png/white/vpn_off.png + ../../gui/assets/icon/png/white/vpn_on.png + ../../gui/assets/icon/png/white/vpn_wait_0.png + ../../gui/assets/icon/png/white/vpn_wait_1.png + ../../gui/assets/icon/png/white/vpn_wait_2.png + ../../gui/assets/icon/png/white/vpn_wait_3.png + ../../gui/assets/img/bird.jpg + ../../gui/providers/providers.json + + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 8678860a86b1..22086af94ac0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -11631,7 +11631,7 @@ with pkgs; ripdrag = callPackage ../tools/misc/ripdrag { }; - riseup-vpn = libsForQt5.callPackage ../tools/networking/bitmask-vpn { + riseup-vpn = qt6Packages.callPackage ../tools/networking/bitmask-vpn { provider = "riseup"; inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; };