nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 128 lines 3.3 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchgit, 5 ant, 6 jdk11, 7 git, 8 xmlstarlet, 9 stripJavaArchivesHook, 10 xcbuild, 11 udev, 12 xorg, 13 libgbm, 14 coreutils, 15}: 16 17let 18 version = "2.4.0"; 19 20 gluegen-src = fetchgit { 21 url = "git://jogamp.org/srv/scm/gluegen.git"; 22 rev = "v${version}"; 23 hash = "sha256-qQzq7v2vMFeia6gXaNHS3AbOp9HhDRgISp7P++CKErA="; 24 fetchSubmodules = true; 25 }; 26 jogl-src = fetchgit { 27 url = "git://jogamp.org/srv/scm/jogl.git"; 28 rev = "v${version}"; 29 hash = "sha256-PHDq7uFEQfJ2P0eXPUi0DGFR1ob/n5a68otgzpFnfzQ="; 30 fetchSubmodules = true; 31 }; 32in 33stdenv.mkDerivation { 34 pname = "jogl"; 35 inherit version; 36 37 srcs = [ 38 gluegen-src 39 jogl-src 40 ]; 41 sourceRoot = "."; 42 43 unpackCmd = "cp -r $curSrc \${curSrc##*-}"; 44 45 postPatch = '' 46 substituteInPlace gluegen/src/java/com/jogamp/common/util/IOUtil.java \ 47 --replace-fail '#!/bin/true' '#!${coreutils}/bin/true' 48 '' 49 # prevent looking for native libraries in /usr/lib 50 + '' 51 substituteInPlace jogl/make/build-*.xml \ 52 --replace-warn 'dir="''${TARGET_PLATFORM_USRLIBS}"' "" 53 '' 54 # force way to do dysfunctional "ant -Dsetup.addNativeBroadcom=false" and disable dependency on raspberrypi drivers 55 # if arm/aarch64 support will be added, this block might be commented out on those platforms 56 # on x86 compiling with default "setup.addNativeBroadcom=true" leads to unsatisfied import "vc_dispmanx_resource_delete" in libnewt.so 57 + '' 58 xmlstarlet ed --inplace \ 59 --delete '//*[@if="setup.addNativeBroadcom"]' \ 60 jogl/make/build-newt.xml 61 '' 62 + lib.optionalString stdenv.hostPlatform.isDarwin '' 63 sed -i '/if="use.macos/d' gluegen/make/gluegen-cpptasks-base.xml 64 rm -r jogl/oculusvr-sdk 65 ''; 66 67 nativeBuildInputs = [ 68 ant 69 jdk11 70 git 71 xmlstarlet 72 stripJavaArchivesHook 73 ] 74 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 75 xcbuild 76 ]; 77 78 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ 79 udev 80 xorg.libX11 81 xorg.libXrandr 82 xorg.libXcursor 83 xorg.libXi 84 xorg.libXt 85 xorg.libXxf86vm 86 xorg.libXrender 87 libgbm 88 ]; 89 90 env = { 91 SOURCE_LEVEL = "1.8"; 92 TARGET_LEVEL = "1.8"; 93 TARGET_RT_JAR = "null.jar"; 94 # error: incompatible pointer to integer conversion returning 'GLhandleARB' (aka 'void *') from a function with result type 'jlong' (aka 'long long') 95 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-int-conversion"; 96 }; 97 98 buildPhase = '' 99 runHook preBuild 100 101 for f in gluegen jogl; do 102 pushd $f/make 103 ant 104 popd 105 done 106 107 runHook postBuild 108 ''; 109 110 installPhase = '' 111 runHook preInstall 112 113 mkdir -p $out/share/java 114 cp -v $NIX_BUILD_TOP/gluegen/build/gluegen-rt{,-natives-linux-*}.jar $out/share/java/ 115 cp -v $NIX_BUILD_TOP/jogl/build/jar/jogl-all{,-natives-linux-*}.jar $out/share/java/ 116 cp -v $NIX_BUILD_TOP/jogl/build/nativewindow/nativewindow{,-awt,-natives-linux-*,-os-drm,-os-x11}.jar $out/share/java/ 117 118 runHook postInstall 119 ''; 120 121 meta = with lib; { 122 description = "Java libraries for 3D Graphics, Multimedia and Processing"; 123 homepage = "https://jogamp.org/"; 124 changelog = "https://jogamp.org/deployment/jogamp-current/archive/ChangeLogs/"; 125 license = licenses.bsd3; 126 platforms = platforms.all; 127 }; 128}