From 46b2ddd5940a6df98e04fe513f10c0ee31600515 Mon Sep 17 00:00:00 2001 From: Nicolas Benes Date: Thu, 12 Oct 2023 22:01:24 +0200 Subject: [PATCH] segger-ozone: refactor with autoPatchelfHook, support i686-linux --- .../tools/misc/segger-ozone/default.nix | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/pkgs/development/tools/misc/segger-ozone/default.nix b/pkgs/development/tools/misc/segger-ozone/default.nix index 8ca552e4ce02..8109c1e42a36 100644 --- a/pkgs/development/tools/misc/segger-ozone/default.nix +++ b/pkgs/development/tools/misc/segger-ozone/default.nix @@ -1,14 +1,13 @@ -{ stdenv +{ lib +, stdenv , fetchurl +, autoPatchelfHook , fontconfig , freetype -, lib , libICE , libSM -, udev , libX11 , libXcursor -, libXext , libXfixes , libXrandr , libXrender @@ -18,40 +17,43 @@ stdenv.mkDerivation rec { pname = "segger-ozone"; version = "3.30b"; - src = fetchurl { - url = "https://www.segger.com/downloads/jlink/Ozone_Linux_V${(lib.replaceStrings ["."] [""] version)}_x86_64.tgz"; - sha256 = "sha256-W8Fo0q58pAn1aB92CjYARcN3vMLEguvsyozsS7VRArQ="; - }; + src = { + x86_64-linux = fetchurl { + url = "https://www.segger.com/downloads/jlink/Ozone_Linux_V${builtins.replaceStrings ["."] [""] version}_x86_64.tgz"; + hash = "sha256-W8Fo0q58pAn1aB92CjYARcN3vMLEguvsyozsS7VRArQ="; + }; + i686-linux = fetchurl { + url = "https://www.segger.com/downloads/jlink/Ozone_Linux_V${builtins.replaceStrings ["."] [""] version}_i386.tgz"; + hash = "sha256-Xq/69lwF2Ll5VdkYMDNRtc0YUUvWc+XR0FHJXxOLNQ4="; + }; + }.${stdenv.hostPlatform.system} or (throw "unsupported system: ${stdenv.hostPlatform.system}"); - rpath = lib.makeLibraryPath [ + nativeBuildInputs = [ + autoPatchelfHook + ]; + + buildInputs = [ fontconfig freetype libICE libSM - udev libX11 libXcursor - libXext libXfixes libXrandr libXrender - ] - + ":${stdenv.cc.cc.lib}/lib64"; + stdenv.cc.cc.lib + ]; installPhase = '' + runHook preInstall + mkdir -p $out/bin mv Lib lib mv * $out ln -s $out/Ozone $out/bin - ''; - postFixup = '' - patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/Ozone" \ - --set-rpath ${rpath}:$out/lib "$out/Ozone" - - for file in $(find $out/lib -maxdepth 1 -type f -and -name \*.so\*); do - patchelf --set-rpath ${rpath}:$out/lib $file - done + runHook postInstall ''; meta = with lib; { @@ -80,6 +82,6 @@ stdenv.mkDerivation rec { sourceProvenance = with sourceTypes; [ binaryNativeCode ]; license = licenses.unfree; maintainers = [ maintainers.bmilanov ]; - platforms = [ "x86_64-linux" ]; + platforms = [ "x86_64-linux" "i686-linux" ]; }; }