about summary refs log tree commit diff
path: root/pkgs/games/qzdl
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2023-08-01 15:05:59 +0300
committerAzat Bahawi <azat@bahawi.net>2023-08-01 15:31:37 +0300
commitcc5cd006dba90094845e454a9c0c5b9e91b1a361 (patch)
treee877039eaf0bef5c0194dd83a358cc62857cffe7 /pkgs/games/qzdl
parent2283bf968f3b6a2f100d81fb43db6d91f6aea706 (diff)
qzdl: init at unstable-2023-04-04
Diffstat (limited to 'pkgs/games/qzdl')
-rw-r--r--pkgs/games/qzdl/default.nix65
-rw-r--r--pkgs/games/qzdl/non-bundled-inih.patch36
2 files changed, 101 insertions, 0 deletions
diff --git a/pkgs/games/qzdl/default.nix b/pkgs/games/qzdl/default.nix
new file mode 100644
index 0000000000000..0b44328fb8e4c
--- /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 0000000000000..7e47dd8c20172
--- /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")