1{ stdenv, fetchgit, ant, jdk, openjdk8, zulu8, git, xorg, udev, libGL, libGLU }:
2
3let
4 # workaround https://github.com/NixOS/nixpkgs/issues/37364
5 jdk-without-symlinks = if jdk == openjdk8 then zulu8 else jdk;
6in
7{
8 jogl_2_3_2 =
9 let
10 version = "2.3.2";
11
12 gluegen-src = fetchgit {
13 url = git://jogamp.org/srv/scm/gluegen.git;
14 rev = "v${version}";
15 sha256 = "00hybisjwqs88p24dds652bzrwbbmhn2dpx56kp4j6xpadkp33d0";
16 fetchSubmodules = true;
17 };
18 in stdenv.mkDerivation rec {
19 name = "jogl-${version}";
20
21 src = fetchgit {
22 url = git://jogamp.org/srv/scm/jogl.git;
23 rev = "v${version}";
24 sha256 = "0msi2gxiqm2yqwkmxqbh521xdrimw1fly20g890r357rcgj8fsn3";
25 fetchSubmodules = true;
26 };
27
28 postPatch = ''
29 find . -type f -name '*.java' \
30 -exec sed -i 's@"libGL.so"@"${libGL}/lib/libGL.so"@' {} \; \
31 -exec sed -i 's@"libGLU.so"@"${libGLU}/lib/libGLU.so"@' {} \;
32 '';
33
34 buildInputs = [ jdk-without-symlinks ant git udev xorg.libX11 xorg.libXrandr xorg.libXcursor xorg.libXt xorg.libXxf86vm xorg.libXrender ];
35
36 buildPhase = ''
37 cp -r ${gluegen-src} $NIX_BUILD_TOP/gluegen
38 chmod -R +w $NIX_BUILD_TOP/gluegen
39 ( cd ../gluegen/make
40 ant )
41
42 ( cd make
43
44 # force way to do disfunctional "ant -Dsetup.addNativeBroadcom=false" and disable dependency on raspberrypi drivers
45 # if arm/aarch64 support will be added, this block might be commented out on those platforms
46 # on x86 compiling with default "setup.addNativeBroadcom=true" leads to unsatisfied import "vc_dispmanx_resource_delete" in libnewt.so
47 cp build-newt.xml build-newt.xml.old
48 fgrep -v 'if="setup.addNativeBroadcom"' build-newt.xml.old > build-newt.xml
49
50 ant )
51 '';
52
53 installPhase = ''
54 mkdir -p $out/share/java
55 cp $NIX_BUILD_TOP/gluegen/build/gluegen-rt{,-natives-linux-amd64}.jar $out/share/java/
56 cp $NIX_BUILD_TOP/jogl/build/jar/jogl-all{,-natives-linux-amd64}.jar $out/share/java/
57 '';
58
59 meta = with stdenv.lib; {
60 description = "Java libraries for 3D Graphics, Multimedia and Processing";
61 homepage = http://jogamp.org/;
62 license = licenses.bsd3;
63 platforms = [ "x86_64-linux" ];
64 };
65 };
66}