about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/wcc/default.nix
blob: 3196592da4850e37ed38f956e87f32b954541b25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
{ stdenv, fetchFromGitHub, capstone, libbfd, libelf, libiberty, readline }:

stdenv.mkDerivation rec {
  pname = "wcc-unstable";
  version = "2018-04-05";

  src = fetchFromGitHub {
    owner = "endrazine";
    repo = "wcc";
    rev = "f141963ff193d7e1931d41acde36d20d7221e74f";
    sha256 = "1f0w869x0176n5nsq7m70r344gv5qvfmk7b58syc0jls8ghmjvb4";
    fetchSubmodules = true;
  };

  buildInputs = [ capstone libbfd libelf libiberty readline ];

  postPatch = ''
    sed -i src/wsh/include/libwitch/wsh.h src/wsh/scripts/INDEX \
      -e "s#/usr/share/wcc#$out/share/wcc#"
  '';

  installFlags = [ "DESTDIR=$(out)" ];

  preInstall = ''
    mkdir -p $out/usr/bin
  '';

  postInstall = ''
    mv $out/usr/* $out
    rmdir $out/usr
    mkdir -p $out/share/man/man1
    cp doc/manpages/*.1 $out/share/man/man1/
  '';

  preFixup = ''
    # Let patchShebangs rewrite shebangs with wsh.
    PATH+=:$out/bin
  '';

  enableParallelBuilding = true;

  meta = with stdenv.lib; {
    homepage = https://github.com/endrazine/wcc;
    description = "Witchcraft compiler collection: tools to convert and script ELF files";
    license = licenses.mit;
    platforms = [ "x86_64-linux" ];
    maintainers = with maintainers; [ orivej ];
  };
}