1{
2 mkDerivation,
3 lib,
4 stdenv,
5 fetchFromGitHub,
6 fetchpatch,
7 qtbase,
8 vcg,
9 glew,
10 qmake,
11 libGLU,
12 eigen,
13 libGL,
14}:
15
16mkDerivation {
17 pname = "openbrf";
18 version = "unstable-2016-01-09";
19
20 src = fetchFromGitHub {
21 owner = "cfcohen";
22 repo = "openbrf";
23 rev = "4bdc66e38def5e5184f5379c84a7558b7484c70a";
24 sha256 = "16254cnr60ihcn7bki7wl1qm6gkvzb99cn66md1pnb7za8nvzf4j";
25 };
26
27 patches = [
28 # https://github.com/cfcohen/openbrf/pull/7
29 (fetchpatch {
30 name = "fix-build-against-newer-vcglib.patch";
31 url = "https://github.com/cfcohen/openbrf/commit/6d82a25314a393e72bfbe2ffc3965bcac407df4c.patch";
32 hash = "sha256-rNxAw6Le6QXMSirIAMhMmqVgNJLq6osnEOhWrY3mTpM=";
33 })
34 ];
35
36 buildInputs = [
37 qtbase
38 vcg
39 glew
40 eigen
41 ];
42
43 nativeBuildInputs = [ qmake ];
44
45 qmakeFlags = [ "openBrf.pro" ];
46
47 env.NIX_CFLAGS_COMPILE = "-isystem ${lib.getDev eigen}/include/eigen3";
48
49 postPatch = ''
50 sed -i 's,^VCGLIB .*,VCGLIB = ${vcg}/include,' openBrf.pro
51 '';
52
53 installPhase = ''
54 install -Dm755 openBrf $out/share/openBrf/openBrf
55 install -Dm644 carry_positions.txt $out/share/openBrf/carry_positions.txt
56 install -Dm644 reference.brf $out/share/openBrf/reference.brf
57
58 patchelf \
59 --set-rpath "${
60 lib.makeLibraryPath [
61 qtbase
62 glew
63 stdenv.cc.cc
64 libGLU
65 libGL
66 ]
67 }" \
68 $out/share/openBrf/openBrf
69
70 mkdir -p "$out/bin"
71 ln -s "$out/share/openBrf/openBrf" "$out/bin/openBrf"
72 '';
73
74 dontPatchELF = true;
75
76 meta = with lib; {
77 description = "Tool to edit resource files (BRF)";
78 mainProgram = "openBrf";
79 homepage = "https://github.com/cfcohen/openbrf";
80 maintainers = [ ];
81 license = licenses.free;
82 platforms = platforms.linux;
83 };
84}