diff --git a/pkgs/games/qzdl/default.nix b/pkgs/games/qzdl/default.nix new file mode 100644 index 000000000000..0b44328fb8e4 --- /dev/null +++ b/pkgs/games/qzdl/default.nix @@ -0,0 +1,65 @@ +{ lib +, stdenv +, fetchFromGitHub +, cmake +, inih +, ninja +, pkg-config +, qtbase +, wrapQtAppsHook +, makeDesktopItem +, copyDesktopItems +}: + +stdenv.mkDerivation rec { + pname = "qzdl"; + version = "unstable-2023-04-04"; + + src = fetchFromGitHub { + owner = "qbasicer"; + repo = "qzdl"; + rev = "44aaec0182e781a3cef373e5c795c9dbd9cd61bb"; + hash = "sha256-K/mJQb7uO2H94krWJIJtFRYd6BAe2TX1xBt6fGBb1tA="; + }; + + patches = [ + ./non-bundled-inih.patch + ]; + + nativeBuildInputs = [ + cmake + copyDesktopItems + ninja + pkg-config + wrapQtAppsHook + ]; + + buildInputs = [ + inih + qtbase + ]; + + postInstall = '' + install -Dm644 $src/res/zdl3.svg $out/share/icons/hicolor/scalable/apps/zdl3.svg + ''; + + desktopItems = [ + (makeDesktopItem { + name = "zdl3"; + exec = "zdl %U"; + icon = "zdl3"; + desktopName = "ZDL"; + genericName = "A ZDoom WAD Launcher"; + categories = [ "Game" ]; + }) + ]; + + meta = with lib; { + description = "A ZDoom WAD Launcher"; + homepage = "https://zdl.vectec.net"; + license = licenses.gpl3Only; + inherit (qtbase.meta) platforms; + maintainers = with maintainers; [ azahi ]; + mainProgram = "zdl"; + }; +} diff --git a/pkgs/games/qzdl/non-bundled-inih.patch b/pkgs/games/qzdl/non-bundled-inih.patch new file mode 100644 index 000000000000..7e47dd8c2017 --- /dev/null +++ b/pkgs/games/qzdl/non-bundled-inih.patch @@ -0,0 +1,36 @@ +diff --git i/CMakeLists.txt w/CMakeLists.txt +index 10a8fb6..dcab540 100644 +--- i/CMakeLists.txt ++++ w/CMakeLists.txt +@@ -6,16 +6,8 @@ set(CMAKE_AUTOMOC ON) + project(qzdl LANGUAGES C CXX) + find_package(Qt5 COMPONENTS Core Widgets REQUIRED) + +-include(FetchContent) +-FetchContent_Declare( +- inih +- GIT_REPOSITORY https://github.com/benhoyt/inih.git +- GIT_TAG r44 +-) +-FetchContent_GetProperties(inih) +-if (NOT inih_POPULATED) +- FetchContent_Populate(inih) +-endif() ++find_package(PkgConfig) ++pkg_check_modules(INIH inih) + + add_executable( + zdl +@@ -45,9 +37,8 @@ add_executable( + libwad.cpp + qzdl.cpp + ${PROJECT_SOURCE_DIR}/zdlconf/zdlconf.cpp +- ${inih_SOURCE_DIR}/ini.c + ) + +-target_include_directories(zdl PRIVATE ${PROJECT_SOURCE_DIR}/zdlconf) +-target_include_directories(zdl PRIVATE ${inih_SOURCE_DIR}) +-target_link_libraries(zdl Qt5::Core Qt5::Widgets) ++target_include_directories(zdl PRIVATE ${PROJECT_SOURCE_DIR}/zdlconf ${INIH_INCLUDEDIR}) ++target_link_libraries(zdl Qt5::Core Qt5::Widgets ${INIH_LDFLAGS}) ++install(TARGETS zdl RUNTIME DESTINATION "bin") diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b60528b1fb00..078511c8304a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -40449,6 +40449,8 @@ with pkgs; qperf = callPackage ../os-specific/linux/qperf { }; + qzdl = libsForQt5.callPackage ../games/qzdl { }; + rates = callPackage ../tools/misc/rates { inherit (darwin.apple_sdk.frameworks) Security; };