From 84ff4c9a647ed81ad1303508a00a00cf9c716be4 Mon Sep 17 00:00:00 2001 From: Anderson Torres Date: Mon, 7 Oct 2024 19:37:49 -0300 Subject: [PATCH] icmake: refactor - nixfmt-rfc-style - finalAttrs - strictDeps - hammer - no nested with - more meta attrs icmake --- pkgs/by-name/ic/icmake/package.nix | 74 ++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 19 deletions(-) diff --git a/pkgs/by-name/ic/icmake/package.nix b/pkgs/by-name/ic/icmake/package.nix index 039d4ee6970c135..2b389518d9add9f 100644 --- a/pkgs/by-name/ic/icmake/package.nix +++ b/pkgs/by-name/ic/icmake/package.nix @@ -1,46 +1,82 @@ -{ lib, stdenv, fetchFromGitLab, makeWrapper, gcc, ncurses }: +{ + lib, + fetchFromGitLab, + gcc, + makeWrapper, + ncurses, + stdenv, +}: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "icmake"; version = "9.03.01"; src = fetchFromGitLab { - sha256 = "05r0a69w0hv2qhjpb2bxd0lmp2vv5r2d4iggg6ly4miam0i318jy"; - rev = version; - repo = "icmake"; owner = "fbb-git"; + repo = "icmake"; + rev = finalAttrs.version; + hash = "sha256-XqIwIqgqVuKpee9F0kQue4tbKWh9iXUlxGJDwJNRIBc="; }; - - setSourceRoot = '' - sourceRoot=$(echo */icmake) - ''; - nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ gcc ]; - preConfigure = '' + sourceRoot = "${finalAttrs.src.name}/icmake"; + + strictDeps = true; + + postPatch = '' patchShebangs ./ - substituteInPlace INSTALL.im --replace "usr/" "" + substituteInPlace INSTALL.im \ + --replace "usr/" "" ''; buildPhase = '' + runHook preBuild + ./icm_prepare $out ./icm_bootstrap x + + runHook postBuild ''; installPhase = '' + runHook preInstall + ./icm_install all / wrapProgram $out/bin/icmbuild \ - --prefix PATH : ${ncurses}/bin + --prefix PATH : ${ncurses}/bin + + runHook postInstall ''; - meta = with lib; { - description = "Program maintenance (make) utility using a C-like grammar"; + meta = { homepage = "https://fbb-git.gitlab.io/icmake/"; - license = licenses.gpl3; - maintainers = with maintainers; [ pSub ]; - platforms = platforms.linux; + description = "Program maintenance utility using a C-like grammar"; + longDescription = '' + Icmake can be used as an alternative to make(1). + + Icmake allows the programmer to use a program language (closely resembling + the well-known C-programming language) to define the actions involved in + (complex) program maintenance. For this, icmake offers various special + operators as well as a set of support functions that have proven to be + useful in program maintenance. + + Traditional make-utilities recompile sources once header files are + modified. In the context of C++ program development this is often a bad + idea, as adding a new member to a class does not normally require you to + recompile the class's sources. To handle class dependencies in a more + sensible way, icmake's CLASSES file may define dependencies among + classes. By default, class-dependencies are not interpreted. + ''; + license = lib.licenses.gpl3; + mainProgram = "icmake"; + maintainers = with lib.maintainers; [ + pSub + AndersonTorres + ]; + platforms = lib.platforms.all; }; -} +})