From eaddd4e5e8defd2db8dac35d910c2462177fe226 Mon Sep 17 00:00:00 2001 From: Bryan Gardiner Date: Tue, 29 Sep 2015 22:03:02 -0700 Subject: [PATCH] netbeans: additional patching - Patches a new awk call in the Netbeans 8 launcher, to fix a warning on startup: /nix/store/...-netbeans-8.0.2/netbeans/platform/lib/nbexec: line 201: /usr/bin/awk: No such file or directory - Patches a bunch of sh/perl/python shebangs. --- .../applications/editors/netbeans/default.nix | 21 ++++++++++++------- pkgs/applications/editors/netbeans/path.patch | 11 ++++++++++ 2 files changed, 25 insertions(+), 7 deletions(-) create mode 100644 pkgs/applications/editors/netbeans/path.patch diff --git a/pkgs/applications/editors/netbeans/default.nix b/pkgs/applications/editors/netbeans/default.nix index 1f8d3f700ea..3ea0c71f125 100644 --- a/pkgs/applications/editors/netbeans/default.nix +++ b/pkgs/applications/editors/netbeans/default.nix @@ -1,4 +1,6 @@ -{stdenv, fetchurl, jdk, unzip, which, makeWrapper, makeDesktopItem}: +{ stdenv, fetchurl, makeWrapper, makeDesktopItem +, gawk, jdk, perl, python, unzip, which +}: let desktopItem = makeDesktopItem { @@ -16,14 +18,19 @@ stdenv.mkDerivation { url = http://download.netbeans.org/netbeans/8.0.2/final/zip/netbeans-8.0.2-201411181905.zip; sha256 = "1h9cqpwsnrhcnn4fqz3rr4s5jln8cfwki8af9zikq9j6aza337xv"; }; + buildCommand = '' - # Unpack and copy the stuff + # Unpack and perform some path patching. unzip $src - mkdir -p $out - cp -a netbeans $out - - # Create a wrapper capable of starting it + patch -p1 <${./path.patch} + substituteInPlace netbeans/platform/lib/nbexec \ + --subst-var-by AWK ${gawk}/bin/awk + patchShebangs . + + # Copy to installation directory and create a wrapper capable of starting + # it. mkdir -p $out/bin + cp -a netbeans $out makeWrapper $out/netbeans/bin/netbeans $out/bin/netbeans \ --prefix PATH : ${jdk}/bin:${which}/bin \ --prefix JAVA_HOME : ${jdk.home} \ @@ -34,7 +41,7 @@ stdenv.mkDerivation { cp ${desktopItem}/share/applications/* $out/share/applications ''; - buildInputs = [ unzip makeWrapper ]; + buildInputs = [ makeWrapper perl python unzip ]; meta = { description = "An integrated development environment for Java, C, C++ and PHP"; diff --git a/pkgs/applications/editors/netbeans/path.patch b/pkgs/applications/editors/netbeans/path.patch new file mode 100644 index 00000000000..57b5730e137 --- /dev/null +++ b/pkgs/applications/editors/netbeans/path.patch @@ -0,0 +1,11 @@ +--- a/netbeans/platform/lib/nbexec 2015-09-29 21:26:39.282600903 -0700 ++++ b/netbeans/platform/lib/nbexec 2015-09-29 21:26:58.977697858 -0700 +@@ -198,7 +198,7 @@ + SunOS*) awk=nawk ;; + *) awk=awk ;; + esac +- jdk_version=$("${jdkhome}/bin/java" -version 2>&1 | "/usr/bin/${awk}" -F '"' '/version/ {print substr($2, 1, 3)}') ++ jdk_version=$("${jdkhome}/bin/java" -version 2>&1 | "@AWK@" -F '"' '/version/ {print substr($2, 1, 3)}') + if [ "$jdk_version" = "1.7" ] ; then + jargs="$jargs $launcher_args" + fi