sam-ba: 2.16 -> 3.5

* Much fewer libs needed now.
* patchelf works now, so use autoPatchelfHook instead of an
  LD_LIBRARY_PATH wrapper.
* Package is hosted on microchip.com (was atmel.com).
* Updated license.
This commit is contained in:
Bjørn Forsman 2022-03-05 16:07:04 +01:00
parent 2eef4f11a1
commit d9e7d63cc5

View file

@ -1,40 +1,35 @@
{ lib, stdenv, fetchzip, libX11, libXScrnSaver, libXext, libXft, libXrender { lib, stdenv, fetchzip, glib, zlib, libglvnd, python3, autoPatchelfHook }:
, freetype, zlib, fontconfig
}:
let
maybe64 = if stdenv.isx86_64 then "_64" else "";
libPath = lib.makeLibraryPath
[ stdenv.cc.cc.lib libX11 libXScrnSaver libXext libXft libXrender freetype
zlib fontconfig
];
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "2.16"; version = "3.5";
pname = "sam-ba"; pname = "sam-ba";
src = fetchzip { src = fetchzip {
url = "http://www.atmel.com/dyn/resources/prod_documents/sam-ba_${version}_linux.zip"; url = "https://ww1.microchip.com/downloads/en/DeviceDoc/sam-ba_${version}-linux_x86_64.tar.gz";
sha256 = "18lsi4747900cazq3bf0a87n3pc7751j5papj9sxarjymcz9vks4"; sha256 = "1k0nbgyc98z94nphm2q7s82b274clfnayf4a2kv93l5594rzdbp1";
}; };
# Pre-built binary package. Install everything to /opt/sam-ba to not mess up buildInputs = [
# the internal directory structure. Then create wrapper in /bin. Attemts to glib
# use "patchelf --set-rpath" instead of setting LD_PRELOAD_PATH failed. libglvnd
zlib
(python3.withPackages (ps: [ps.pyserial]))
];
nativeBuildInputs = [ autoPatchelfHook ];
installPhase = '' installPhase = ''
runHook preInstall
mkdir -p "$out/bin/" \ mkdir -p "$out/bin/" \
"$out/opt/sam-ba/" "$out/opt/sam-ba/"
cp -a . "$out/opt/sam-ba/" cp -a . "$out/opt/sam-ba/"
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/opt/sam-ba/sam-ba${maybe64}" ln -sr "$out/opt/sam-ba/sam-ba" "$out/bin/"
cat > "$out/bin/sam-ba" << EOF ln -sr "$out/opt/sam-ba/multi_sam-ba.py" "$out/bin/"
export LD_LIBRARY_PATH="${libPath}"
exec "$out/opt/sam-ba/sam-ba${maybe64}"
EOF
chmod +x "$out/bin/sam-ba"
'';
# Do our own thing runHook postInstall
dontPatchELF = true; '';
meta = with lib; { meta = with lib; {
description = "Programming tools for Atmel SAM3/7/9 ARM-based microcontrollers"; description = "Programming tools for Atmel SAM3/7/9 ARM-based microcontrollers";
@ -42,10 +37,10 @@ stdenv.mkDerivation rec {
Atmel SAM-BA software provides an open set of tools for programming the Atmel SAM-BA software provides an open set of tools for programming the
Atmel SAM3, SAM7 and SAM9 ARM-based microcontrollers. Atmel SAM3, SAM7 and SAM9 ARM-based microcontrollers.
''; '';
# Alternatively: https://www.microchip.com/en-us/development-tool/SAM-BA-In-system-Programmer
homepage = "http://www.at91.com/linux4sam/bin/view/Linux4SAM/SoftwareTools"; homepage = "http://www.at91.com/linux4sam/bin/view/Linux4SAM/SoftwareTools";
# License in <source>/doc/readme.txt license = lib.licenses.gpl2Only;
license = "BSD-like (partly binary-only)"; # according to Buildroot platforms = [ "x86_64-linux" ];
platforms = [ "x86_64-linux" ]; # patchelf fails on i686-linux
maintainers = [ maintainers.bjornfor ]; maintainers = [ maintainers.bjornfor ];
}; };
} }