Merge pull request #282133 from fedeinthemix/wip-fastcap

fastcap: init at 2.0
This commit is contained in:
Sandro 2024-02-11 23:37:20 +01:00 committed by GitHub
commit 72485491cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 126 additions and 0 deletions

View File

@ -0,0 +1,13 @@
Don't use timing as there is a type conflict.
--- nix-build-fastcap-2.0-18Sep92.drv-1/src/mulGlobal.h.orig 2015-07-21 15:58:49.199101566 +0200
+++ nix-build-fastcap-2.0-18Sep92.drv-1/src/mulGlobal.h 2015-07-21 16:18:39.456751313 +0200
@@ -57,7 +57,7 @@
/* time variables/structs */
#ifndef _TIME_ /* if not on a Sun4 */
#ifndef NEWS /* if not on a NWS-38XX */
-#include <time.h>
+//#include <time.h>
#endif
#endif

View File

@ -0,0 +1,19 @@
Add forward declarations.
--- fastcap/src/mulSetup.c.orig 2015-07-22 13:55:21.592119775 +0200
+++ fastcap/src/mulSetup.c 2015-07-22 14:08:50.157688209 +0200
@@ -35,6 +35,14 @@
#include "mulGlobal.h"
+static getnbrs(ssystem*);
+static linkcubes(ssystem*);
+static setMaxq(ssystem*);
+static getAllInter(ssystem*);
+static set_vector_masks(ssystem*);
+static indexkid(ssystem*, cube*, int*, int*);
+static int placeq(int, ssystem*, charge*);
+
cube *cstack[1024]; /* Stack used in several routines. */
/*

View File

@ -0,0 +1,94 @@
{ stdenv
, fetchzip
, ghostscript
, lib
, texliveMedium
}:
stdenv.mkDerivation rec {
pname = "fastcap";
version = "2.0-18Sep92";
src = fetchzip {
url = "https://www.rle.mit.edu/cpg/codes/fastcap-${version}.tgz";
hash = "sha256-fnmC6WNd7xk8fphxkMZUq2+Qz+2mWIP2lvBUBAmUvHI";
stripRoot = false;
};
patches = [
./fastcap-mulglobal-drop-conflicting-lib.patch
./fastcap-mulsetup-add-forward-declarations.patch
];
nativeBuildInputs = [
ghostscript
texliveMedium
];
postPatch = ''
substituteInPlace ./doc/Makefile \
--replace '/bin/rm' 'rm'
for f in "doc/*.tex" ; do
sed -i -E $f \
-e 's/\\special\{psfile=([^,]*),.*scale=([#0-9.]*).*\}/\\includegraphics[scale=\2]{\1}/' \
-e 's/\\psfig\{figure=([^,]*),.*width=([#0-9.]*in).*\}/\\includegraphics[width=\2]{\1}/' \
-e 's/\\psfig\{figure=([^,]*),.*height=([#0-9.]*in).*\}/\\includegraphics[height=\2]{\1}/' \
-e 's/\\psfig\{figure=([^,]*)\}/\\includegraphics{\1}/'
done
for f in "doc/mtt.tex" "doc/tcad.tex" "doc/ug.tex"; do
sed -i -E $f \
-e 's/^\\documentstyle\[(.*)\]\{(.*)\}/\\documentclass[\1]{\2}\n\\usepackage{graphicx}\n\\usepackage{robinspace}/' \
-e 's/\\setlength\{\\footheight\}\{.*\}/%/' \
-e 's/\\setstretch\{.*\}/%/'
done
'';
dontConfigure = true;
makeFlags = [
"RM=rm"
"SHELL=sh"
"all"
];
outputs = [ "out" "doc" ];
postBuild = ''
make manual
pushd doc
find -name '*.dvi' -exec dvipdf {} \;
popd
'';
installPhase = ''
runHook preInstall
mkdir -p $out/
mv bin $out/bin
rm $out/bin/README
mkdir -p $doc/share/doc/fastcap-${version}
cp doc/*.pdf $doc/share/doc/fastcap-${version}
mkdir -p $out/share/fastcap
mv examples $out/share/fastcap
runHook postInstall
'';
meta = with lib; {
description = "Multipole-accelerated capacitance extraction program";
longDescription = ''
Fastcap is a three dimensional capacitance extraction program that
compute self and mutual capacitances between conductors of arbitrary
shapes, sizes and orientations.
'';
homepage = "https://www.rle.mit.edu/cpg/research_codes.htm";
license = licenses.mit;
maintainers = with maintainers; [ fbeffa ];
platforms = platforms.linux;
mainProgram = "fastcap";
};
}