about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOPNA2608 <christoph.neidahl@gmail.com>2023-01-31 14:19:40 +0100
committerOPNA2608 <christoph.neidahl@gmail.com>2023-01-31 14:19:40 +0100
commit1497498503e3578418ff93de4180ca00f5ca900a (patch)
treeff274506789f191b6ae824867d413cbf8e6058a9
parente15d68cb218353dd4f172b48061560bed819af3a (diff)
alice-tools,alice-tools-qt5,alice-tools-qt6: init at 0.12.1
-rw-r--r--pkgs/tools/games/alice-tools/default.nix106
-rw-r--r--pkgs/top-level/all-packages.nix8
2 files changed, 114 insertions, 0 deletions
diff --git a/pkgs/tools/games/alice-tools/default.nix b/pkgs/tools/games/alice-tools/default.nix
new file mode 100644
index 0000000000000..0aed7016feac8
--- /dev/null
+++ b/pkgs/tools/games/alice-tools/default.nix
@@ -0,0 +1,106 @@
+{ stdenv
+, lib
+, gitUpdater
+, fetchFromGitHub
+, fetchpatch
+, meson
+, ninja
+, pkg-config
+, bison
+, flex
+, libiconv
+, libpng
+, libjpeg
+, libwebp
+, zlib
+, withGUI ? true
+, qtbase ? null
+, wrapQtAppsHook ? null
+}:
+
+assert withGUI -> qtbase != null && wrapQtAppsHook != null;
+
+stdenv.mkDerivation rec {
+  pname = "alice-tools";
+  version = "0.12.1";
+
+  src = fetchFromGitHub {
+    owner = "nunuhara";
+    repo = "alice-tools";
+    rev = version;
+    fetchSubmodules = true;
+    hash = "sha256-uXiNNneAOTDupgc+ZvaeRNbEQFJBv4ppdEc3kZeUsg8=";
+  };
+
+  patches = [
+    # These two patches (one to alice-tools, one to a subproject) improve DCF & PCF parsing
+    # Remove them when version > 0.12.1
+    (fetchpatch {
+      url = "https://github.com/nunuhara/alice-tools/commit/c800e85b37998d7a47060f5da4b1782d7201a042.patch";
+      excludes = [ "subprojects/libsys4" ];
+      hash = "sha256-R5ckFHqUWHdAPkFa53UbVeLgxJg/8qGLTQWwj5YRJc4=";
+    })
+    (fetchpatch {
+      url = "https://github.com/nunuhara/libsys4/commit/cff2b826d1618fb17616cdd288ab0c50f35e8032.patch";
+      stripLen = 1;
+      extraPrefix = "subprojects/libsys4/";
+      hash = "sha256-CmetiVP2kGL+MwuE9OoEDrDFxzwWvv1TtZuq1li1uIw=";
+    })
+  ];
+
+  postPatch = lib.optionalString (withGUI && lib.versionAtLeast qtbase.version "6.0") ''
+    substituteInPlace src/meson.build \
+      --replace qt5 qt6
+  '';
+
+  mesonFlags = lib.optionals (withGUI && lib.versionAtLeast qtbase.version "6.0") [
+    # Qt6 requires at least C++17, project uses compiler's default, default too old on Darwin & aarch64-linux
+    "-Dcpp_std=c++17"
+  ];
+
+  nativeBuildInputs = [
+    meson
+    ninja
+    pkg-config
+    bison
+    flex
+  ] ++ lib.optionals withGUI [
+    wrapQtAppsHook
+  ];
+
+  buildInputs = [
+    libiconv
+    libpng
+    libjpeg
+    libwebp
+    zlib
+  ] ++ lib.optionals withGUI [
+    qtbase
+  ];
+
+  dontWrapQtApps = true;
+
+  # Default install step only installs a static library of a build dependency
+  installPhase = ''
+    runHook preInstall
+
+    install -Dm755 src/alice $out/bin/alice
+  '' + lib.optionalString withGUI ''
+    install -Dm755 src/galice $out/bin/galice
+    wrapQtApp $out/bin/galice
+  '' + ''
+
+    runHook postInstall
+  '';
+
+  passthru.updateScript = gitUpdater { };
+
+  meta = with lib; {
+    description = "Tools for extracting/editing files from AliceSoft games";
+    homepage = "https://github.com/nunuhara/alice-tools";
+    license = licenses.gpl2Plus;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ OPNA2608 ];
+    mainProgram = if withGUI then "galice" else "alice";
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index e49545db3510b..e192738a2ec0f 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1361,6 +1361,14 @@ with pkgs;
 
   albert = libsForQt5.callPackage ../applications/misc/albert {};
 
+  alice-tools = callPackage ../tools/games/alice-tools {
+    withGUI = false;
+  };
+
+  alice-tools-qt5 = libsForQt5.callPackage ../tools/games/alice-tools { };
+
+  alice-tools-qt6 = qt6Packages.callPackage ../tools/games/alice-tools { };
+
   allure = callPackage ../development/tools/allure {};
 
   aquosctl = callPackage ../tools/misc/aquosctl { };