summary refs log tree commit diff
path: root/pkgs/by-name/sd/sdcc/package.nix
blob: eaac606fbdb7c4dd78761a33bef631735ca63683 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{ lib
, stdenv
, fetchurl
, autoconf
, bison
, boost
, flex
, gputils
, texinfo
, zlib
, withGputils ? false
, excludePorts ? []
}:

assert lib.subtractLists [
  "ds390" "ds400" "gbz80" "hc08" "mcs51" "pic14" "pic16" "r2k" "r3ka" "s08"
  "stm8" "tlcs90" "z80" "z180"
] excludePorts == [];
stdenv.mkDerivation (finalAttrs: {
  pname = "sdcc";
  version = "4.2.0";

  src = fetchurl {
    url = "mirror://sourceforge/sdcc/sdcc-src-${finalAttrs.version}.tar.bz2";
    hash = "sha256-tJuuHSO81gV6gsT/5WE/nNDLz9HpQOnYTEv+nfCowFM=";
  };

  outputs = [ "out" "doc" "man" ];

  enableParallelBuilding = true;

  nativeBuildInputs = [
    autoconf
    bison
    flex
  ];

  buildInputs = [
    boost
    texinfo
    zlib
  ] ++ lib.optionals withGputils [
    gputils
  ];

  configureFlags = let
    excludedPorts = excludePorts
                    ++ (lib.optionals (!withGputils) [ "pic14" "pic16" ]);
  in
    map (f: "--disable-${f}-port") excludedPorts;

  preConfigure = ''
    if test -n "''${dontStrip-}"; then
      export STRIP=none
    fi
  '';

  meta = {
    homepage = "https://sdcc.sourceforge.net/";
    description = "Small Device C Compiler";
    longDescription = ''
      SDCC is a retargettable, optimizing ANSI - C compiler suite that targets
      the Intel MCS51 based microprocessors (8031, 8032, 8051, 8052, etc.),
      Maxim (formerly Dallas) DS80C390 variants, Freescale (formerly Motorola)
      HC08 based (hc08, s08) and Zilog Z80 based MCUs (z80, z180, gbz80, Rabbit
      2000/3000, Rabbit 3000A). Work is in progress on supporting the Microchip
      PIC16 and PIC18 targets. It can be retargeted for other microprocessors.
    '';
    license = if withGputils
              then lib.licenses.unfreeRedistributable
              else lib.licenses.gpl2Plus;
    mainProgram = "sdcc";
    maintainers = with lib.maintainers; [ bjornfor yorickvp ];
    platforms = lib.platforms.all;
  };
})