Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchurl,
5 cmake,
6 libGLU,
7 libGL,
8 libglut,
9 glew,
10 libXmu,
11 libXext,
12 libX11,
13 fixDarwinDylibNames,
14}:
15
16stdenv.mkDerivation (finalAttrs: {
17 pname = "opencsg";
18 version = "1.8.1";
19
20 src = fetchurl {
21 url = "http://www.opencsg.org/OpenCSG-${finalAttrs.version}.tar.gz";
22 hash = "sha256-r8wASontO8R4qeS6ObIPPVibJOI+J1tzg/kaWQ1NV8U=";
23 };
24
25 patches = lib.optionals stdenv.hostPlatform.isDarwin [ ./opencsgexample.patch ];
26
27 nativeBuildInputs = [ cmake ] ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
28
29 buildInputs = [
30 glew
31 ]
32 ++ lib.optionals stdenv.hostPlatform.isLinux [
33 libGLU
34 libGL
35 libglut
36 libXmu
37 libXext
38 libX11
39 ];
40
41 doCheck = false;
42
43 postInstall = ''
44 install -D ../copying.txt "$out/share/doc/opencsg/copying.txt"
45 '';
46
47 postFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
48 app=$out/Applications/opencsgexample.app/Contents/MacOS/opencsgexample
49 install_name_tool -change \
50 $(otool -L $app | awk '/opencsg.+dylib/ { print $1 }') \
51 $(otool -D $out/lib/libopencsg.dylib | tail -n 1) \
52 $app
53 '';
54
55 meta = {
56 description = "Constructive Solid Geometry library";
57 mainProgram = "opencsgexample";
58 homepage = "http://www.opencsg.org/";
59 platforms = lib.platforms.unix;
60 maintainers = [ lib.maintainers.raskin ];
61 license = lib.licenses.gpl2Plus;
62 };
63})