From fbde3a745259edf20dc8e275eee954875a2d50ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Mon, 30 May 2016 17:54:51 +0200 Subject: [PATCH] sam-ba: init at 2.16 Programming tools for Atmel SAM3/7/9 ARM-based microcontrollers. (I've only runtime tested the 64-bit binary, not the 32-bit one.) --- pkgs/tools/misc/sam-ba/default.nix | 51 ++++++++++++++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 53 insertions(+) create mode 100644 pkgs/tools/misc/sam-ba/default.nix diff --git a/pkgs/tools/misc/sam-ba/default.nix b/pkgs/tools/misc/sam-ba/default.nix new file mode 100644 index 000000000000..1b7315ebedf6 --- /dev/null +++ b/pkgs/tools/misc/sam-ba/default.nix @@ -0,0 +1,51 @@ +{ stdenv, fetchzip, libX11, libXScrnSaver, libXext, libXft, libXrender +, freetype, zlib, fontconfig +}: + +let + maybe64 = if stdenv.isx86_64 then "_64" else ""; + libPath = stdenv.lib.makeLibraryPath + [ stdenv.cc.cc.lib libX11 libXScrnSaver libXext libXft libXrender freetype + zlib fontconfig + ]; +in +stdenv.mkDerivation rec { + version = "2.16"; + name = "sam-ba-${version}"; + + src = fetchzip { + url = "http://www.atmel.com/dyn/resources/prod_documents/sam-ba_${version}_linux.zip"; + sha256 = "18lsi4747900cazq3bf0a87n3pc7751j5papj9sxarjymcz9vks4"; + }; + + # Pre-built binary package. Install everything to /opt/sam-ba to not mess up + # the internal directory structure. Then create wrapper in /bin. Attemts to + # use "patchelf --set-rpath" instead of setting LD_PRELOAD_PATH failed. + installPhase = '' + mkdir -p "$out/bin/" \ + "$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}" + cat > "$out/bin/sam-ba" << EOF + export LD_LIBRARY_PATH="${libPath}" + exec "$out/opt/sam-ba/sam-ba${maybe64}" + EOF + chmod +x "$out/bin/sam-ba" + ''; + + # Do our own thing + dontPatchELF = true; + + meta = with stdenv.lib; { + description = "Programming tools for Atmel SAM3/7/9 ARM-based microcontrollers"; + longDescription = '' + Atmel SAM-BA software provides an open set of tools for programming the + Atmel SAM3, SAM7 and SAM9 ARM-based microcontrollers. + ''; + homepage = "http://www.at91.com/linux4sam/bin/view/Linux4SAM/SoftwareTools"; + # License in /doc/readme.txt + license = "BSD-like (partly binary-only)"; # according to Buildroot + platforms = [ "i686-linux" "x86_64-linux" ]; + maintainers = [ maintainers.bjornfor ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1091807486be..65fced534a85 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16608,6 +16608,8 @@ in rucksack = callPackage ../development/tools/rucksack { }; + sam-ba = callPackage ../tools/misc/sam-ba { }; + opkg = callPackage ../tools/package-management/opkg { }; opkg-utils = callPackage ../tools/package-management/opkg-utils { };