nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 137 lines 3.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 fetchpatch, 6 autoconf, 7 bison, 8 boost, 9 flex, 10 gputils, 11 texinfo, 12 zlib, 13 withGputils ? false, 14 excludePorts ? [ ], 15}: 16 17assert 18 lib.subtractLists [ 19 "ds390" 20 "ds400" 21 "gbz80" 22 "hc08" 23 "mcs51" 24 "pic14" 25 "pic16" 26 "r2k" 27 "r3ka" 28 "s08" 29 "stm8" 30 "tlcs90" 31 "z80" 32 "z180" 33 ] excludePorts == [ ]; 34stdenv.mkDerivation (finalAttrs: { 35 pname = "sdcc"; 36 version = "4.5.0"; 37 38 src = fetchurl { 39 url = "mirror://sourceforge/sdcc/sdcc-src-${finalAttrs.version}.tar.bz2"; 40 hash = "sha256-1QMEN/tDa7HZOo29v7RrqqYGEzGPT7P1hx1ygV0e7YA="; 41 }; 42 43 # TODO: sdcc version 4.5.0 does not currently produce a man output. 44 # Until the fix to sdcc's makefiles is released, this workaround 45 # conditionally withholds the man output on darwin. 46 # 47 # sdcc's tracking issue: 48 # <https://sourceforge.net/p/sdcc/bugs/3848/> 49 outputs = [ 50 "out" 51 "doc" 52 ] 53 ++ lib.optionals (!stdenv.isDarwin) [ 54 "man" 55 ]; 56 57 enableParallelBuilding = true; 58 59 nativeBuildInputs = [ 60 autoconf 61 bison 62 flex 63 ]; 64 65 buildInputs = [ 66 boost 67 texinfo 68 zlib 69 ] 70 ++ lib.optionals withGputils [ 71 gputils 72 ]; 73 74 patches = [ 75 # Fix build with gcc15 76 # https://sourceforge.net/p/sdcc/bugs/3846/ 77 (fetchpatch { 78 name = "sdcc-fix-aslink-elf-signature.patch"; 79 url = "https://src.fedoraproject.org/rpms/sdcc/raw/4a7c2a7e32369461eb451fc6f4d678a010135afc/f/sdcc-4.4.0-aslink.patch"; 80 hash = "sha256-xGilNetecPBj2VV3ebmln5BKqs3OoWFf6y2S3TBTHMQ="; 81 }) 82 ]; 83 84 # sdcc 4.5.0 massively rewrote sim/ucsim/Makefile.in, and lost the `.PHONY` 85 # rule in the process. As a result, on macOS (which uses a case-insensitive 86 # filesystem), the INSTALL file keeps the `install` target in the ucsim 87 # directory from running. Nothing else creates the `man` output, causing the 88 # entire build to fail. 89 # 90 # TODO: remove this when updating to the next release - it's been fixed in 91 # upstream sdcc r15384 <https://sourceforge.net/p/sdcc/code/15384/>. 92 93 postPatch = '' 94 if grep -q '\.PHONY:.*install' sim/ucsim/Makefile.in; then 95 echo 'Upstream has added `.PHONY: install` rule; must remove `postPatch` from the Nix file.' >&2 96 exit 1 97 fi 98 echo '.PHONY: install' >> sim/ucsim/Makefile.in 99 ''; 100 101 configureFlags = 102 let 103 excludedPorts = 104 excludePorts 105 ++ (lib.optionals (!withGputils) [ 106 "pic14" 107 "pic16" 108 ]); 109 in 110 map (f: "--disable-${f}-port") excludedPorts; 111 112 preConfigure = '' 113 if test -n "''${dontStrip-}"; then 114 export STRIP=none 115 fi 116 ''; 117 118 meta = { 119 homepage = "https://sdcc.sourceforge.net/"; 120 description = "Small Device C Compiler"; 121 longDescription = '' 122 SDCC is a retargettable, optimizing ANSI - C compiler suite that targets 123 the Intel MCS51 based microprocessors (8031, 8032, 8051, 8052, etc.), 124 Maxim (formerly Dallas) DS80C390 variants, Freescale (formerly Motorola) 125 HC08 based (hc08, s08) and Zilog Z80 based MCUs (z80, z180, gbz80, Rabbit 126 2000/3000, Rabbit 3000A). Work is in progress on supporting the Microchip 127 PIC16 and PIC18 targets. It can be retargeted for other microprocessors. 128 ''; 129 license = if withGputils then lib.licenses.unfreeRedistributable else lib.licenses.gpl2Plus; 130 mainProgram = "sdcc"; 131 maintainers = with lib.maintainers; [ 132 bjornfor 133 yorickvp 134 ]; 135 platforms = lib.platforms.all; 136 }; 137})