From bbfad5111a3e2cb273e975945ac4fb4cb30a9cd4 Mon Sep 17 00:00:00 2001 From: Aaron Son Date: Wed, 30 Mar 2016 15:07:29 -0700 Subject: [PATCH] gradle: Fix gradle-2.12 on Linux to find libstdc++.so reference in native library. --- .../tools/build-managers/gradle/default.nix | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/pkgs/development/tools/build-managers/gradle/default.nix b/pkgs/development/tools/build-managers/gradle/default.nix index c2b24c69904f..96477e55d26a 100644 --- a/pkgs/development/tools/build-managers/gradle/default.nix +++ b/pkgs/development/tools/build-managers/gradle/default.nix @@ -4,6 +4,8 @@ rec { gradleGen = {name, src} : stdenv.mkDerivation rec { inherit name src; + buildPhase = ":"; + installPhase = '' mkdir -pv $out/lib/gradle/ cp -rv lib/ $out/lib/gradle/ @@ -15,7 +17,21 @@ rec { --add-flags "-classpath $gradle_launcher_jar org.gradle.launcher.GradleMain" ''; - phases = "unpackPhase installPhase"; + fixupPhase = if (!stdenv.isLinux) then ":" else + let arch = if stdenv.is64bit then "amd64" else "i386"; in '' + mkdir patching + pushd patching + jar xf $out/lib/gradle/lib/native-platform-linux-${arch}-0.10.jar + patchelf --set-rpath "${stdenv.cc.cc}/lib:${stdenv.cc.cc}/lib64" net/rubygrapefruit/platform/linux-${arch}/libnative-platform.so + jar cf native-platform-linux-${arch}-0.10.jar . + mv native-platform-linux-${arch}-0.10.jar $out/lib/gradle/lib/ + popd + + # The scanner doesn't pick up the runtime dependency in the jar. + # Manually add a reference where it will be found. + mkdir $out/nix-support + echo ${stdenv.cc.cc} > $out/nix-support/manual-runtime-dependencies + ''; buildInputs = [ unzip jdk makeWrapper ];