From dd2c1dd5c864331394946d288b505ebf199ce149 Mon Sep 17 00:00:00 2001 From: pmenke Date: Mon, 19 Apr 2021 23:36:55 +0200 Subject: [PATCH 1/4] jetbrains.clion: add patchelf invocations for new binaries version 2021.1 of clion (introduced with 3839373) has introduced additional clang related binaries which need patching. clangd and clazy-standalone also need the provided libclazyPlugin.so on the rpath. --- pkgs/applications/editors/jetbrains/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/editors/jetbrains/default.nix b/pkgs/applications/editors/jetbrains/default.nix index fff9c8a2de6..771c1f73175 100644 --- a/pkgs/applications/editors/jetbrains/default.nix +++ b/pkgs/applications/editors/jetbrains/default.nix @@ -65,12 +65,19 @@ let --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}:$gdbLibPath" \ bin/gdb/linux/bin/gdbserver + clangPath=$out/clion-${version}/bin/clang/linux/ patchelf --set-interpreter $interp \ - --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}" \ + --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}:$clangPath" \ bin/clang/linux/clangd patchelf --set-interpreter $interp \ --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}" \ bin/clang/linux/clang-tidy + patchelf --set-interpreter $interp \ + --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}" \ + bin/clang/linux/llvm-symbolizer + patchelf --set-interpreter $interp \ + --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}:$clangPath" \ + bin/clang/linux/clazy-standalone wrapProgram $out/bin/clion \ --set CL_JDK "${jdk}" From 110a062a7bf9b89a0a0d0675600e42d963713190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 20 Apr 2021 12:05:13 +0200 Subject: [PATCH 2/4] jetbrains.clion: switch to autoPatchelfHook --- .../editors/jetbrains/default.nix | 59 ++++--------------- 1 file changed, 13 insertions(+), 46 deletions(-) diff --git a/pkgs/applications/editors/jetbrains/default.nix b/pkgs/applications/editors/jetbrains/default.nix index 771c1f73175..a37028f3d45 100644 --- a/pkgs/applications/editors/jetbrains/default.nix +++ b/pkgs/applications/editors/jetbrains/default.nix @@ -1,6 +1,9 @@ { lib, stdenv, callPackage, fetchurl , jdk, cmake, libxml2, zlib, python3, ncurses5 , dotnet-sdk_3 +, autoPatchelfHook +, glib +, libdbusmenu-glib , vmopts ? null }: @@ -25,6 +28,15 @@ let platforms = platforms.linux; }; }).overrideAttrs (attrs: { + nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ optional (stdenv.isLinux) [ + autoPatchelfHook + ]; + buildInputs = (attrs.buildInputs or []) ++ optional (stdenv.isLinux) [ + python3 + stdenv.cc.cc + libdbusmenu-glib + ]; + dontAutoPatchelf = true; postFixup = (attrs.postFixup or "") + optionalString (stdenv.isLinux) '' ( cd $out/clion-${version} @@ -32,52 +44,7 @@ let rm -rf bin/cmake/linux ln -s ${cmake} bin/cmake/linux - lldbLibPath=$out/clion-${version}/bin/lldb/linux/lib - interp="$(cat $NIX_CC/nix-support/dynamic-linker)" - ln -s ${ncurses5.out}/lib/libtinfo.so.5 $lldbLibPath/libtinfo.so.5 - - patchelf --set-interpreter $interp \ - --set-rpath "${lib.makeLibraryPath [ libxml2 zlib stdenv.cc.cc.lib ]}:$lldbLibPath" \ - bin/lldb/linux/bin/lldb-server - - for i in LLDBFrontend lldb lldb-argdumper; do - patchelf --set-interpreter $interp \ - --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}:$lldbLibPath" \ - "bin/lldb/linux/bin/$i" - done - - patchelf \ - --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}:$lldbLibPath" \ - bin/lldb/linux/lib/python3.*/lib-dynload/zlib.cpython-*-x86_64-linux-gnu.so - - patchelf \ - --set-rpath "${lib.makeLibraryPath [ libxml2 zlib stdenv.cc.cc.lib python3 ]}:$lldbLibPath" \ - bin/lldb/linux/lib/liblldb.so - - gdbLibPath=$out/clion-${version}/bin/gdb/linux/lib - patchelf \ - --set-rpath "$gdbLibPath" \ - bin/gdb/linux/lib/python3.*/lib-dynload/zlib.cpython-*-x86_64-linux-gnu.so - patchelf --set-interpreter $interp \ - --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}:$gdbLibPath" \ - bin/gdb/linux/bin/gdb - patchelf --set-interpreter $interp \ - --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}:$gdbLibPath" \ - bin/gdb/linux/bin/gdbserver - - clangPath=$out/clion-${version}/bin/clang/linux/ - patchelf --set-interpreter $interp \ - --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}:$clangPath" \ - bin/clang/linux/clangd - patchelf --set-interpreter $interp \ - --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}" \ - bin/clang/linux/clang-tidy - patchelf --set-interpreter $interp \ - --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}" \ - bin/clang/linux/llvm-symbolizer - patchelf --set-interpreter $interp \ - --set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib zlib ]}:$clangPath" \ - bin/clang/linux/clazy-standalone + autoPatchelf $PWD/bin wrapProgram $out/bin/clion \ --set CL_JDK "${jdk}" From a7a29f5ba01da512b1326efa86031c6370e3f073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Tue, 20 Apr 2021 15:18:44 +0200 Subject: [PATCH 3/4] jetbrains.clion: use libdbusmenu instead of alias --- pkgs/applications/editors/jetbrains/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/editors/jetbrains/default.nix b/pkgs/applications/editors/jetbrains/default.nix index a37028f3d45..63482762e7e 100644 --- a/pkgs/applications/editors/jetbrains/default.nix +++ b/pkgs/applications/editors/jetbrains/default.nix @@ -3,7 +3,7 @@ , dotnet-sdk_3 , autoPatchelfHook , glib -, libdbusmenu-glib +, libdbusmenu , vmopts ? null }: @@ -34,7 +34,7 @@ let buildInputs = (attrs.buildInputs or []) ++ optional (stdenv.isLinux) [ python3 stdenv.cc.cc - libdbusmenu-glib + libdbusmenu ]; dontAutoPatchelf = true; postFixup = (attrs.postFixup or "") + optionalString (stdenv.isLinux) '' From d94d7c77147269308ef5fec24d6ae78a26f02ea2 Mon Sep 17 00:00:00 2001 From: pmenke Date: Tue, 20 Apr 2021 20:07:33 +0200 Subject: [PATCH 4/4] jetbrains.clion: use lib.optionals instead of lib.optional --- pkgs/applications/editors/jetbrains/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/editors/jetbrains/default.nix b/pkgs/applications/editors/jetbrains/default.nix index 63482762e7e..1da4a24b3ea 100644 --- a/pkgs/applications/editors/jetbrains/default.nix +++ b/pkgs/applications/editors/jetbrains/default.nix @@ -28,10 +28,10 @@ let platforms = platforms.linux; }; }).overrideAttrs (attrs: { - nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ optional (stdenv.isLinux) [ + nativeBuildInputs = (attrs.nativeBuildInputs or []) ++ optionals (stdenv.isLinux) [ autoPatchelfHook ]; - buildInputs = (attrs.buildInputs or []) ++ optional (stdenv.isLinux) [ + buildInputs = (attrs.buildInputs or []) ++ optionals (stdenv.isLinux) [ python3 stdenv.cc.cc libdbusmenu