about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/programming/scyther/cli.nix
blob: 6623f5def4cb7f573a076fe7be8ba3a8397341f3 (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
{ stdenv, glibc, flex, bison, cmake
, version, src, meta }:
stdenv.mkDerivation {
  pname = "scyther-cli";
  inherit version;

  inherit src meta;

  buildInputs = [
    cmake
    glibc.static
    flex
    bison
  ];

  patchPhase = ''
    # Since we're not in a git dir, the normal command this project uses to create this file wouldn't work
    printf "%s\n" "#define TAGVERSION \"${version}\"" > src/version.h
  '';

  configurePhase = ''
    (cd src && cmakeConfigurePhase)
  '';

  dontUseCmakeBuildDir = true;
  cmakeFlags = [ "-DCMAKE_C_FLAGS=-std=gnu89" ];

  installPhase = ''
    mkdir -p "$out/bin"
    mv src/scyther-linux "$out/bin/scyther-cli"
    ln -s "$out/bin/scyther-cli" "$out/bin/scyther-linux"
  '';
}