preload: init at 0.6.4
[NixPkgs.git] / pkgs / by-name / sd / sdcc / package.nix
blobeaac606fbdb7c4dd78761a33bef631735ca63683
1 { lib
2 , stdenv
3 , fetchurl
4 , autoconf
5 , bison
6 , boost
7 , flex
8 , gputils
9 , texinfo
10 , zlib
11 , withGputils ? false
12 , excludePorts ? []
15 assert lib.subtractLists [
16   "ds390" "ds400" "gbz80" "hc08" "mcs51" "pic14" "pic16" "r2k" "r3ka" "s08"
17   "stm8" "tlcs90" "z80" "z180"
18 ] excludePorts == [];
19 stdenv.mkDerivation (finalAttrs: {
20   pname = "sdcc";
21   version = "4.2.0";
23   src = fetchurl {
24     url = "mirror://sourceforge/sdcc/sdcc-src-${finalAttrs.version}.tar.bz2";
25     hash = "sha256-tJuuHSO81gV6gsT/5WE/nNDLz9HpQOnYTEv+nfCowFM=";
26   };
28   outputs = [ "out" "doc" "man" ];
30   enableParallelBuilding = true;
32   nativeBuildInputs = [
33     autoconf
34     bison
35     flex
36   ];
38   buildInputs = [
39     boost
40     texinfo
41     zlib
42   ] ++ lib.optionals withGputils [
43     gputils
44   ];
46   configureFlags = let
47     excludedPorts = excludePorts
48                     ++ (lib.optionals (!withGputils) [ "pic14" "pic16" ]);
49   in
50     map (f: "--disable-${f}-port") excludedPorts;
52   preConfigure = ''
53     if test -n "''${dontStrip-}"; then
54       export STRIP=none
55     fi
56   '';
58   meta = {
59     homepage = "https://sdcc.sourceforge.net/";
60     description = "Small Device C Compiler";
61     longDescription = ''
62       SDCC is a retargettable, optimizing ANSI - C compiler suite that targets
63       the Intel MCS51 based microprocessors (8031, 8032, 8051, 8052, etc.),
64       Maxim (formerly Dallas) DS80C390 variants, Freescale (formerly Motorola)
65       HC08 based (hc08, s08) and Zilog Z80 based MCUs (z80, z180, gbz80, Rabbit
66       2000/3000, Rabbit 3000A). Work is in progress on supporting the Microchip
67       PIC16 and PIC18 targets. It can be retargeted for other microprocessors.
68     '';
69     license = if withGputils
70               then lib.licenses.unfreeRedistributable
71               else lib.licenses.gpl2Plus;
72     mainProgram = "sdcc";
73     maintainers = with lib.maintainers; [ bjornfor yorickvp ];
74     platforms = lib.platforms.all;
75   };