1{ lib, stdenv, fetchFromGitHub, capstone, libbfd, libelf, libiberty, readline }:
2
3stdenv.mkDerivation {
4 pname = "wcc-unstable";
5 version = "2018-04-05";
6
7 src = fetchFromGitHub {
8 owner = "endrazine";
9 repo = "wcc";
10 rev = "f141963ff193d7e1931d41acde36d20d7221e74f";
11 sha256 = "1f0w869x0176n5nsq7m70r344gv5qvfmk7b58syc0jls8ghmjvb4";
12 fetchSubmodules = true;
13 };
14
15 buildInputs = [ capstone libbfd libelf libiberty readline ];
16
17 postPatch = ''
18 sed -i src/wsh/include/libwitch/wsh.h src/wsh/scripts/INDEX \
19 -e "s#/usr/share/wcc#$out/share/wcc#"
20
21 sed -i -e '/stropts.h>/d' src/wsh/include/libwitch/wsh.h
22 '';
23
24 installFlags = [ "DESTDIR=$(out)" ];
25
26 preInstall = ''
27 mkdir -p $out/usr/bin
28 '';
29
30 postInstall = ''
31 mv $out/usr/* $out
32 rmdir $out/usr
33 mkdir -p $out/share/man/man1
34 cp doc/manpages/*.1 $out/share/man/man1/
35 '';
36
37 preFixup = ''
38 # Let patchShebangs rewrite shebangs with wsh.
39 PATH+=:$out/bin
40 '';
41
42 enableParallelBuilding = true;
43
44 meta = with lib; {
45 homepage = "https://github.com/endrazine/wcc";
46 description = "Witchcraft compiler collection: tools to convert and script ELF files";
47 license = licenses.mit;
48 platforms = [ "x86_64-linux" ];
49 maintainers = with maintainers; [ orivej ];
50 };
51}