From 94ff822eec9376f998a2e6f9255ab9643a53c860 Mon Sep 17 00:00:00 2001 From: volth Date: Mon, 19 Mar 2018 03:33:13 +0000 Subject: [PATCH 1/3] jogl: init at 2.3.2 --- .../development/java-modules/jogl/default.nix | 56 +++++++++++++++++++ pkgs/top-level/java-packages.nix | 3 + 2 files changed, 59 insertions(+) create mode 100644 pkgs/development/java-modules/jogl/default.nix diff --git a/pkgs/development/java-modules/jogl/default.nix b/pkgs/development/java-modules/jogl/default.nix new file mode 100644 index 000000000000..03d5a05942fb --- /dev/null +++ b/pkgs/development/java-modules/jogl/default.nix @@ -0,0 +1,56 @@ +{ stdenv, fetchgit, makeWrapper, ant, jdk, git, xorg, udev }: + +{ + jogl_2_3_2 = + let + version = "2.3.2"; + + gluegen-src = fetchgit { + url = git://jogamp.org/srv/scm/gluegen.git; + rev = "v${version}"; + sha256 = "00hybisjwqs88p24dds652bzrwbbmhn2dpx56kp4j6xpadkp33d0"; + fetchSubmodules = true; + }; + in stdenv.mkDerivation rec { + name = "jogl-${version}"; + + src = fetchgit { + url = http://jogamp.org/srv/scm/jogl.git; + rev = "v${version}"; + sha256 = "0msi2gxiqm2yqwkmxqbh521xdrimw1fly20g890r357rcgj8fsn3"; + fetchSubmodules = true; + }; + + buildInputs = [ jdk ant git udev xorg.libX11 xorg.libXrandr xorg.libXcursor xorg.libXt xorg.libXxf86vm xorg.libXrender ]; + + buildPhase = '' + cp -r ${gluegen-src} $NIX_BUILD_TOP/gluegen + chmod -R +w $NIX_BUILD_TOP/gluegen + ( cd ../gluegen/make + ant ) + + ( cd make + + # 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 + cp build-newt.xml build-newt.xml.old + fgrep -v 'if="setup.addNativeBroadcom"' build-newt.xml.old > build-newt.xml + + ant ) + ''; + + installPhase = '' + mkdir -p $out/share/java + cp $NIX_BUILD_TOP/gluegen/build/gluegen-rt{,-natives-linux-amd64}.jar $out/share/java/ + cp $NIX_BUILD_TOP/jogl/build/jar/jogl-all{,-natives-linux-amd64}.jar $out/share/java/ + ''; + + meta = with stdenv.lib; { + description = "Java libraries for 3D Graphics, Multimedia and Processing"; + homepage = http://jogamp.org/; + license = licenses.bsd3; + platforms = [ "x86_64-linux" ]; + }; + }; +} diff --git a/pkgs/top-level/java-packages.nix b/pkgs/top-level/java-packages.nix index 0df0b5a51c93..77cd5b0eba53 100644 --- a/pkgs/top-level/java-packages.nix +++ b/pkgs/top-level/java-packages.nix @@ -61,6 +61,9 @@ in { junit_3_8_2 junit_4_12; + inherit (callPackage ../development/java-modules/jogl { }) + jogl_2_3_2; + inherit (callPackage ../development/java-modules/log4j { inherit fetchMaven; }) log4j_1_2_12; From 887e6302bdfa9b93fedf022181b0f20c510b9cc0 Mon Sep 17 00:00:00 2001 From: volth Date: Mon, 19 Mar 2018 08:44:21 +0000 Subject: [PATCH 2/3] jogl: temporary workaround for openjdk8 --- pkgs/development/java-modules/jogl/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkgs/development/java-modules/jogl/default.nix b/pkgs/development/java-modules/jogl/default.nix index 03d5a05942fb..474eaa0e1dc4 100644 --- a/pkgs/development/java-modules/jogl/default.nix +++ b/pkgs/development/java-modules/jogl/default.nix @@ -1,5 +1,9 @@ -{ stdenv, fetchgit, makeWrapper, ant, jdk, git, xorg, udev }: +{ stdenv, fetchgit, makeWrapper, ant, jdk, openjdk8, zulu8, git, xorg, udev }: +let + # workaround https://github.com/NixOS/nixpkgs/issues/37364 + jdk-without-symlinks = if jdk == openjdk8 then zulu8 else jdk; +in { jogl_2_3_2 = let @@ -21,7 +25,7 @@ fetchSubmodules = true; }; - buildInputs = [ jdk ant git udev xorg.libX11 xorg.libXrandr xorg.libXcursor xorg.libXt xorg.libXxf86vm xorg.libXrender ]; + buildInputs = [ jdk-without-symlinks ant git udev xorg.libX11 xorg.libXrandr xorg.libXcursor xorg.libXt xorg.libXxf86vm xorg.libXrender ]; buildPhase = '' cp -r ${gluegen-src} $NIX_BUILD_TOP/gluegen From 1e2eec169a06dc6510f961a2850a3c52a774d2b1 Mon Sep 17 00:00:00 2001 From: volth Date: Mon, 19 Mar 2018 03:37:29 +0000 Subject: [PATCH 3/3] gephi: build from sources --- .../science/misc/gephi/default.nix | 83 ++++++++++++------- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/pkgs/applications/science/misc/gephi/default.nix b/pkgs/applications/science/misc/gephi/default.nix index 82b95132d880..3a0bcb66813e 100644 --- a/pkgs/applications/science/misc/gephi/default.nix +++ b/pkgs/applications/science/misc/gephi/default.nix @@ -1,37 +1,64 @@ -{stdenv, fetchurl, jdk}: +{ stdenv, fetchFromGitHub, callPackage, jdk, maven, javaPackages }: -with stdenv.lib; +let + version = "0.9.2"; -let version = "0.9.2"; in -stdenv.mkDerivation { - name = "gephi-${version}"; - - src = fetchurl { - url = "https://github.com/gephi/gephi/releases/download/v${version}/gephi-${version}-linux.tar.gz"; - sha256 = "1wr3rka8j2y10nnwbg27iaxkbrp4d7d07ccs9n94yqv6wqawj5z8"; + src = fetchFromGitHub { + owner = "gephi"; + repo = "gephi"; + rev = "v${version}"; + sha256 = "0kqp2nvnsb55j1axb6hk0mlw5alyaiyb70z0mdybhpqqxyw2da2r"; }; - meta = { - inherit version; + # perform fake build to make a fixed-output derivation out of the files downloaded from maven central (120MB) + deps = stdenv.mkDerivation { + name = "gephi-${version}-deps"; + inherit src; + buildInputs = [ jdk maven ]; + buildPhase = '' + while mvn package -Dmaven.repo.local=$out/.m2 -Dmaven.wagon.rto=5000; [ $? = 1 ]; do + echo "timeout, restart maven to continue downloading" + done + ''; + # keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside + installPhase = ''find $out/.m2 -type f -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' -delete''; + outputHashAlgo = "sha256"; + outputHashMode = "recursive"; + outputHash = "1p7yf97dn0nvr005cbs6vdk3i341s8fya4kfccj8qqad2qgxflif"; + }; +in +stdenv.mkDerivation rec { + name = "gephi-${version}"; + + inherit src; + + buildInputs = [ jdk maven ]; + + buildPhase = '' + # 'maven.repo.local' must be writable so copy it out of nix store + mvn package --offline -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2 + ''; + + installPhase = '' + cp -r modules/application/target/gephi $out + + # remove garbage + find $out -type f -name .lastModified -delete + find $out -type f -regex '.+\.exe' -delete + + # 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_3_2}/share/java/jogl*.jar $out/gephi/modules/ext/org.gephi.visualization/org-jogamp-jogl/ + cp ${javaPackages.jogl_2_3_2}/share/java/glue*.jar $out/gephi/modules/ext/org.gephi.visualization/org-jogamp-gluegen/ + + echo "jdkhome=${jdk}" >> $out/etc/gephi.conf + ''; + + meta = with stdenv.lib; { description = "A platform for visualizing and manipulating large graphs"; homepage = https://gephi.org; license = licenses.gpl3; - maintainers = [maintainers.taeer]; - platforms = platforms.linux; + maintainers = [ maintainers.taeer ]; + platforms = [ "x86_64-linux" ]; }; - - buildInputs = [jdk]; - - configurePhase = " - echo \"jdkhome=${jdk}\" >> etc/gephi.conf - "; - - dontBuild = true; - - installPhase = " - mkdir $out - for a in ./*; do - mv $a $out - done - "; }