summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/co/construo/package.nix
blob: fdfe5ec1e49c6acb256b4116f610488db1ddf5be (plain)
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
46
47
48
49
50
51
52
53
54
55
56
{
  lib,
  stdenv,
  fetchurl,
  libx11,
  zlib,
  xorgproto,
  withLibGL ? !stdenv.hostPlatform.isDarwin,
  libGL,
  withLibGLU ? !stdenv.hostPlatform.isDarwin,
  libGLU,
  withLibglut ? !stdenv.hostPlatform.isDarwin,
  libglut,
  apple-sdk,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "construo";
  version = "0.2.3";

  src = fetchurl {
    url = "https://github.com/Construo/construo/releases/download/v${finalAttrs.version}/construo-${finalAttrs.version}.tar.gz";
    sha256 = "1wmj527hbj1qv44cdsj6ahfjrnrjwg2dp8gdick8nd07vm062qxa";
  };

  buildInputs = [
    libx11
    zlib
    xorgproto
  ]
  ++ lib.optional withLibGL libGL
  ++ lib.optional withLibGLU libGLU
  ++ lib.optional withLibglut libglut
  ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk ];

  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
    substituteInPlace configure --replace-fail \
      '-I/System/Library/Frameworks/GLUT.framework/Headers/' \
      '-I${apple-sdk}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/GLUT.framework/Headers/'
  '';

  preConfigure = ''
    substituteInPlace src/Makefile.in \
      --replace games bin
  '';

  env.CXXFLAGS = "-std=c++98";

  meta = {
    description = "Masses and springs simulation game";
    mainProgram = "construo.x11";
    homepage = "http://fs.fsf.org/construo/";
    license = lib.licenses.gpl3;
    priority = 10;
  };
})