From 007e8903a943d89d4544be2e9c58cbe8d41a4bc1 Mon Sep 17 00:00:00 2001 From: Sigmanificient Date: Thu, 22 May 2025 01:10:21 +0200 Subject: [PATCH] fasthenry: modernize (cherry picked from commit afc5cef25629ff9141af7123e7fc8f6893502e33) --- pkgs/by-name/fa/fasthenry/package.nix | 58 +++++++++------------------ 1 file changed, 20 insertions(+), 38 deletions(-) diff --git a/pkgs/by-name/fa/fasthenry/package.nix b/pkgs/by-name/fa/fasthenry/package.nix index b4595615ea6b..20e2e68afead 100644 --- a/pkgs/by-name/fa/fasthenry/package.nix +++ b/pkgs/by-name/fa/fasthenry/package.nix @@ -4,7 +4,7 @@ lib, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "fasthenry"; # later versions are Windows only ports # nixpkgs-update: no auto update @@ -17,60 +17,42 @@ stdenv.mkDerivation rec { src = fetchFromGitHub { owner = "ediloren"; repo = "FastHenry2"; - rev = "R${version}"; - sha256 = "017kcri69zhyhii59kxj1ak0gyfn7jf0qp6p2x3nnljia8njdkcc"; + tag = "R${finalAttrs.version}"; + hash = "sha256-jM0mLVJRUmtHF9dcDJw81vkHpgqyz1RihB7+ZGJm8wQ="; }; - dontConfigure = true; - env.NIX_CFLAGS_COMPILE = toString [ + "-fcommon -O -DFOUR" + (lib.optional stdenv.hostPlatform.isx86_64 "-m64") "-Wno-error=implicit-function-declaration" "-Wno-error=implicit-int" "-Wno-error=return-mismatch" ]; - - preBuild = - '' - makeFlagsArray=( - CC="gcc" - RM="rm" - SHELL="sh" - "all" - ) - '' - + ( - if stdenv.hostPlatform.isx86_64 then - '' - makeFlagsArray+=( - CFLAGS="-fcommon -O -DFOUR -m64" - ); - '' - else - '' - makeFlagsArray+=( - CFLAGS="-fcommon -O -DFOUR" - ); - '' - ); + makeFlags = [ "all" ]; # need "all" to be explicitely set installPhase = '' + runHook preInstall + mkdir -p $out/bin cp -r bin/* $out/bin/ - mkdir -p $out/share/doc/${pname}-${version} - cp -r doc/* $out/share/doc/${pname}-${version} - mkdir -p $out/share/${pname}-${version}/examples - cp -r examples/* $out/share/${pname}-${version}/examples + mkdir -p $out/share/fasthenry/doc + cp -r doc/* $out/share/fasthenry/doc + mkdir -p $out/share/fasthenry/examples + cp -r examples/* $out/share/fasthenry/examples + + runHook postInstall ''; - meta = with lib; { + meta = { description = "Multipole-accelerated inductance analysis program"; longDescription = '' Fasthenry is an inductance extraction program based on a multipole-accelerated algorithm.''; homepage = "https://www.fastfieldsolvers.com/fasthenry2.htm"; - license = licenses.lgpl2Only; - maintainers = with maintainers; [ fbeffa ]; - platforms = intersectLists (platforms.linux) (platforms.x86_64 ++ platforms.x86); + license = lib.licenses.lgpl2Only; + maintainers = with lib.maintainers; [ fbeffa ]; + platforms = with lib.platforms; lib.intersectLists (linux) (x86_64 ++ x86); + mainProgram = "fasthenry"; }; -} +})