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} +