1{ lib, stdenv, fetchurl, qt4, qmake4Hook, unzip, libGLU, makeWrapper }:
2
3stdenv.mkDerivation rec {
4 pname = "structure-synth";
5 version = "1.5.0";
6
7 src = fetchurl {
8 url = "mirror://sourceforge/structuresynth/StructureSynth-Source-v${version}.zip";
9 sha256 = "1kiammx46719az6jzrav8yrwz82nk4m72ybj0kpbnvp9wfl3swbb";
10 };
11
12 buildInputs = [ qt4 libGLU ];
13 nativeBuildInputs = [ qmake4Hook makeWrapper unzip ];
14
15 # Thanks to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=672000#15:
16 patches = [ ./gcc47.patch ];
17
18 enableParallelBuilding = true;
19
20 preConfigure = ''
21 ${qt4}/bin/qmake -project -after "CONFIG+=opengl" -after "QT+=xml opengl script" -after "unix:LIBS+=-lGLU"
22 '';
23
24 installPhase = ''
25 mkdir -p $out/bin;
26 mkdir -p $out/share/Examples $out/share/Misc;
27 cp "Structure Synth Source Code" $out/bin/structure-synth;
28 cp -r Examples/* $out/share/Examples;
29 cp -r Misc/* $out/share/Misc;
30 '';
31
32 # Structure Synth expects to see 'Examples' and 'Misc' directory in
33 # either $HOME or $PWD - so help it along by moving $PWD to 'share',
34 # where we just copied those two directories:
35 preFixup = ''
36 wrapProgram "$out/bin/structure-synth" --chdir "$out/share"
37 '';
38
39 meta = with lib; {
40 description = "Application for generating 3D structures by specifying a design grammar";
41 homepage = "http://structuresynth.sourceforge.net";
42 maintainers = with maintainers; [ hodapp ];
43 license = licenses.gpl3;
44 platforms = platforms.linux;
45 };
46}