 a19cd4ffb1
			
		
	
	
		a19cd4ffb1
		
	
	
	
	
		
			
			This reverts commit 65a333600d5c88a98d674f637d092807cfc12253. This wasn't tested for correctness with something like fodwatch [0], and should not have been (self-)merged so quickly, especially without further review. It also resulted in the breakage of at least one package [1] (and that's the one we know of and was caught). A few packages that were updated in between this commit and this revert were not reverted back to using `rev`, but other than that, this is a 1:1 revert. [0]: https://codeberg.org/raphaelr/fodwatch [1]: https://github.com/NixOS/nixpkgs/pull/396904 / 758551e4587d75882aebc21a04bee960418f8ce9
		
			
				
	
	
		
			83 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			83 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
| {
 | |
|   stdenv,
 | |
|   lib,
 | |
|   fetchFromGitHub,
 | |
|   elkhound,
 | |
|   ocaml-ng,
 | |
|   perl,
 | |
|   which,
 | |
|   fetchpatch,
 | |
| }:
 | |
| 
 | |
| let
 | |
|   # 1. Needs ocaml >= 4.04 and <= 4.11 (patched against 4.14)
 | |
|   # 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_14_unsafe_string.ocaml;
 | |
| 
 | |
| in
 | |
| stdenv.mkDerivation rec {
 | |
|   pname = "weidu";
 | |
|   version = "249.00";
 | |
| 
 | |
|   src = fetchFromGitHub {
 | |
|     owner = "WeiDUorg";
 | |
|     repo = "weidu";
 | |
|     rev = "v${version}";
 | |
|     sha256 = "sha256-+vkKTzFZdAzY2dL+mZ4A0PDxhTKGgs9bfArz7S6b4m4=";
 | |
|   };
 | |
| 
 | |
|   patches = [
 | |
|     (fetchpatch {
 | |
|       url = "https://github.com/WeiDUorg/weidu/commit/bb90190d8bf7d102952c07d8288a7dc6c7a3322e.patch";
 | |
|       hash = "sha256-Z4hHdMR1dYjJeERJSqlYynyPu2CvE6+XJuCr9ogDmvk=";
 | |
|     })
 | |
|   ];
 | |
| 
 | |
|   postPatch = ''
 | |
|     substitute sample.Configuration Configuration \
 | |
|       --replace /usr/bin ${lib.makeBinPath [ ocaml' ]} \
 | |
|       --replace /usr/local/bin ${lib.makeBinPath [ ocaml' ]} \
 | |
|       --replace elkhound ${elkhound}/bin/elkhound
 | |
| 
 | |
|     mkdir -p obj/{.depend,x86_LINUX}
 | |
| 
 | |
|     # undefined reference to `caml_hash_univ_param'
 | |
|     sed -i "20,21d;s/old_hash_param/hash_param/" hashtbl-4.03.0/myhashtbl.ml
 | |
|   '';
 | |
| 
 | |
|   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 Windows
 | |
|     platforms = platforms.unix;
 | |
|   };
 | |
| }
 |