From b95f9bd48cbb8a1b33c815bfcfebd2fce5b0175b Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Sat, 10 Feb 2024 18:00:38 +0100 Subject: [PATCH] javaPackages.jogl_2_4_0: rename to jogl --- .../graphics/processing/default.nix | 6 +- .../science/misc/gephi/default.nix | 6 +- pkgs/by-name/jo/jogl/package.nix | 118 ++++++++++++++++++ .../development/java-modules/jogl/default.nix | 89 ------------- pkgs/top-level/all-packages.nix | 4 + pkgs/top-level/java-packages.nix | 4 +- 6 files changed, 129 insertions(+), 98 deletions(-) create mode 100644 pkgs/by-name/jo/jogl/package.nix delete mode 100644 pkgs/development/java-modules/jogl/default.nix diff --git a/pkgs/applications/graphics/processing/default.nix b/pkgs/applications/graphics/processing/default.nix index 54d6723f7427..65cd2bea4770 100644 --- a/pkgs/applications/graphics/processing/default.nix +++ b/pkgs/applications/graphics/processing/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, fetchurl, ant, unzip, makeWrapper, jdk, javaPackages, rsync, ffmpeg, batik, gsettings-desktop-schemas, xorg, wrapGAppsHook }: +{ lib, stdenv, fetchFromGitHub, fetchurl, ant, unzip, makeWrapper, jdk, jogl, rsync, ffmpeg, batik, wrapGAppsHook }: let buildNumber = "1293"; vaqua = fetchurl { @@ -53,7 +53,7 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ ant unzip makeWrapper wrapGAppsHook ]; - buildInputs = [ jdk javaPackages.jogl_2_4_0 ant rsync ffmpeg batik ]; + buildInputs = [ jdk jogl ant rsync ffmpeg batik ]; dontWrapGApps = true; @@ -62,7 +62,7 @@ stdenv.mkDerivation rec { tar --checkpoint=10000 -czf build/linux/jdk-17.0.8-${arch}.tgz ${jdk} cp ${ant}/lib/ant/lib/{ant.jar,ant-launcher.jar} app/lib/ mkdir -p core/library - ln -s ${javaPackages.jogl_2_4_0}/share/java/* core/library/ + ln -s ${jogl}/share/java/* core/library/ ln -s ${vaqua} app/lib/VAqua9.jar ln -s ${flatlaf} app/lib/flatlaf.jar ln -s ${lsp4j} java/mode/org.eclipse.lsp4j.jar diff --git a/pkgs/applications/science/misc/gephi/default.nix b/pkgs/applications/science/misc/gephi/default.nix index a08f5da441fc..22c453dbab30 100644 --- a/pkgs/applications/science/misc/gephi/default.nix +++ b/pkgs/applications/science/misc/gephi/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchFromGitHub, jdk11, maven, javaPackages }: +{ lib, fetchFromGitHub, jdk11, maven, jogl }: let mavenJdk11 = maven.override { @@ -29,8 +29,8 @@ mavenJdk11.buildMavenPackage rec { # use self-compiled JOGL to avoid patchelf'ing .so inside jars rm $out/gephi/modules/ext/org.gephi.visualization/org-jogamp-{jogl,gluegen}/*.jar - cp ${javaPackages.jogl_2_4_0}/share/java/jogl*.jar $out/gephi/modules/ext/org.gephi.visualization/org-jogamp-jogl/ - cp ${javaPackages.jogl_2_4_0}/share/java/glue*.jar $out/gephi/modules/ext/org.gephi.visualization/org-jogamp-gluegen/ + cp ${jogl}/share/java/jogl*.jar $out/gephi/modules/ext/org.gephi.visualization/org-jogamp-jogl/ + cp ${jogl}/share/java/glue*.jar $out/gephi/modules/ext/org.gephi.visualization/org-jogamp-gluegen/ printf "\n\njdkhome=${jdk11}\n" >> $out/etc/gephi.conf ''; diff --git a/pkgs/by-name/jo/jogl/package.nix b/pkgs/by-name/jo/jogl/package.nix new file mode 100644 index 000000000000..611b85acd42e --- /dev/null +++ b/pkgs/by-name/jo/jogl/package.nix @@ -0,0 +1,118 @@ +{ lib +, stdenv +, fetchgit +, ant +, jdk11 +, git +, xmlstarlet +, 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 = 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 + ] ++ 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 + ]; + + # Workaround build failure on -fno-common toolchains: + # ld: ../obj/Bindingtest1p1Impl_JNI.o:(.bss+0x8): multiple definition of + # `unsigned_size_t_1'; ../obj/TK_Surface_JNI.o:(.bss+0x8): first defined here + NIX_CFLAGS_COMPILE = "-fcommon"; # copied from 2.3.2, is this still needed? + + buildPhase = '' + ( cd gluegen/make + substituteInPlace ../src/java/com/jogamp/common/util/IOUtil.java --replace '#!/bin/true' '#!${coreutils}/bin/true' + + # set timestamp of files in jar to a fixed point in time + xmlstarlet ed --inplace \ + --append //jar --type attr -n modificationtime --value 1980-01-01T00:00Z \ + build.xml gluegen-cpptasks-base.xml + + ant -Dtarget.sourcelevel=8 -Dtarget.targetlevel=8 -Dtarget.rt.jar='null.jar' ) + + ( cd jogl/make + + # prevent looking for native libraries in /usr/lib + substituteInPlace build-*.xml \ + --replace '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"]' build-newt.xml + + # set timestamp of files in jar to a fixed point in time + xmlstarlet ed --inplace \ + --append //jar --type attr -n modificationtime --value 1980-01-01T00:00Z \ + build.xml build-nativewindow.xml build-jogl.xml + + ant -Dtarget.sourcelevel=8 -Dtarget.targetlevel=8 -Dtarget.rt.jar='null.jar' ) + ''; + + installPhase = '' + 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/ + ''; + + meta = with lib; { + description = "Java libraries for 3D Graphics, Multimedia and Processing"; + homepage = "https://jogamp.org/"; + license = licenses.bsd3; + platforms = platforms.all; + }; +} diff --git a/pkgs/development/java-modules/jogl/default.nix b/pkgs/development/java-modules/jogl/default.nix deleted file mode 100644 index 2506d8974fae..000000000000 --- a/pkgs/development/java-modules/jogl/default.nix +++ /dev/null @@ -1,89 +0,0 @@ -{ coreutils, lib, stdenv, fetchgit, ant, jdk8, jdk11, git, xorg, udev, libGL, libGLU, mesa, xmlstarlet, xcbuild, darwin }: - -{ - jogl_2_4_0 = - 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 = 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 ] - ++ 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 ]; - - # Workaround build failure on -fno-common toolchains: - # ld: ../obj/Bindingtest1p1Impl_JNI.o:(.bss+0x8): multiple definition of - # `unsigned_size_t_1'; ../obj/TK_Surface_JNI.o:(.bss+0x8): first defined here - NIX_CFLAGS_COMPILE = "-fcommon"; # copied from 2.3.2, is this still needed? - - buildPhase = '' - ( cd gluegen/make - substituteInPlace ../src/java/com/jogamp/common/util/IOUtil.java --replace '#!/bin/true' '#!${coreutils}/bin/true' - - # set timestamp of files in jar to a fixed point in time - xmlstarlet ed --inplace \ - --append //jar --type attr -n modificationtime --value 1980-01-01T00:00Z \ - build.xml gluegen-cpptasks-base.xml - - ant -Dtarget.sourcelevel=8 -Dtarget.targetlevel=8 -Dtarget.rt.jar='null.jar' ) - - ( cd jogl/make - - # prevent looking for native libraries in /usr/lib - substituteInPlace build-*.xml \ - --replace '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"]' build-newt.xml - - # set timestamp of files in jar to a fixed point in time - xmlstarlet ed --inplace \ - --append //jar --type attr -n modificationtime --value 1980-01-01T00:00Z \ - build.xml build-nativewindow.xml build-jogl.xml - - ant -Dtarget.sourcelevel=8 -Dtarget.targetlevel=8 -Dtarget.rt.jar='null.jar' ) - ''; - - installPhase = '' - 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/ - ''; - - meta = with lib; { - description = "Java libraries for 3D Graphics, Multimedia and Processing"; - homepage = "https://jogamp.org/"; - license = licenses.bsd3; - platforms = platforms.all; - }; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index e8bb1c036dcd..27d249b426b1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -9615,6 +9615,10 @@ with pkgs; go-jira = callPackage ../applications/misc/go-jira { }; + jogl = callPackage ../by-name/jo/jogl/package.nix { + stdenv = if stdenv.isDarwin && stdenv.isx86_64 then overrideSDK stdenv "11.0" else stdenv; + }; + john = callPackage ../tools/security/john { }; joomscan = callPackage ../tools/security/joomscan { }; diff --git a/pkgs/top-level/java-packages.nix b/pkgs/top-level/java-packages.nix index 4c2fd0d4251e..3043f8e220eb 100644 --- a/pkgs/top-level/java-packages.nix +++ b/pkgs/top-level/java-packages.nix @@ -236,10 +236,8 @@ in { else ../development/compilers/semeru-bin/jdk-darwin.nix ) {}); }; - - inherit (pkgs.darwin.apple_sdk_11_0.callPackage ../development/java-modules/jogl { }) - jogl_2_4_0; } // lib.optionalAttrs config.allowAliases { + jogl_2_4_0 = throw "'jogl_2_4_0' is renamed to/replaced by 'jogl'"; mavenfod = throw "'mavenfod' is renamed to/replaced by 'maven.buildMavenPackage'"; }