about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/games
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-07-09 12:30:28 +0000
committerAlyssa Ross <hi@alyssa.is>2021-07-23 09:11:31 +0000
commit55cc63c079f49e81d695a25bc2f5b3902f2bd290 (patch)
treee705335d97f50b927c76ccb4a3fbde9fab8372b9 /nixpkgs/pkgs/tools/games
parentc26eb6f74d9393127a21eee7a9620a920769f613 (diff)
parent87807e64a5ef5206b745a40af118c7be8db73681 (diff)
downloadnixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.tar
nixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.tar.gz
nixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.tar.bz2
nixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.tar.lz
nixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.tar.xz
nixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.tar.zst
nixlib-55cc63c079f49e81d695a25bc2f5b3902f2bd290.zip
Merge commit '87807e64a5ef5206b745a40af118c7be8db73681'
Diffstat (limited to 'nixpkgs/pkgs/tools/games')
-rw-r--r--nixpkgs/pkgs/tools/games/weidu/default.nix65
1 files changed, 65 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/games/weidu/default.nix b/nixpkgs/pkgs/tools/games/weidu/default.nix
new file mode 100644
index 000000000000..d325746dc8ca
--- /dev/null
+++ b/nixpkgs/pkgs/tools/games/weidu/default.nix
@@ -0,0 +1,65 @@
+{ stdenv
+, lib
+, fetchFromGitHub
+, elkhound
+, ocaml-ng
+, perl
+, which
+}:
+
+let
+  # 1. Needs ocaml >= 4.04 and <= 4.11
+  # 2. ocaml 4.10 defaults to safe (immutable) strings so we need a version with
+  #    that disabled as weidu is strongly dependent on mutable strings
+  ocaml' = ocaml-ng.ocamlPackages_4_10.ocaml.overrideAttrs (old: {
+    configureFlags = old.configureFlags ++ [
+      # https://github.com/WeiDUorg/weidu/issues/197
+      "--disable-force-safe-string"
+    ];
+  });
+
+in
+stdenv.mkDerivation rec {
+  pname = "weidu";
+  version = "247.00";
+
+  src = fetchFromGitHub {
+    owner = "WeiDUorg";
+    repo = pname;
+    rev = "v${version}";
+    sha256 = "sha256-vAIIYn0urQnnL82mdfwJtahrS3uWPFferm+0F13TKcw=";
+  };
+
+  postPatch = ''
+    substitute sample.Configuration Configuration \
+      --replace /usr/bin ${lib.makeBinPath [ ocaml' ]} \
+      --replace elkhound ${elkhound}/bin/elkhound
+
+    mkdir -p obj/{.depend,x86_LINUX}
+  '';
+
+  nativeBuildInputs = [ elkhound ocaml' perl which ];
+
+  buildFlags = [ "weidu" "weinstall" "tolower" ];
+
+  installPhase = ''
+    runHook preInstall
+
+    for b in tolower weidu weinstall; do
+      install -Dm555 $b.asm.exe $out/bin/$b
+    done
+
+    install -Dm444 -t $out/share/doc/weidu README* COPYING
+
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "InfinityEngine Modding Engine";
+    homepage = "https://weidu.org";
+    license = licenses.gpl2Only;
+    maintainers = with maintainers; [ peterhoeg ];
+    # should work fine on both Darwin and Windows
+    platforms = platforms.linux;
+  };
+}