From c392dd79976fdcc7cd4617514463c12d29b5a708 Mon Sep 17 00:00:00 2001 From: Peter Hoeg Date: Mon, 1 Apr 2024 17:17:07 +0200 Subject: [PATCH] kid3: build with qt6 and KDE support --- pkgs/applications/audio/kid3/default.nix | 53 +++++++++++++++++------- pkgs/top-level/all-packages.nix | 5 ++- 2 files changed, 43 insertions(+), 15 deletions(-) diff --git a/pkgs/applications/audio/kid3/default.nix b/pkgs/applications/audio/kid3/default.nix index 1aa79a69e523..cae02e03e613 100644 --- a/pkgs/applications/audio/kid3/default.nix +++ b/pkgs/applications/audio/kid3/default.nix @@ -1,5 +1,4 @@ -{ - chromaprint +{ chromaprint , cmake , docbook_xml_dtd_45 , docbook_xsl @@ -7,25 +6,43 @@ , ffmpeg , flac , id3lib +, kdePackages , lib , libogg , libvorbis , libxslt , mp4v2 -, phonon , pkg-config , python3 , qtbase +, qtdeclarative , qtmultimedia -, qtquickcontrols , qttools , readline , stdenv , taglib , wrapQtAppsHook , zlib +, withCLI ? true +, withKDE ? true +, withQt ? false }: +let + inherit (lib) optionals; + + apps = lib.concatStringsSep ";" ( + optionals withCLI [ "CLI" ] + ++ optionals withKDE [ "KDE" ] + ++ optionals withQt [ "Qt" ] + ); + + mainProgram = + if withQt then "kid3-qt" + else if withKDE then "kid3" + else "kid3-cli"; + +in stdenv.mkDerivation (finalAttrs: { pname = "kid3"; version = "3.9.5"; @@ -41,6 +58,7 @@ stdenv.mkDerivation (finalAttrs: { docbook_xsl pkg-config python3 + qttools wrapQtAppsHook ]; @@ -53,25 +71,32 @@ stdenv.mkDerivation (finalAttrs: { libvorbis libxslt mp4v2 - phonon qtbase + qtdeclarative qtmultimedia - qtquickcontrols - qttools readline taglib zlib - ]; + ] ++ lib.optionals withKDE (with kdePackages; [ + kconfig + kconfigwidgets + kcoreaddons + kio + kxmlgui + phonon + ]); - cmakeFlags = [ "-DWITH_APPS=Qt;CLI" ]; - NIX_LDFLAGS = "-lm -lpthread"; + cmakeFlags = [ (lib.cmakeFeature "WITH_APPS" apps) ]; - preConfigure = '' - export DOCBOOKDIR="${docbook_xsl}/xml/xsl/docbook/" - ''; + env = { + DOCBOOKDIR = "${docbook_xsl}/xml/xsl/docbook/"; + LANG = "C.UTF-8"; + NIX_LDFLAGS = "-lm -lpthread"; + }; meta = { description = "A simple and powerful audio tag editor"; + inherit mainProgram; homepage = "https://kid3.kde.org/"; license = lib.licenses.lgpl2Plus; longDescription = '' @@ -103,7 +128,7 @@ stdenv.mkDerivation (finalAttrs: { - Edit synchronized lyrics and event timing codes, import and export LRC files. ''; - maintainers = [ lib.maintainers.AndersonTorres ]; + maintainers = with lib.maintainers; [ AndersonTorres ]; platforms = lib.platforms.linux; }; }) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index db8d02340712..5ca7173cd399 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -32420,7 +32420,10 @@ with pkgs; khard = callPackage ../applications/misc/khard { }; - kid3 = libsForQt5.callPackage ../applications/audio/kid3 { }; + kid3-cli = qt6Packages.callPackage ../applications/audio/kid3 { withCLI = true; withKDE = false; withQt = false; }; + kid3-kde = qt6Packages.callPackage ../applications/audio/kid3 { withCLI = true; withKDE = true; withQt = false; }; + kid3-qt = qt6Packages.callPackage ../applications/audio/kid3 { withCLI = true; withKDE = false; withQt = true; }; + kid3 = kid3-kde; kile = libsForQt5.callPackage ../applications/editors/kile { };