qbittorrent: 4.5.5 -> 4.6.0 + other changes

Other changes:
- Refactor
- Switch to CMake
- Build with Qt6 by default and add a separate derivation for Qt5
This commit is contained in:
Pavel Sobolev 2023-10-24 12:16:37 +03:00 committed by Peter Hoeg
parent cedd2ce2be
commit b645bf2f1b
2 changed files with 77 additions and 40 deletions

View File

@ -1,58 +1,92 @@
{ mkDerivation, lib, stdenv, fetchFromGitHub, pkg-config
, boost, libtorrent-rasterbar, qtbase, qttools, qtsvg
, debugSupport ? false
, guiSupport ? true, dbus ? null # GUI (disable to run headless)
, webuiSupport ? true # WebUI
, trackerSearch ? true, python3 ? null
{ lib
, stdenv
, fetchFromGitHub
, boost
, cmake
, Cocoa
, libtorrent-rasterbar
, ninja
, qtbase
, qtsvg
, qttools
, wrapQtAppsHook
, guiSupport ? true
, dbus
, qtwayland
, trackerSearch ? true
, python3
, webuiSupport ? true
}:
assert guiSupport -> (dbus != null);
assert trackerSearch -> (python3 != null);
mkDerivation rec {
pname = "qbittorrent" + lib.optionalString (!guiSupport) "-nox";
version = "4.5.5";
let
qtVersion = lib.versions.major qtbase.version;
in
stdenv.mkDerivation rec {
pname = "qbittorrent"
+ lib.optionalString (guiSupport && qtVersion == "5") "-qt5"
+ lib.optionalString (!guiSupport) "-nox";
version = "4.6.0";
src = fetchFromGitHub {
owner = "qbittorrent";
repo = "qBittorrent";
rev = "release-${version}";
hash = "sha256-rWv+KGw+3385GOKK4MvoSP0CepotUZELiDVFpyDf+9k=";
hash = "sha256-o9zMGjVCXLqdRdXzRs1kFPDMFJXQWBEtWwIfeIyFxJw=";
};
enableParallelBuilding = true;
nativeBuildInputs = [
cmake
ninja
wrapQtAppsHook
];
# NOTE: 2018-05-31: CMake is working but it is not officially supported
nativeBuildInputs = [ pkg-config ];
buildInputs = [
boost
libtorrent-rasterbar
qtbase
qtsvg
qttools
] ++ lib.optionals stdenv.isDarwin [
Cocoa
] ++ lib.optionals guiSupport [
dbus
] ++ lib.optionals (guiSupport && stdenv.isLinux) [
qtwayland
] ++ lib.optionals trackerSearch [
python3
];
buildInputs = [ boost libtorrent-rasterbar qtbase qttools qtsvg ]
++ lib.optional guiSupport dbus # D(esktop)-Bus depends on GUI support
++ lib.optional trackerSearch python3;
cmakeFlags = lib.optionals (qtVersion == "6") [
"-DQT6=ON"
] ++ lib.optionals (!guiSupport) [
"-DGUI=OFF"
"-DSYSTEMD=ON"
"-DSYSTEMD_SERVICES_INSTALL_DIR=${placeholder "out"}/lib/systemd/system"
] ++ lib.optionals (!webuiSupport) [
"-DWEBUI=OFF"
];
# Otherwise qm_gen.pri assumes lrelease-qt5, which does not exist.
QMAKE_LRELEASE = "lrelease";
configureFlags = [
"--with-boost-libdir=${boost.out}/lib"
"--with-boost=${boost.dev}" ]
++ lib.optionals (!guiSupport) [ "--disable-gui" "--enable-systemd" ] # Also place qbittorrent-nox systemd service files
++ lib.optional (!webuiSupport) "--disable-webui"
++ lib.optional debugSupport "--enable-debug";
qtWrapperArgs = lib.optional trackerSearch "--prefix PATH : ${lib.makeBinPath [ python3 ]}";
qtWrapperArgs = lib.optionals trackerSearch [
"--prefix PATH : ${lib.makeBinPath [ python3 ]}"
];
postInstall = lib.optionalString stdenv.isDarwin ''
APP_NAME=qbittorrent${lib.optionalString (!guiSupport) "-nox"}
mkdir -p $out/{Applications,bin}
cp -R src/${pname}.app $out/Applications
makeWrapper $out/{Applications/${pname}.app/Contents/MacOS,bin}/${pname}
cp -R $APP_NAME.app $out/Applications
makeWrapper $out/{Applications/$APP_NAME.app/Contents/MacOS,bin}/$APP_NAME
'';
meta = with lib; {
description = "Featureful free software BitTorrent client";
homepage = "https://www.qbittorrent.org/";
changelog = "https://github.com/qbittorrent/qBittorrent/blob/release-${version}/Changelog";
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ Anton-Latukha kashw2 ];
homepage = "https://www.qbittorrent.org";
changelog = "https://github.com/qbittorrent/qBittorrent/blob/release-${version}/Changelog";
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ Anton-Latukha kashw2 paveloom ];
};
}

View File

@ -34878,9 +34878,12 @@ with pkgs;
pyrosimple = callPackage ../applications/networking/p2p/pyrosimple { };
qbittorrent = libsForQt5.callPackage ../applications/networking/p2p/qbittorrent { };
qbittorrent-nox = qbittorrent.override {
guiSupport = false;
qbittorrent = qt6Packages.callPackage ../applications/networking/p2p/qbittorrent {
inherit (darwin.apple_sdk.frameworks) Cocoa;
};
qbittorrent-nox = qbittorrent.override { guiSupport = false; };
qbittorrent-qt5 = libsForQt5.callPackage ../applications/networking/p2p/qbittorrent {
inherit (darwin.apple_sdk.frameworks) Cocoa;
};
qcad = libsForQt5.callPackage ../applications/misc/qcad { };