From 8409443b1fa2c13eac83ed1f1548487c88bf365c Mon Sep 17 00:00:00 2001 From: Toyohisa Kameyama Date: Tue, 15 Mar 2022 19:10:59 +0900 Subject: [PATCH] jogl: new package (#29332) --- .../builtin/packages/jogl/noxf86vm.patch | 53 ++++++++++++++ .../repos/builtin/packages/jogl/package.py | 71 +++++++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 var/spack/repos/builtin/packages/jogl/noxf86vm.patch create mode 100644 var/spack/repos/builtin/packages/jogl/package.py diff --git a/var/spack/repos/builtin/packages/jogl/noxf86vm.patch b/var/spack/repos/builtin/packages/jogl/noxf86vm.patch new file mode 100644 index 0000000000..dac2a82eaf --- /dev/null +++ b/var/spack/repos/builtin/packages/jogl/noxf86vm.patch @@ -0,0 +1,53 @@ +diff --git a/make/build-nativewindow.xml b/make/build-nativewindow.xml +index 6c9405cfd..140416bba 100644 +--- a/make/build-nativewindow.xml ++++ b/make/build-nativewindow.xml +@@ -446,19 +446,16 @@ + + + +- + + + + + +- + + + + + +- + + + +@@ -470,7 +467,6 @@ + + + +- + + + +diff --git a/src/nativewindow/native/x11/Xmisc.h b/src/nativewindow/native/x11/Xmisc.h +index d8868f802..fb7f5f758 100644 +--- a/src/nativewindow/native/x11/Xmisc.h ++++ b/src/nativewindow/native/x11/Xmisc.h +@@ -39,9 +39,6 @@ + #include + #include + +-#if !defined(__sun_obsolete) && !defined(_HPUX) +-#include +-#else + Bool XF86VidModeGetGammaRampSize( + Display* /* dpy */, + int /* screen */, +@@ -63,6 +60,5 @@ Bool XF86VidModeSetGammaRamp( + unsigned short* /* green array */, + unsigned short* /* blue array */ + ); +-#endif /* defined(__sun_obsolete) || defined(_HPUX) */ + + #endif /* Xmisc_h */ diff --git a/var/spack/repos/builtin/packages/jogl/package.py b/var/spack/repos/builtin/packages/jogl/package.py new file mode 100644 index 0000000000..1f351f2e61 --- /dev/null +++ b/var/spack/repos/builtin/packages/jogl/package.py @@ -0,0 +1,71 @@ +# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os + +from spack import * + + +class Jogl(Package): + """JOGL provides full access to the APIs in the OpenGL specification + as well as nearly all vendor extensions.""" + + homepage = "https://jogamp.org/jogl/www/" + git = "https://github.com/WadeWalker/jogl.git" + + version('java-11-fixes', branch='java-11-fixes', submodules=True) + + depends_on('ant', type='build') + depends_on('java', type=('build', 'run')) + depends_on('gluegen', type=('build', 'run')) + depends_on('gl', type='link') + depends_on('glu', type='link') + depends_on('libxcursor', type='link') + + # Xfree86 Video mode extentions is deprecated + patch('noxf86vm.patch') + + phases = ['edit', 'build', 'install'] + + def edit(self, spec, prefix): + common = join_path('make', 'build-common.xml') + filter_file('../../gluegen', spec['gluegen'].prefix, common) + for target in ['nativewindow', 'jogl', 'newt']: + conf = join_path('make', 'build-{0}.xml'.format(target)) + filter_file(r'syslibset dir="\${env.TARGET_PLATFORM_ROOT}[^"]*"', + 'syslibset', conf) + filter_file('/usr/include', spec['libxcursor'].prefix.include, + conf) + + compiler_mapping = {'gcc': 'gcc', 'clang': 'clang', 'fj': 'fcc'} + + def build(self, spec, prefix): + cname = spec.compiler.name + compiler = self.compiler_mapping.get(cname, 'gcc') + ant = spec['ant'].command + antarg = ['-Dcommon.gluegen.build.done=true', + '-Dgcc.compat.compiler={0}'.format(compiler)] + with working_dir('make'): + ant(*antarg) + + def install(self, spec, prefix): + mkdirp(prefix.lib) + with working_dir(join_path('build', 'jar')): + install('*.jar', prefix.lib) + with working_dir(join_path('build', 'lib')): + install('*.so', prefix.lib) + + def setup_build_environment(self, env): + env.unset('CLASSPATH') + + def setup_run_environment(self, env): + class_paths = find(prefix.lib, '*.jar') + classpath = os.pathsep.join(class_paths) + env.prepend_path('CLASSPATH', classpath) + + def setup_dependent_build_environment(self, env, dependent_spec): + class_paths = find(prefix.lib, '*.jar') + classpath = os.pathsep.join(class_paths) + env.prepend_path('CLASSPATH', classpath)