at 23.11-beta 3.8 kB view raw
1{ coreutils, lib, stdenv, fetchgit, ant, jdk8, jdk11, git, xorg, udev, libGL, libGLU, mesa, xmlstarlet, xcbuild, darwin }: 2 3{ 4 jogl_2_4_0 = 5 let 6 version = "2.4.0"; 7 8 gluegen-src = fetchgit { 9 url = "git://jogamp.org/srv/scm/gluegen.git"; 10 rev = "v${version}"; 11 hash = "sha256-qQzq7v2vMFeia6gXaNHS3AbOp9HhDRgISp7P++CKErA="; 12 fetchSubmodules = true; 13 }; 14 jogl-src = fetchgit { 15 url = "git://jogamp.org/srv/scm/jogl.git"; 16 rev = "v${version}"; 17 hash = "sha256-PHDq7uFEQfJ2P0eXPUi0DGFR1ob/n5a68otgzpFnfzQ="; 18 fetchSubmodules = true; 19 }; 20 in 21 stdenv.mkDerivation { 22 pname = "jogl"; 23 inherit version; 24 25 srcs = [ gluegen-src jogl-src ]; 26 sourceRoot = "."; 27 28 unpackCmd = "cp -r $curSrc \${curSrc##*-}"; 29 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 33 ''; 34 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 ]; 39 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? 44 45 buildPhase = '' 46 ( cd gluegen/make 47 substituteInPlace ../src/java/com/jogamp/common/util/IOUtil.java --replace '#!/bin/true' '#!${coreutils}/bin/true' 48 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 53 54 ant -Dtarget.sourcelevel=8 -Dtarget.targetlevel=8 -Dtarget.rt.jar='null.jar' ) 55 56 ( cd jogl/make 57 58 # prevent looking for native libraries in /usr/lib 59 substituteInPlace build-*.xml \ 60 --replace 'dir="''${TARGET_PLATFORM_USRLIBS}"' "" 61 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 66 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 71 72 ant -Dtarget.sourcelevel=8 -Dtarget.targetlevel=8 -Dtarget.rt.jar='null.jar' ) 73 ''; 74 75 installPhase = '' 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/ 80 ''; 81 82 meta = with lib; { 83 description = "Java libraries for 3D Graphics, Multimedia and Processing"; 84 homepage = "https://jogamp.org/"; 85 license = licenses.bsd3; 86 platforms = platforms.all; 87 }; 88 }; 89}