summary refs log tree commit diff
path: root/pkgs/applications/graphics/wings/default.nix
blob: 9ecf94e21c0128cc4d8cacc67ae2814c7b6964d9 (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
{ fetchurl, stdenv, erlang, esdl, cl }:

stdenv.mkDerivation rec {
  name = "wings-1.5.4";
  src = fetchurl {
    url = "mirror://sourceforge/wings/${name}.tar.bz2";
    sha256 = "0qz6rmmkqgk3p0d3v2ikkf22n511bq0m7xp3kkradwrp28fcl15x";
  };

  ERL_LIBS = "${esdl}/lib/erlang/lib:${cl}/lib/erlang/lib";

  patchPhase = ''
    sed -i 's,include("sdl_keyboard.hrl"),include_lib("esdl/include/sdl_keyboard.hrl"),' \
      src/wings_body.erl plugins_src/commands/wpc_constraints.erl

    # Fix reference
    sed -i 's,wings/e3d/,,' plugins_src/import_export/wpc_lwo.erl
  '';

  buildInputs = [ erlang esdl cl ];

  # I did not test the *cl* part. I added the -pa just by imitation.
  installPhase = ''
    mkdir -p $out/bin $out/lib/${name}/ebin
    cp ebin/* $out/lib/${name}/ebin
    cp -R fonts textures shaders plugins $out/lib/$name
    cat << EOF > $out/bin/wings
    #!/bin/sh
    ${erlang}/bin/erl -smp disable \
      -pa ${esdl}/lib/erlang/lib/${cl.name}/ebin \
      -pa ${esdl}/lib/erlang/lib/${esdl.name}/ebin \
      -pa $out/lib/${name}/ebin -run wings_start start_halt "$@"
    EOF
    chmod +x $out/bin/wings
  '';

  meta = {
    homepage = http://www.wings3d.com/;
    description = "Subdivision modeler inspired by Nendo and Mirai from Izware";
    license = "BSD";
    maintainers = with stdenv.lib.maintainers; [viric];
    platforms = with stdenv.lib.platforms; linux;
  };
}