Merge pull request #14326 from reltuk/gradle-native-lib-fix

gradle: Fix gradle-2.12 on Linux to find libstdc++.so.6 reference.
This commit is contained in:
joachifm 2016-04-01 22:24:57 +00:00
commit 1bcbc4994d

@ -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 ];