diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2024-06-20 00:13:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-20 00:13:16 +0000 |
commit | 49f3b031c4e87e18acc2a68f15fdb56871a170df (patch) | |
tree | d0ee551cdd5914a7a0d0ca76b60dd33a38ca58c7 /pkgs/development/compilers | |
parent | 17d6c2325c37c1fa6af7a593625c3b0d35ce4f6c (diff) | |
parent | 9ac814f96ac41463c3d0507bc0d8c54d43564303 (diff) |
Merge master into haskell-updates
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r-- | pkgs/development/compilers/jetbrains-jdk/17.nix | 156 | ||||
-rw-r--r-- | pkgs/development/compilers/jwasm/default.nix | 44 |
2 files changed, 156 insertions, 44 deletions
diff --git a/pkgs/development/compilers/jetbrains-jdk/17.nix b/pkgs/development/compilers/jetbrains-jdk/17.nix new file mode 100644 index 0000000000000..76d4079baafbf --- /dev/null +++ b/pkgs/development/compilers/jetbrains-jdk/17.nix @@ -0,0 +1,156 @@ +{ lib +, stdenv +, fetchFromGitHub +, jetbrains +, openjdk17 +, openjdk17-bootstrap +, git +, autoconf +, unzip +, rsync +, debugBuild ? false +, withJcef ? true + +, libXdamage +, libXxf86vm +, libXrandr +, libXi +, libXcursor +, libXrender +, libX11 +, libXext +, libxcb +, nss +, nspr +, libdrm +, mesa +, wayland +, udev +}: + +assert debugBuild -> withJcef; + +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 +openjdk17.overrideAttrs (oldAttrs: rec { + pname = "jetbrains-jdk" + lib.optionalString withJcef "-jcef"; + javaVersion = "17.0.11"; + build = "1207.24"; + # To get the new tag: + # git clone https://github.com/jetbrains/jetbrainsruntime + # cd jetbrainsruntime + # git reset --hard [revision] + # 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 "," + openjdkTag = "jbr-17.0.8+7"; + version = "${javaVersion}-b${build}"; + + src = fetchFromGitHub { + owner = "JetBrains"; + repo = "JetBrainsRuntime"; + rev = "jb${version}"; + hash = "sha256-a7cJF2iCW/1GK0/GmVbaY5pYcn3YtZy5ngFkyAGRhu0="; + }; + + BOOT_JDK = openjdk17-bootstrap.home; + # run `git log -1 --pretty=%ct` in jdk repo for new value on update + SOURCE_DATE_EPOCH = 1715809405; + + patches = [ ]; + + dontConfigure = true; + + buildPhase = '' + runHook preBuild + + ${lib.optionalString withJcef "cp -r ${jetbrains.jcef} jcef_linux_${arch}"} + + 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 + sed -i "s/STATIC_CONF_ARGS/STATIC_CONF_ARGS \$configureFlags/" jb/project/tools/linux/scripts/mkimages_${arch}.sh + sed \ + -e "s/create_image_bundle \"jb/#/" \ + -e "s/echo Creating /exit 0 #/" \ + -i jb/project/tools/linux/scripts/mkimages_${arch}.sh + + patchShebangs . + ./jb/project/tools/linux/scripts/mkimages_${arch}.sh ${build} ${if debugBuild then "fd" else (if withJcef then "jcef" else "nomod")} + + runHook postBuild + ''; + + 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 '' + chmod +x $out/lib/openjdk/lib/chrome-sandbox + ''; + + dontStrip = debugBuild; + + postFixup = '' + # 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 + done + done + ''; + + nativeBuildInputs = [ git autoconf unzip rsync ] ++ oldAttrs.nativeBuildInputs; + + meta = with lib; { + description = "An OpenJDK fork to better support Jetbrains's products."; + longDescription = '' + 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. + ''; + homepage = "https://confluence.jetbrains.com/display/JBR/JetBrains+Runtime"; + inherit (openjdk17.meta) license platforms mainProgram; + maintainers = with maintainers; [ edwtjo ]; + + broken = stdenv.isDarwin; + }; + + passthru = oldAttrs.passthru // { + home = "${jetbrains.jdk}/lib/openjdk"; + }; +}) diff --git a/pkgs/development/compilers/jwasm/default.nix b/pkgs/development/compilers/jwasm/default.nix deleted file mode 100644 index a8ffc3164a662..0000000000000 --- a/pkgs/development/compilers/jwasm/default.nix +++ /dev/null @@ -1,44 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -}: - -stdenv.mkDerivation (finalAttrs: { - pname = "jwasm"; - version = "2.17"; - - src = fetchFromGitHub { - owner = "Baron-von-Riedesel"; - repo = "JWasm"; - rev = "v${finalAttrs.version}"; - hash = "sha256-22eNtHXF+RQT4UbXIVjn1JP/s6igp5O1oQT7sVl7c1U="; - }; - - outputs = [ "out" "doc" ]; - - dontConfigure = true; - - preBuild = '' - cp ${if stdenv.cc.isClang then "CLUnix.mak" else "GccUnix.mak"} Makefile - substituteInPlace Makefile \ - --replace "/usr/local/bin" "${placeholder "out"}/bin" - ''; - - postInstall = '' - install -Dpm644 $src/Html/License.html \ - $src/Html/Manual.html \ - $src/Html/Readme.html \ - -t $doc/share/doc/jwasm/ - ''; - - meta = with lib; { - homepage = "https://github.com/Baron-von-Riedesel/JWasm/"; - description = "MASM-compatible x86 assembler"; - changelog = "https://github.com/Baron-von-Riedesel/JWasm/releases/tag/v${finalAttrs.version}"; - license = licenses.gpl2Plus; - maintainers = with maintainers; [ AndersonTorres ]; - platforms = platforms.unix; - broken = stdenv.isDarwin; - }; -}) -# TODO: generalize for Windows builds |