@ -1,40 +1,35 @@
{ lib , stdenv , fetchzip , libX11 , libXScrnSaver , libXext , libXft , libXrender
, freetype , zlib , fontconfig
} :
let
maybe64 = if stdenv . isx86_64 then " _ 6 4 " else " " ;
libPath = lib . makeLibraryPath
[ stdenv . cc . cc . lib libX11 libXScrnSaver libXext libXft libXrender freetype
zlib fontconfig
] ;
in
{ lib , stdenv , fetchzip , glib , zlib , libglvnd , python3 , autoPatchelfHook }:
stdenv . mkDerivation rec {
version = " 2 . 1 6 " ;
version = " 3 . 5 " ;
pname = " s a m - b a " ;
src = fetchzip {
url = " h t t p : / / w w w . a t m e l . c o m / d y n / r e s o u r c e s / p r o d _ d o c u m e n t s / s a m - b a _ ${ version } _ l i n u x . z i p " ;
sha256 = " 1 8 l s i 4 7 4 7 9 0 0 c a z q 3 b f 0 a 8 7 n 3 p c 7 7 5 1 j 5 p a p j 9 s x a r j y m c z 9 v k s 4 " ;
url = " h t t p s : / / w w 1 . m i c r o c h i p . c o m / d o w n l o a d s / e n / D e v i c e D o c / s a m - b a _ ${ version } - l i n u x _ x 8 6 _ 6 4 . t a r . g z " ;
sha256 = " 1 k 0 n b g y c 9 8 z 9 4 n p h m 2 q 7 s 8 2 b 2 7 4 c l f n a y f 4 a 2 k v 9 3 l 5 5 9 4 r z d b p 1 " ;
} ;
# 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.
buildInputs = [
glib
libglvnd
zlib
( python3 . withPackages ( ps : [ ps . pyserial ] ) )
] ;
nativeBuildInputs = [ autoPatchelfHook ] ;
installPhase = ''
runHook preInstall
mkdir - p " $ o u t / b i n / " \
" $ o u t / o p t / s a m - b a / "
cp - a . " $ o u t / o p t / s a m - b a / "
patchelf - - set-interpreter " $ ( c a t $ N I X _ C C / n i x - s u p p o r t / d y n a m i c - l i n k e r ) " " $ o u t / o p t / s a m - b a / s a m - b a ${ maybe64 } "
cat > " $ o u t / b i n / s a m - b a " < < EOF
export LD_LIBRARY_PATH = " ${ libPath } "
exec " $ o u t / o p t / s a m - b a / s a m - b a ${ maybe64 } "
EOF
chmod + x " $ o u t / b i n / s a m - b a "
'' ;
ln - sr " $ o u t / o p t / s a m - b a / s a m - b a " " $ o u t / b i n / "
ln - sr " $ o u t / o p t / s a m - b a / m u l t i _ s a m - b a . p y " " $ o u t / b i n / "
# Do our own thing
dontPatchELF = true ;
runHook postInstall
'' ;
meta = with lib ; {
description = " P r o g r a m m i n g t o o l s f o r A t m e l S A M 3 / 7 / 9 A R M - b a s e d m i c r o c o n t r o l l e r s " ;
@ -42,10 +37,10 @@ stdenv.mkDerivation rec {
Atmel SAM-BA software provides an open set of tools for programming the
Atmel SAM3 , SAM7 and SAM9 ARM-based microcontrollers .
'' ;
# Alternatively: https://www.microchip.com/en-us/development-tool/SAM-BA-In-system-Programmer
homepage = " h t t p : / / w w w . a t 9 1 . c o m / l i n u x 4 s a m / b i n / v i e w / L i n u x 4 S A M / S o f t w a r e T o o l s " ;
# License in <source>/doc/readme.txt
license = " B S D - l i k e ( p a r t l y b i n a r y - o n l y ) " ; # according to Buildroot
platforms = [ " x 8 6 _ 6 4 - l i n u x " ] ; # patchelf fails on i686-linux
license = lib . licenses . gpl2Only ;
platforms = [ " x 8 6 _ 6 4 - l i n u x " ] ;
maintainers = [ maintainers . bjornfor ] ;
} ;
}