nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 wxGTK32,
6 libX11,
7 readline,
8 fetchpatch,
9}:
10
11let
12 # BOSSA needs a "bin2c" program to embed images.
13 # Source taken from:
14 # http://wiki.wxwidgets.org/Embedding_PNG_Images-Bin2c_In_C
15 bin2c = stdenv.mkDerivation {
16 name = "bossa-bin2c";
17 src = ./bin2c.c;
18 dontUnpack = true;
19 buildPhase = "cc $src -o bin2c";
20 installPhase = "mkdir -p $out/bin; cp bin2c $out/bin/";
21 };
22
23in
24stdenv.mkDerivation rec {
25 pname = "bossa";
26 version = "1.9.1";
27
28 src = fetchFromGitHub {
29 owner = "shumatech";
30 repo = "BOSSA";
31 rev = version;
32 sha256 = "sha256-8M3MU/+Y1L6SaQ1yoC9Z27A/gGruZdopLnL1z7h7YJw=";
33 };
34
35 patches = [
36 (fetchpatch {
37 # Required for building on Darwin with clang >=15.
38 name = "pr-172-fix.patch";
39 url = "https://github.com/shumatech/BOSSA/commit/6e54973c3c758674c3d04b5e2cf12e097006f6a3.patch";
40 hash = "sha256-2lp6Ej3IfofztC1n/yHLjabn0MH4BA/CM3dsnAw8klA=";
41 })
42 ];
43
44 postPatch = ''
45 substituteInPlace Makefile \
46 --replace "-arch x86_64" ""
47 '';
48
49 nativeBuildInputs = [ bin2c ];
50 buildInputs = [
51 wxGTK32
52 libX11
53 readline
54 ];
55
56 makeFlags = [
57 "WXVERSION=3.2"
58 # Explicitly specify targets so they don't get stripped.
59 "bin/bossac"
60 "bin/bossash"
61 "bin/bossa"
62 ];
63
64 env.NIX_CFLAGS_COMPILE = toString (
65 [
66 "-Wno-error=deprecated-declarations"
67 ]
68 ++ lib.optionals stdenv.cc.isClang [
69 "-Wno-error=vla-cxx-extension"
70 ]
71 );
72
73 installPhase = ''
74 mkdir -p $out/bin
75 cp bin/bossa{c,sh,} $out/bin/
76 '';
77
78 meta = with lib; {
79 description = "Flash programming utility for Atmel's SAM family of flash-based ARM microcontrollers";
80 longDescription = ''
81 BOSSA is a flash programming utility for Atmel's SAM family of
82 flash-based ARM microcontrollers. The motivation behind BOSSA is
83 to create a simple, easy-to-use, open source utility to replace
84 Atmel's SAM-BA software. BOSSA is an acronym for Basic Open
85 Source SAM-BA Application to reflect that goal.
86 '';
87 homepage = "http://www.shumatech.com/web/products/bossa";
88 license = licenses.bsd3;
89 platforms = platforms.unix;
90 };
91}