about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/ogre/default.nix
blob: e93dfdfb144e7217330e5c0d127a37471d34dc9a (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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{ fetchFromGitHub
, stdenv
, lib
, cmake
, libGLU
, libGL
, freetype
, freeimage
, zziplib
, xorgproto
, libXrandr
, libXaw
, freeglut
, libXt
, libpng
, boost
, ois
, libX11
, libXmu
, libSM
, pkg-config
, libXxf86vm
, libICE
, unzip
, libXrender
, SDL2
, withNvidiaCg ? false
, nvidia_cg_toolkit
, withSamples ? false
}:

stdenv.mkDerivation rec {
  pname = "ogre";
  version = "1.12.1";

  src = fetchFromGitHub {
    owner = "OGRECave";
    repo = "ogre";
    rev = "v${version}";
    sha256 = "sha256-FHW0+DZhw6MLlhjh4DRYhA+6vBBXMN9K6GEVoR6P5kM=";
  };

  # fix for ARM. sys/sysctl.h has moved in later glibcs, and
  # https://github.com/OGRECave/ogre-next/issues/132 suggests it isn't
  # needed anyway.
  postPatch = ''
    substituteInPlace OgreMain/src/OgrePlatformInformation.cpp \
      --replace '#include <sys/sysctl.h>' ""
  '';

  cmakeFlags = [ "-DOGRE_BUILD_DEPENDENCIES=OFF" "-DOGRE_BUILD_SAMPLES=${toString withSamples}" ]
    ++ map (x: "-DOGRE_BUILD_PLUGIN_${x}=on")
    ([ "BSP" "OCTREE" "PCZ" "PFX" ] ++ lib.optional withNvidiaCg "CG")
    ++ map (x: "-DOGRE_BUILD_RENDERSYSTEM_${x}=on") [ "GL" ];


  nativeBuildInputs = [ cmake unzip pkg-config ];
  buildInputs =
    [
      cmake
      libGLU
      libGL
      freetype
      freeimage
      zziplib
      xorgproto
      libXrandr
      libXaw
      freeglut
      libXt
      libpng
      boost
      ois
      libX11
      libXmu
      libSM
      libXxf86vm
      libICE
      libXrender
      SDL2
    ] ++ lib.optional withNvidiaCg nvidia_cg_toolkit;

  meta = {
    description = "A 3D engine";
    homepage = "https://www.ogre3d.org/";
    maintainers = [ lib.maintainers.raskin ];
    platforms = lib.platforms.linux;
    license = lib.licenses.mit;
  };
}