1{ lib
2, stdenv
3, fetchFromGitHub
4, wxGTK32
5, libX11
6, readline
7, darwin
8}:
9
10let
11 # BOSSA needs a "bin2c" program to embed images.
12 # Source taken from:
13 # http://wiki.wxwidgets.org/Embedding_PNG_Images-Bin2c_In_C
14 bin2c = stdenv.mkDerivation {
15 name = "bossa-bin2c";
16 src = ./bin2c.c;
17 dontUnpack = true;
18 buildPhase = "cc $src -o bin2c";
19 installPhase = "mkdir -p $out/bin; cp bin2c $out/bin/";
20 };
21
22in
23stdenv.mkDerivation rec {
24 pname = "bossa";
25 version = "1.9.1";
26
27 src = fetchFromGitHub {
28 owner = "shumatech";
29 repo = "BOSSA";
30 rev = version;
31 sha256 = "sha256-8M3MU/+Y1L6SaQ1yoC9Z27A/gGruZdopLnL1z7h7YJw=";
32 };
33
34 postPatch = ''
35 substituteInPlace Makefile \
36 --replace "-arch x86_64" ""
37 '';
38
39 nativeBuildInputs = [ bin2c ];
40 buildInputs = [
41 wxGTK32
42 libX11
43 readline
44 ] ++ lib.optionals stdenv.isDarwin [
45 darwin.apple_sdk.frameworks.Cocoa
46 ];
47
48 makeFlags = [
49 "WXVERSION=3.2"
50 # Explicitly specify targets so they don't get stripped.
51 "bin/bossac"
52 "bin/bossash"
53 "bin/bossa"
54 ];
55 env.NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
56
57 installPhase = ''
58 mkdir -p $out/bin
59 cp bin/bossa{c,sh,} $out/bin/
60 '';
61
62 meta = with lib; {
63 description = "A flash programming utility for Atmel's SAM family of flash-based ARM microcontrollers";
64 longDescription = ''
65 BOSSA is a flash programming utility for Atmel's SAM family of
66 flash-based ARM microcontrollers. The motivation behind BOSSA is
67 to create a simple, easy-to-use, open source utility to replace
68 Atmel's SAM-BA software. BOSSA is an acronym for Basic Open
69 Source SAM-BA Application to reflect that goal.
70 '';
71 homepage = "http://www.shumatech.com/web/products/bossa";
72 license = licenses.bsd3;
73 platforms = platforms.unix;
74 };
75}