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