diff options
author | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-11-05 17:59:31 -0300 |
---|---|---|
committer | Anderson Torres <torres.anderson.85@protonmail.com> | 2023-11-11 16:48:40 -0300 |
commit | 10b64a28c42d6b1e6819ca8baa63eec2e498bbfc (patch) | |
tree | 309caad75dd3099a334092acce57525b346ad9d7 | |
parent | 2423baa7f189f0777d7bc55f9ca7d833927b4102 (diff) | |
download | nixlib-10b64a28c42d6b1e6819ca8baa63eec2e498bbfc.tar nixlib-10b64a28c42d6b1e6819ca8baa63eec2e498bbfc.tar.gz nixlib-10b64a28c42d6b1e6819ca8baa63eec2e498bbfc.tar.bz2 nixlib-10b64a28c42d6b1e6819ca8baa63eec2e498bbfc.tar.lz nixlib-10b64a28c42d6b1e6819ca8baa63eec2e498bbfc.tar.xz nixlib-10b64a28c42d6b1e6819ca8baa63eec2e498bbfc.tar.zst nixlib-10b64a28c42d6b1e6819ca8baa63eec2e498bbfc.zip |
sdcc: refactor
- remove null'ities - assert validity of excludedPorts list - use finalAttrs design pattern - split outputs - add meta.mainProgram,
-rw-r--r-- | pkgs/by-name/sd/sdcc/package.nix | 77 |
1 files changed, 53 insertions, 24 deletions
diff --git a/pkgs/by-name/sd/sdcc/package.nix b/pkgs/by-name/sd/sdcc/package.nix index 5e5a0bee51fc..eaac606fbdb7 100644 --- a/pkgs/by-name/sd/sdcc/package.nix +++ b/pkgs/by-name/sd/sdcc/package.nix @@ -1,27 +1,53 @@ -{ lib, stdenv, fetchurl, autoconf, bison, boost, flex, texinfo, zlib, gputils ? null -, excludePorts ? [] }: +{ lib +, stdenv +, fetchurl +, autoconf +, bison +, boost +, flex +, gputils +, texinfo +, zlib +, withGputils ? false +, excludePorts ? [] +}: -let - # choices: mcs51 z80 z180 r2k r3ka gbz80 tlcs90 ds390 ds400 pic14 pic16 hc08 s08 stm8 - excludedPorts = excludePorts ++ (lib.optionals (gputils == null) [ "pic14" "pic16" ]); -in - -stdenv.mkDerivation rec { +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-${version}.tar.bz2"; - sha256 = "sha256-tJuuHSO81gV6gsT/5WE/nNDLz9HpQOnYTEv+nfCowFM="; + url = "mirror://sourceforge/sdcc/sdcc-src-${finalAttrs.version}.tar.bz2"; + hash = "sha256-tJuuHSO81gV6gsT/5WE/nNDLz9HpQOnYTEv+nfCowFM="; }; + outputs = [ "out" "doc" "man" ]; + enableParallelBuilding = true; - buildInputs = [ boost gputils texinfo zlib ]; + nativeBuildInputs = [ + autoconf + bison + flex + ]; - nativeBuildInputs = [ autoconf bison flex ]; + buildInputs = [ + boost + texinfo + zlib + ] ++ lib.optionals withGputils [ + gputils + ]; - configureFlags = map (f: "--disable-${f}-port") excludedPorts; + configureFlags = let + excludedPorts = excludePorts + ++ (lib.optionals (!withGputils) [ "pic14" "pic16" ]); + in + map (f: "--disable-${f}-port") excludedPorts; preConfigure = '' if test -n "''${dontStrip-}"; then @@ -29,19 +55,22 @@ stdenv.mkDerivation rec { fi ''; - meta = with lib; { + 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. + 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. ''; - homepage = "https://sdcc.sourceforge.net/"; - license = with licenses; if (gputils == null) then gpl2Plus else unfreeRedistributable; - maintainers = with maintainers; [ bjornfor yorickvp ]; - platforms = platforms.all; + license = if withGputils + then lib.licenses.unfreeRedistributable + else lib.licenses.gpl2Plus; + mainProgram = "sdcc"; + maintainers = with lib.maintainers; [ bjornfor yorickvp ]; + platforms = lib.platforms.all; }; -} +}) |