anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / applications / misc / openbrf / default.nix
blobd2419ae25b9ec464f1af5c11e68fc64d44bd5812
1 { mkDerivation, lib, stdenv, fetchFromGitHub, fetchpatch, qtbase, vcg, glew, qmake, libGLU, eigen, libGL }:
4 mkDerivation {
5   pname = "openbrf";
6   version = "unstable-2016-01-09";
8   src = fetchFromGitHub {
9     owner = "cfcohen";
10     repo = "openbrf";
11     rev = "4bdc66e38def5e5184f5379c84a7558b7484c70a";
12     sha256 = "16254cnr60ihcn7bki7wl1qm6gkvzb99cn66md1pnb7za8nvzf4j";
13   };
15   patches = [
16     # https://github.com/cfcohen/openbrf/pull/7
17     (fetchpatch {
18       name = "fix-build-against-newer-vcglib.patch";
19       url = "https://github.com/cfcohen/openbrf/commit/6d82a25314a393e72bfbe2ffc3965bcac407df4c.patch";
20       hash = "sha256-rNxAw6Le6QXMSirIAMhMmqVgNJLq6osnEOhWrY3mTpM=";
21     })
22   ];
24   buildInputs = [ qtbase vcg glew eigen ];
26   nativeBuildInputs = [ qmake ];
28   qmakeFlags = [ "openBrf.pro" ];
30   env.NIX_CFLAGS_COMPILE = "-isystem ${lib.getDev eigen}/include/eigen3";
32   postPatch = ''
33     sed -i 's,^VCGLIB .*,VCGLIB = ${vcg}/include,' openBrf.pro
34   '';
36   installPhase = ''
37     install -Dm755 openBrf $out/share/openBrf/openBrf
38     install -Dm644 carry_positions.txt $out/share/openBrf/carry_positions.txt
39     install -Dm644 reference.brf $out/share/openBrf/reference.brf
41     patchelf  \
42       --set-rpath "${lib.makeLibraryPath [ qtbase glew stdenv.cc.cc libGLU libGL ]}" \
43       $out/share/openBrf/openBrf
45     mkdir -p "$out/bin"
46     ln -s "$out/share/openBrf/openBrf" "$out/bin/openBrf"
47   '';
49   dontPatchELF = true;
51   meta = with lib; {
52     description = "Tool to edit resource files (BRF)";
53     mainProgram = "openBrf";
54     homepage = "https://github.com/cfcohen/openbrf";
55     maintainers = with lib.maintainers; [ abbradar ];
56     license = licenses.free;
57     platforms = platforms.linux;
58   };