2023-03-14 11:05:47 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, wxGTK32
|
|
|
|
, libX11
|
|
|
|
, readline
|
|
|
|
, darwin
|
2024-05-06 09:48:33 +00:00
|
|
|
, fetchpatch
|
2023-03-14 11:05:47 +00:00
|
|
|
}:
|
2014-08-27 10:51:21 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
# BOSSA needs a "bin2c" program to embed images.
|
|
|
|
# Source taken from:
|
|
|
|
# http://wiki.wxwidgets.org/Embedding_PNG_Images-Bin2c_In_C
|
|
|
|
bin2c = stdenv.mkDerivation {
|
|
|
|
name = "bossa-bin2c";
|
|
|
|
src = ./bin2c.c;
|
2019-06-19 15:45:34 +00:00
|
|
|
dontUnpack = true;
|
2021-01-24 09:19:10 +00:00
|
|
|
buildPhase = "cc $src -o bin2c";
|
|
|
|
installPhase = "mkdir -p $out/bin; cp bin2c $out/bin/";
|
2014-08-27 10:51:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
2022-03-15 10:20:44 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-06-20 10:34:30 +00:00
|
|
|
pname = "bossa";
|
2022-08-14 15:22:00 +00:00
|
|
|
version = "1.9.1";
|
2014-08-27 10:51:21 +00:00
|
|
|
|
2022-03-15 10:20:44 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "shumatech";
|
|
|
|
repo = "BOSSA";
|
|
|
|
rev = version;
|
2022-08-14 15:22:00 +00:00
|
|
|
sha256 = "sha256-8M3MU/+Y1L6SaQ1yoC9Z27A/gGruZdopLnL1z7h7YJw=";
|
2014-08-27 10:51:21 +00:00
|
|
|
};
|
|
|
|
|
2024-05-06 09:48:33 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
# Required for building on Darwin with clang >=15.
|
|
|
|
name = "pr-172-fix.patch";
|
|
|
|
url = "https://github.com/shumatech/BOSSA/commit/6e54973c3c758674c3d04b5e2cf12e097006f6a3.patch";
|
|
|
|
hash = "sha256-2lp6Ej3IfofztC1n/yHLjabn0MH4BA/CM3dsnAw8klA=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-03-14 11:05:47 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace "-arch x86_64" ""
|
|
|
|
'';
|
|
|
|
|
2014-08-27 10:51:21 +00:00
|
|
|
nativeBuildInputs = [ bin2c ];
|
2023-03-14 11:05:47 +00:00
|
|
|
buildInputs = [
|
|
|
|
wxGTK32
|
|
|
|
libX11
|
|
|
|
readline
|
|
|
|
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
|
|
darwin.apple_sdk.frameworks.Cocoa
|
|
|
|
];
|
2014-08-27 10:51:21 +00:00
|
|
|
|
2023-03-14 11:05:47 +00:00
|
|
|
makeFlags = [
|
|
|
|
"WXVERSION=3.2"
|
|
|
|
# Explicitly specify targets so they don't get stripped.
|
|
|
|
"bin/bossac"
|
|
|
|
"bin/bossash"
|
|
|
|
"bin/bossa"
|
|
|
|
];
|
2023-02-19 19:23:32 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
|
2014-08-27 10:51:21 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp bin/bossa{c,sh,} $out/bin/
|
|
|
|
'';
|
|
|
|
|
2021-01-23 12:26:19 +00:00
|
|
|
meta = with lib; {
|
2014-08-27 10:51:21 +00:00
|
|
|
description = "Flash programming utility for Atmel's SAM family of flash-based ARM microcontrollers";
|
|
|
|
longDescription = ''
|
|
|
|
BOSSA is a flash programming utility for Atmel's SAM family of
|
|
|
|
flash-based ARM microcontrollers. The motivation behind BOSSA is
|
|
|
|
to create a simple, easy-to-use, open source utility to replace
|
|
|
|
Atmel's SAM-BA software. BOSSA is an acronym for Basic Open
|
|
|
|
Source SAM-BA Application to reflect that goal.
|
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://www.shumatech.com/web/products/bossa";
|
2014-08-27 10:51:21 +00:00
|
|
|
license = licenses.bsd3;
|
2023-03-14 11:05:47 +00:00
|
|
|
platforms = platforms.unix;
|
2014-08-27 10:51:21 +00:00
|
|
|
};
|
|
|
|
}
|