about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2024-02-11 23:37:20 +0100
committerGitHub <noreply@github.com>2024-02-11 23:37:20 +0100
commit72485491cc10e7359ebc71c09ee6e014e5488c5e (patch)
tree266de096d5890b5f89c4bf606fa8d6ab4c6e8785
parent4db8d6d7e7cc1fe70f89a88567da4aa39e6b3f63 (diff)
parentf948faf059f1049354d83d95f0d945fef1056365 (diff)
downloadnixlib-72485491cc10e7359ebc71c09ee6e014e5488c5e.tar
nixlib-72485491cc10e7359ebc71c09ee6e014e5488c5e.tar.gz
nixlib-72485491cc10e7359ebc71c09ee6e014e5488c5e.tar.bz2
nixlib-72485491cc10e7359ebc71c09ee6e014e5488c5e.tar.lz
nixlib-72485491cc10e7359ebc71c09ee6e014e5488c5e.tar.xz
nixlib-72485491cc10e7359ebc71c09ee6e014e5488c5e.tar.zst
nixlib-72485491cc10e7359ebc71c09ee6e014e5488c5e.zip
Merge pull request #282133 from fedeinthemix/wip-fastcap
fastcap: init at 2.0
-rw-r--r--pkgs/by-name/fa/fastcap/fastcap-mulglobal-drop-conflicting-lib.patch13
-rw-r--r--pkgs/by-name/fa/fastcap/fastcap-mulsetup-add-forward-declarations.patch19
-rw-r--r--pkgs/by-name/fa/fastcap/package.nix94
3 files changed, 126 insertions, 0 deletions
diff --git a/pkgs/by-name/fa/fastcap/fastcap-mulglobal-drop-conflicting-lib.patch b/pkgs/by-name/fa/fastcap/fastcap-mulglobal-drop-conflicting-lib.patch
new file mode 100644
index 000000000000..efb3b570db04
--- /dev/null
+++ b/pkgs/by-name/fa/fastcap/fastcap-mulglobal-drop-conflicting-lib.patch
@@ -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
+ 
diff --git a/pkgs/by-name/fa/fastcap/fastcap-mulsetup-add-forward-declarations.patch b/pkgs/by-name/fa/fastcap/fastcap-mulsetup-add-forward-declarations.patch
new file mode 100644
index 000000000000..00eb7e96b5f5
--- /dev/null
+++ b/pkgs/by-name/fa/fastcap/fastcap-mulsetup-add-forward-declarations.patch
@@ -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. */
+ 
+ /*
diff --git a/pkgs/by-name/fa/fastcap/package.nix b/pkgs/by-name/fa/fastcap/package.nix
new file mode 100644
index 000000000000..f809b1094ff4
--- /dev/null
+++ b/pkgs/by-name/fa/fastcap/package.nix
@@ -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";
+  };
+}