From 74d9a1f228262b6baa35746e768c03fc03ed55a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20P=C3=A4ssler?= Date: Wed, 11 Mar 2020 23:20:34 +0100 Subject: [PATCH] jetbrains.jdk: build from source --- .../compilers/jetbrains-jdk/default.nix | 70 +++++-------------- 1 file changed, 17 insertions(+), 53 deletions(-) diff --git a/pkgs/development/compilers/jetbrains-jdk/default.nix b/pkgs/development/compilers/jetbrains-jdk/default.nix index e9b3ad151ca8..3ee12af5c06c 100644 --- a/pkgs/development/compilers/jetbrains-jdk/default.nix +++ b/pkgs/development/compilers/jetbrains-jdk/default.nix @@ -1,54 +1,15 @@ -{ stdenv, lib, fetchurl, file, glib, libxml2, libav_0_8, ffmpeg, libxslt -, libGL , xorg, alsaLib, fontconfig, freetype, pango, gtk2, cairo -, gdk-pixbuf, atk, zlib }: - -# TODO: Investigate building from source instead of patching binaries. -# TODO: Binary patching for not just x86_64-linux but also x86_64-darwin i686-linux - -let drv = stdenv.mkDerivation rec { - pname = "jetbrainsjdk"; - version = "520.38"; - - src = if stdenv.hostPlatform.system == "x86_64-linux" then - fetchurl { - url = "https://bintray.com/jetbrains/intellij-jbr/download_file?file_path=jbrsdk-11_0_5-linux-x64-b${version}.tar.gz"; - sha256 = "13hqp9ww9afkl70yrslyyx0z7fqcc8nrcqax69d6jaj587qfjqvz"; - } - else if stdenv.hostPlatform.system == "x86_64-darwin" then - fetchurl { - url = "https://bintray.com/jetbrains/intellij-jbr/download_file?file_path=jbrsdk-11_0_5-osx-x64-b${version}.tar.gz"; - sha256 = "1qrw4rpyznx7pkcjlfhi889l3a7gydz9yrqp6phz1rszmklpyk07"; - } - else - throw "unsupported system: ${stdenv.hostPlatform.system}"; - - nativeBuildInputs = [ file ]; - - unpackCmd = "mkdir jdk; pushd jdk; tar -xzf $src; popd"; - - installPhase = '' - cd .. - - mv $sourceRoot/jbrsdk $out - ''; - - postFixup = lib.optionalString (!stdenv.isDarwin) '' - find $out -type f -perm -0100 \ - -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ - --set-rpath "$rpath" {} \; - find $out -name "*.so" -exec patchelf --set-rpath "$rpath" {} \; - ''; - - rpath = lib.optionalString (!stdenv.isDarwin) (lib.makeLibraryPath ([ - stdenv.cc.cc stdenv.cc.libc glib libxml2 libav_0_8 ffmpeg libxslt libGL - alsaLib fontconfig freetype pango gtk2 cairo gdk-pixbuf atk zlib - (placeholder "out") - ] ++ (with xorg; [ - libX11 libXext libXtst libXi libXp libXt libXrender libXxf86vm - ])) + ":${placeholder "out"}/lib/jli"); - - passthru.home = drv; +{ stdenv, openjdk12, fetchFromGitHub, jetbrains }: +openjdk12.overrideAttrs (oldAttrs: rec { + pname = "jetbrains-jdk"; + version = "11.0.6-b774"; + src = fetchFromGitHub { + owner = "JetBrains"; + repo = "JetBrainsRuntime"; + rev = "jb${stdenv.lib.replaceStrings ["."] ["_"] version}"; + sha256 = "0lx3h74jwa14kr8ybwxbzc4jsjj6xnymvckdsrhqhvrciya7bxzw"; + }; + patches = []; meta = with stdenv.lib; { description = "An OpenJDK fork to better support Jetbrains's products."; longDescription = '' @@ -64,7 +25,10 @@ let drv = stdenv.mkDerivation rec { ''; homepage = "https://bintray.com/jetbrains/intellij-jdk/"; license = licenses.gpl2; - maintainers = with maintainers; [ edwtjo ]; - platforms = with platforms; [ "x86_64-linux" "x86_64-darwin" ]; + maintainers = with maintainers; [ edwtjo petabyteboy ]; + platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" "armv6l-linux" ]; }; -}; in drv + passthru = oldAttrs.passthru // { + home = "${jetbrains.jdk}/lib/openjdk"; + }; +})