1 { coreutils, lib, stdenv, fetchgit, ant, jdk8, jdk11, git, xorg, udev, libGL, libGLU, mesa, xmlstarlet, xcbuild, darwin }:
8 gluegen-src = fetchgit {
9 url = "git://jogamp.org/srv/scm/gluegen.git";
11 hash = "sha256-qQzq7v2vMFeia6gXaNHS3AbOp9HhDRgISp7P++CKErA=";
12 fetchSubmodules = true;
15 url = "git://jogamp.org/srv/scm/jogl.git";
17 hash = "sha256-PHDq7uFEQfJ2P0eXPUi0DGFR1ob/n5a68otgzpFnfzQ=";
18 fetchSubmodules = true;
25 srcs = [ gluegen-src jogl-src ];
28 unpackCmd = "cp -r $curSrc \${curSrc##*-}";
30 postPatch = lib.optionalString stdenv.isDarwin ''
31 sed -i '/if="use.macos/d' gluegen/make/gluegen-cpptasks-base.xml
32 rm -r jogl/oculusvr-sdk
35 nativeBuildInputs = [ ant jdk11 git xmlstarlet ]
36 ++ lib.optionals stdenv.isDarwin [ xcbuild ];
37 buildInputs = lib.optionals stdenv.isLinux [ udev xorg.libX11 xorg.libXrandr xorg.libXcursor xorg.libXi xorg.libXt xorg.libXxf86vm xorg.libXrender mesa ]
38 ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk_11_0.frameworks.AppKit darwin.apple_sdk_11_0.frameworks.Cocoa ];
40 # Workaround build failure on -fno-common toolchains:
41 # ld: ../obj/Bindingtest1p1Impl_JNI.o:(.bss+0x8): multiple definition of
42 # `unsigned_size_t_1'; ../obj/TK_Surface_JNI.o:(.bss+0x8): first defined here
43 NIX_CFLAGS_COMPILE = "-fcommon"; # copied from 2.3.2, is this still needed?
47 substituteInPlace ../src/java/com/jogamp/common/util/IOUtil.java --replace '#!/bin/true' '#!${coreutils}/bin/true'
49 # set timestamp of files in jar to a fixed point in time
50 xmlstarlet ed --inplace \
51 --append //jar --type attr -n modificationtime --value 1980-01-01T00:00Z \
52 build.xml gluegen-cpptasks-base.xml
54 ant -Dtarget.sourcelevel=8 -Dtarget.targetlevel=8 -Dtarget.rt.jar='null.jar' )
58 # prevent looking for native libraries in /usr/lib
59 substituteInPlace build-*.xml \
60 --replace 'dir="''${TARGET_PLATFORM_USRLIBS}"' ""
62 # force way to do disfunctional "ant -Dsetup.addNativeBroadcom=false" and disable dependency on raspberrypi drivers
63 # if arm/aarch64 support will be added, this block might be commented out on those platforms
64 # on x86 compiling with default "setup.addNativeBroadcom=true" leads to unsatisfied import "vc_dispmanx_resource_delete" in libnewt.so
65 xmlstarlet ed --inplace --delete '//*[@if="setup.addNativeBroadcom"]' build-newt.xml
67 # set timestamp of files in jar to a fixed point in time
68 xmlstarlet ed --inplace \
69 --append //jar --type attr -n modificationtime --value 1980-01-01T00:00Z \
70 build.xml build-nativewindow.xml build-jogl.xml
72 ant -Dtarget.sourcelevel=8 -Dtarget.targetlevel=8 -Dtarget.rt.jar='null.jar' )
76 mkdir -p $out/share/java
77 cp -v $NIX_BUILD_TOP/gluegen/build/gluegen-rt{,-natives-linux-*}.jar $out/share/java/
78 cp -v $NIX_BUILD_TOP/jogl/build/jar/jogl-all{,-natives-linux-*}.jar $out/share/java/
79 cp -v $NIX_BUILD_TOP/jogl/build/nativewindow/nativewindow{,-awt,-natives-linux-*,-os-drm,-os-x11}.jar $out/share/java/
83 description = "Java libraries for 3D Graphics, Multimedia and Processing";
84 homepage = "https://jogamp.org/";
85 license = licenses.bsd3;
86 platforms = platforms.all;