2022-09-22 12:36:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, jetbrains
|
2024-06-20 14:57:18 +00:00
|
|
|
, jdk
|
2023-01-20 10:41:00 +00:00
|
|
|
, git
|
|
|
|
, autoconf
|
|
|
|
, unzip
|
|
|
|
, rsync
|
|
|
|
, debugBuild ? false
|
2024-01-02 11:29:13 +00:00
|
|
|
, withJcef ? true
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
, libXdamage
|
|
|
|
, libXxf86vm
|
|
|
|
, libXrandr
|
|
|
|
, libXi
|
|
|
|
, libXcursor
|
|
|
|
, libXrender
|
|
|
|
, libX11
|
|
|
|
, libXext
|
|
|
|
, libxcb
|
|
|
|
, nss
|
|
|
|
, nspr
|
|
|
|
, libdrm
|
|
|
|
, mesa
|
|
|
|
, wayland
|
|
|
|
, udev
|
2022-09-22 12:36:57 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
assert debugBuild -> withJcef;
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
let
|
|
|
|
arch = {
|
|
|
|
"aarch64-linux" = "aarch64";
|
|
|
|
"x86_64-linux" = "x64";
|
|
|
|
}.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
|
|
|
|
cpu = stdenv.hostPlatform.parsed.cpu.name;
|
|
|
|
in
|
2024-06-20 14:57:18 +00:00
|
|
|
jdk.overrideAttrs (oldAttrs: rec {
|
2024-01-02 11:29:13 +00:00
|
|
|
pname = "jetbrains-jdk" + lib.optionalString withJcef "-jcef";
|
2024-06-20 14:57:18 +00:00
|
|
|
javaVersion = "21.0.3";
|
|
|
|
build = "465.3";
|
2023-01-20 10:41:00 +00:00
|
|
|
# To get the new tag:
|
|
|
|
# git clone https://github.com/jetbrains/jetbrainsruntime
|
|
|
|
# cd jetbrainsruntime
|
2024-06-20 14:57:18 +00:00
|
|
|
# git checkout jbr-release-${javaVersion}b${build}
|
2024-01-02 11:29:13 +00:00
|
|
|
# git log --simplify-by-decoration --decorate=short --pretty=short | grep "jbr-" --color=never | cut -d "(" -f2 | cut -d ")" -f1 | awk '{print $2}' | sort -t "-" -k 2 -g | tail -n 1 | tr -d ","
|
2024-06-20 14:57:18 +00:00
|
|
|
openjdkTag = "jbr-21.0.2+3";
|
2023-01-20 10:41:00 +00:00
|
|
|
version = "${javaVersion}-b${build}";
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "JetBrains";
|
|
|
|
repo = "JetBrainsRuntime";
|
2021-08-05 21:33:18 +00:00
|
|
|
rev = "jb${version}";
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-Pup/XeHExCE6yy2o74wF7VlYU6MI9cg8gb69V3bclIo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2022-09-22 12:36:57 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
BOOT_JDK = jdk.home;
|
2024-01-02 11:29:13 +00:00
|
|
|
# run `git log -1 --pretty=%ct` in jdk repo for new value on update
|
2024-06-20 14:57:18 +00:00
|
|
|
SOURCE_DATE_EPOCH = 1717225235;
|
2023-01-20 10:41:00 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
patches = [ ];
|
2023-01-20 10:41:00 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
dontConfigure = true;
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
${lib.optionalString withJcef "cp -r ${jetbrains.jcef} jcef_linux_${arch}"}
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
sed \
|
|
|
|
-e "s/OPENJDK_TAG=.*/OPENJDK_TAG=${openjdkTag}/" \
|
|
|
|
-e "s/SOURCE_DATE_EPOCH=.*//" \
|
|
|
|
-e "s/export SOURCE_DATE_EPOCH//" \
|
|
|
|
-i jb/project/tools/common/scripts/common.sh
|
2024-06-20 14:57:18 +00:00
|
|
|
configureFlags=$(echo $configureFlags | sed 's/--host=[^ ]*//')
|
|
|
|
sed -i "s|STATIC_CONF_ARGS|STATIC_CONF_ARGS \$configureFlags|" jb/project/tools/linux/scripts/mkimages_${arch}.sh
|
2023-01-20 10:41:00 +00:00
|
|
|
sed \
|
|
|
|
-e "s/create_image_bundle \"jb/#/" \
|
|
|
|
-e "s/echo Creating /exit 0 #/" \
|
2023-10-19 13:55:26 +00:00
|
|
|
-i jb/project/tools/linux/scripts/mkimages_${arch}.sh
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
patchShebangs .
|
2024-01-02 11:29:13 +00:00
|
|
|
./jb/project/tools/linux/scripts/mkimages_${arch}.sh ${build} ${if debugBuild then "fd" else (if withJcef then "jcef" else "nomod")}
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
installPhase =
|
|
|
|
let
|
|
|
|
buildType = if debugBuild then "fastdebug" else "release";
|
|
|
|
debugSuffix = if debugBuild then "-fastdebug" else "";
|
|
|
|
jcefSuffix = if debugBuild || !withJcef then "" else "_jcef";
|
|
|
|
jbrsdkDir = "jbrsdk${jcefSuffix}-${javaVersion}-linux-${arch}${debugSuffix}-b${build}";
|
|
|
|
in
|
|
|
|
''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mv build/linux-${cpu}-server-${buildType}/images/jdk/man build/linux-${cpu}-server-${buildType}/images/${jbrsdkDir}
|
|
|
|
rm -rf build/linux-${cpu}-server-${buildType}/images/jdk
|
|
|
|
mv build/linux-${cpu}-server-${buildType}/images/${jbrsdkDir} build/linux-${cpu}-server-${buildType}/images/jdk
|
|
|
|
'' + oldAttrs.installPhase + "runHook postInstall";
|
|
|
|
|
|
|
|
postInstall = lib.optionalString withJcef ''
|
2023-01-20 10:41:00 +00:00
|
|
|
chmod +x $out/lib/openjdk/lib/chrome-sandbox
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = debugBuild;
|
|
|
|
|
|
|
|
postFixup = ''
|
2024-01-02 11:29:13 +00:00
|
|
|
# Build the set of output library directories to rpath against
|
|
|
|
LIBDIRS="${lib.makeLibraryPath [
|
|
|
|
libXdamage libXxf86vm libXrandr libXi libXcursor libXrender libX11 libXext libxcb
|
|
|
|
nss nspr libdrm mesa wayland udev
|
|
|
|
]}"
|
|
|
|
for output in $outputs; do
|
|
|
|
if [ "$output" = debug ]; then continue; fi
|
|
|
|
LIBDIRS="$(find $(eval echo \$$output) -name \*.so\* -exec dirname {} \+ | sort -u | tr '\n' ':'):$LIBDIRS"
|
|
|
|
done
|
|
|
|
# Add the local library paths to remove dependencies on the bootstrap
|
|
|
|
for output in $outputs; do
|
|
|
|
if [ "$output" = debug ]; then continue; fi
|
|
|
|
OUTPUTDIR=$(eval echo \$$output)
|
|
|
|
BINLIBS=$(find $OUTPUTDIR/bin/ -type f; find $OUTPUTDIR -name \*.so\*)
|
|
|
|
echo "$BINLIBS" | while read i; do
|
|
|
|
patchelf --set-rpath "$LIBDIRS:$(patchelf --print-rpath "$i")" "$i" || true
|
|
|
|
patchelf --shrink-rpath "$i" || true
|
2023-01-20 10:41:00 +00:00
|
|
|
done
|
2024-01-02 11:29:13 +00:00
|
|
|
done
|
|
|
|
'';
|
2023-01-20 10:41:00 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ git autoconf unzip rsync ] ++ oldAttrs.nativeBuildInputs;
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "OpenJDK fork to better support Jetbrains's products";
|
2020-04-24 23:36:52 +00:00
|
|
|
longDescription = ''
|
2024-01-02 11:29:13 +00:00
|
|
|
JetBrains Runtime is a runtime environment for running IntelliJ Platform
|
|
|
|
based products on Windows, Mac OS X, and Linux. JetBrains Runtime is
|
|
|
|
based on OpenJDK project with some modifications. These modifications
|
|
|
|
include: Subpixel Anti-Aliasing, enhanced font rendering on Linux, HiDPI
|
|
|
|
support, ligatures, some fixes for native crashes not presented in
|
|
|
|
official build, and other small enhancements.
|
|
|
|
JetBrains Runtime is not a certified build of OpenJDK. Please, use at
|
|
|
|
your own risk.
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
2021-08-05 21:33:18 +00:00
|
|
|
homepage = "https://confluence.jetbrains.com/display/JBR/JetBrains+Runtime";
|
2024-06-20 14:57:18 +00:00
|
|
|
inherit (jdk.meta) license platforms mainProgram;
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with maintainers; [ edwtjo ];
|
2022-09-22 12:36:57 +00:00
|
|
|
|
|
|
|
broken = stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2022-09-22 12:36:57 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
passthru = oldAttrs.passthru // {
|
|
|
|
home = "${jetbrains.jdk}/lib/openjdk";
|
|
|
|
};
|
|
|
|
})
|