diff --git a/pkgs/by-name/qt/qtwebapp/package.nix b/pkgs/by-name/qt/qtwebapp/package.nix index b495955f5a6c..c2f04ff5df82 100644 --- a/pkgs/by-name/qt/qtwebapp/package.nix +++ b/pkgs/by-name/qt/qtwebapp/package.nix @@ -1,9 +1,10 @@ { fetchFromGitHub, stdenv, + testers, + validatePkgConfig, lib, qt6, - ... }: stdenv.mkDerivation (finalAttrs: { pname = "qtwebapp"; @@ -15,6 +16,8 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-RbFgz2ed1eEVy44LX+milP4hPSeiabakU3TMvHYR7TU="; }; + __structuredAttrs = true; + sourceRoot = "source/QtWebApp"; postPatch = '' @@ -29,19 +32,47 @@ stdenv.mkDerivation (finalAttrs: { nativeBuildInputs = [ qt6.qmake qt6.wrapQtAppsHook + validatePkgConfig ]; - buildInputs = [ + propagatedBuildInputs = [ + # For libs in the pkg-config, they must be + # propagated so that packages that depend on + # it can properly use it. qt6.qtbase qt6.qt5compat ]; qmakeFlags = [ "QtWebApp.pro" ]; + pkgConfigFile = ./pkg-config.in; + + postInstall = '' + mkdir -p "$out/lib/pkgconfig" + cp "$pkgConfigFile" "$out/lib/pkgconfig/QtWebApp.pc" + substituteInPlace "$out/lib/pkgconfig/QtWebApp.pc" \ + --subst-var out \ + --subst-var version + + mkdir -p "$out/include/QtWebApp/httpserver" + cp httpserver/*.h "$out/include/QtWebApp/httpserver" + + mkdir -p "$out/include/QtWebApp/logging" + cp logging/*.h "$out/include/QtWebApp/logging" + + mkdir -p "$out/include/QtWebApp/templateengine" + cp templateengine/*.h "$out/include/QtWebApp/templateengine" + ''; + + passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + meta = { maintainers = with lib.maintainers; [ xddxdd ]; description = "HTTP server library in C++, inspired by Java Servlets"; homepage = "https://stefanfrings.de/qtwebapp/index-en.html"; license = lib.licenses.lgpl3Plus; + pkgConfigModules = [ + "QtWebApp" + ]; }; }) diff --git a/pkgs/by-name/qt/qtwebapp/pkg-config.in b/pkgs/by-name/qt/qtwebapp/pkg-config.in new file mode 100644 index 000000000000..265cbfda591a --- /dev/null +++ b/pkgs/by-name/qt/qtwebapp/pkg-config.in @@ -0,0 +1,14 @@ +prefix=@out@ +exec_prefix=${prefix} +libdir=${exec_prefix}/lib +includedir_http=${prefix}/include/QtWebApp/httpserver +includedir_logging=${prefix}/include/QtWebApp/logging +includedir_template=${prefix}/include/QtWebApp/templateengine + +Name: QtWebApp +Description: HTTP server and utility library in C++ +Version: @version@ +Requires: Qt6Network Qt6Core5Compat +Libs: -L${libdir} -lQtWebApp +Cflags: -I${includedir_http} -I${includedir_logging} -I${includedir_template} + diff --git a/pkgs/by-name/ya/yacreader/darwin-unarr-use-pkg-config.patch b/pkgs/by-name/ya/yacreader/darwin-unarr-use-pkg-config.patch deleted file mode 100644 index dff2b69df514..000000000000 --- a/pkgs/by-name/ya/yacreader/darwin-unarr-use-pkg-config.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/compressed_archive/unarr/unarr-wrapper.pri b/compressed_archive/unarr/unarr-wrapper.pri -index 0115267..5d3d6f5 100644 ---- a/compressed_archive/unarr/unarr-wrapper.pri -+++ b/compressed_archive/unarr/unarr-wrapper.pri -@@ -6,7 +6,7 @@ HEADERS += $$PWD/extract_delegate.h \ - - SOURCES += $$PWD/compressed_archive.cpp - --if(mingw|unix):!macx:!contains(QT_CONFIG, no-pkg-config):packagesExist(libunarr) { -+if(mingw|unix):!contains(QT_CONFIG, no-pkg-config):packagesExist(libunarr) { - message(Using system provided unarr installation found by pkg-config.) - CONFIG += link_pkgconfig - PKGCONFIG += libunarr diff --git a/pkgs/by-name/ya/yacreader/package.nix b/pkgs/by-name/ya/yacreader/package.nix index 1a9ed2c685b7..b678a634fa0d 100644 --- a/pkgs/by-name/ya/yacreader/package.nix +++ b/pkgs/by-name/ya/yacreader/package.nix @@ -2,50 +2,86 @@ lib, stdenv, fetchFromGitHub, + cmake, + pkg-config, + ctestCheckHook, libGLU, libunarr, - libsForQt5, - pkg-config, + expat, + libdeflate, + lerc, + xz, + libwebp, + qtwebapp, + pipewire, + qt6Packages, + onlyServer ? false, }: - +let + qtPackages = qt6Packages; +in stdenv.mkDerivation (finalAttrs: { pname = "yacreader"; - version = "9.16.3"; + version = "10.0.0"; src = fetchFromGitHub { owner = "YACReader"; repo = "yacreader"; tag = finalAttrs.version; - hash = "sha256-3mLmH6HJnH+LH/NkqI4G8Si5od3YiWnQ/kv5rmPFhlE="; + hash = "sha256-nJ4S4ej/I+ifDNa3CPpusFpDsEwZwYDt0JLaebptjuU="; }; patches = [ - # make the unarr backend logic use pkg-config even on Darwin - ./darwin-unarr-use-pkg-config.patch + # Devendor qtwebapp, use pkg-config instead + ./qtwebapp-devendor.patch ]; - qmakeFlags = [ + # Ensure devendor works + postPatch = '' + rm -rf third_party/QtWebApp + ''; + + # Pipewire is dlopen'd, so we must tell it where to look + preConfigure = '' + qtWrapperArgs+=("--prefix" "LD_LIBRARY_PATH" ":" "${lib.makeLibraryPath [ pipewire ]}") + ''; + + strictDeps = true; + __structuredAttrs = true; + + cmakeFlags = [ # force unarr backend on all platforms - "CONFIG+=unarr" + (lib.cmakeBool "BUILD_SERVER_STANDALONE" onlyServer) + (lib.cmakeFeature "PDF_BACKEND" "poppler") + (lib.cmakeFeature "DECOMPRESSION_BACKEND" "unarr") ]; nativeBuildInputs = [ - libsForQt5.qmake - libsForQt5.qttools # for translations - libsForQt5.wrapQtAppsHook + cmake pkg-config + qtPackages.wrapQtAppsHook ]; buildInputs = [ libGLU - libsForQt5.poppler - libsForQt5.qtgraphicaleffects # imported, but not declared as a dependency - libsForQt5.qtmultimedia - libsForQt5.qtquickcontrols2 libunarr - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - libsForQt5.qtmacextras # can be removed when using qt6 + expat + libdeflate + lerc + xz + libwebp + qtwebapp + qtPackages.qtbase + qtPackages.qttools + qtPackages.qtmultimedia + qtPackages.qtspeech + qtPackages.poppler + qtPackages.qt5compat + ]; + + doCheck = true; + nativeCheckInputs = [ + ctestCheckHook ]; # custom Darwin install instructions taken from the upstream compileOSX.sh script diff --git a/pkgs/by-name/ya/yacreader/qtwebapp-devendor.patch b/pkgs/by-name/ya/yacreader/qtwebapp-devendor.patch new file mode 100644 index 000000000000..0de92f2311ce --- /dev/null +++ b/pkgs/by-name/ya/yacreader/qtwebapp-devendor.patch @@ -0,0 +1,69 @@ +diff --git a/YACReaderLibrary/server/CMakeLists.txt b/YACReaderLibrary/server/CMakeLists.txt +index 839072efe4..8b8a2a5dd4 100644 +--- a/YACReaderLibrary/server/CMakeLists.txt ++++ b/YACReaderLibrary/server/CMakeLists.txt +@@ -77,10 +77,10 @@ + Qt6::Core + Qt6::Network + Qt6::Sql +- QtWebApp_httpserver +- QtWebApp_templateengine + QsLog + common_all + comic_backend + db_helper ++ PRIVATE ++ PkgConfig::QtWebApp + ) +diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt +index 512e57457f..787f334698 100644 +--- a/third_party/CMakeLists.txt ++++ b/third_party/CMakeLists.txt +@@ -31,45 +31,8 @@ + target_include_directories(QrCode PUBLIC QrCode) + + # --- QtWebApp HTTP server --- +-add_library(QtWebApp_httpserver STATIC +- QtWebApp/httpserver/httpglobal.cpp +- QtWebApp/httpserver/httplistener.cpp +- QtWebApp/httpserver/httpconnectionhandler.cpp +- QtWebApp/httpserver/httpconnectionhandlerpool.cpp +- QtWebApp/httpserver/httprequest.cpp +- QtWebApp/httpserver/httpresponse.cpp +- QtWebApp/httpserver/httpcookie.cpp +- QtWebApp/httpserver/httprequesthandler.cpp +- QtWebApp/httpserver/httpsession.cpp +- QtWebApp/httpserver/httpsessionstore.cpp +- QtWebApp/httpserver/staticfilecontroller.cpp +- QtWebApp/httpserver/httpglobal.h +- QtWebApp/httpserver/httplistener.h +- QtWebApp/httpserver/httpconnectionhandler.h +- QtWebApp/httpserver/httpconnectionhandlerpool.h +- QtWebApp/httpserver/httprequest.h +- QtWebApp/httpserver/httpresponse.h +- QtWebApp/httpserver/httpcookie.h +- QtWebApp/httpserver/httprequesthandler.h +- QtWebApp/httpserver/httpsession.h +- QtWebApp/httpserver/httpsessionstore.h +- QtWebApp/httpserver/staticfilecontroller.h +-) +-target_include_directories(QtWebApp_httpserver PUBLIC QtWebApp/httpserver) +-target_link_libraries(QtWebApp_httpserver PUBLIC Qt6::Network) +- +-# --- QtWebApp template engine --- +-add_library(QtWebApp_templateengine STATIC +- QtWebApp/templateengine/template.cpp +- QtWebApp/templateengine/templateloader.cpp +- QtWebApp/templateengine/templatecache.cpp +- QtWebApp/templateengine/templateglobal.h +- QtWebApp/templateengine/template.h +- QtWebApp/templateengine/templateloader.h +- QtWebApp/templateengine/templatecache.h +-) +-target_include_directories(QtWebApp_templateengine PUBLIC QtWebApp/templateengine) +-target_link_libraries(QtWebApp_templateengine PUBLIC Qt6::Core5Compat) ++find_package(PkgConfig REQUIRED) ++pkg_check_modules(QtWebApp REQUIRED IMPORTED_TARGET GLOBAL QtWebApp) + + # --- KDSignalThrottler (from KDToolBox) --- + add_library(KDSignalThrottler STATIC