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