Skip to content

Commit

Permalink
ngspice: remove unused dependencies and add shared library.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: d2c3330995ab0d85ccbce0e0a27a62888116fc04
  • Loading branch information
johanvdhaegen committed Nov 15, 2023
1 parent 07ae80d commit ca28b18
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions Formula/ngspice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Ngspice < Formula
url "https://downloads.sourceforge.net/project/ngspice/ng-spice-rework/41/ngspice-41.tar.gz"
sha256 "1ce219395d2f50c33eb223a1403f8318b168f1e6d1015a7db9dbf439408de8c4"
license :cannot_represent
revision 1

livecheck do
url :stable
Expand All @@ -25,26 +26,33 @@ class Ngspice < Formula

depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "bison" => :build
depends_on "libtool" => :build
depends_on "fftw"
depends_on "readline"
depends_on "tcl-tk"

uses_from_macos "bison" => :build

def install
system "./autogen.sh"

args = %w[
--with-readline=yes
--disable-debug
--enable-xspice
--enable-cider
--enable-pss
--without-x
]
args_cmd_line = %w[
--with-readline=yes
]
args_shared = %w[
--with-ngshared
]

system "./configure", *std_configure_args, *args
system "./configure", *std_configure_args, *args, *args_shared
system "make", "install"
system "make", "clean"
system "./configure", *std_configure_args, *args, *args_cmd_line
system "make", "install"
end

Expand All @@ -62,5 +70,18 @@ def install
.end
EOS
system "#{bin}/ngspice", "test.cir"

(testpath/"test.cpp").write <<~EOS
#include <cstdlib>
#include <ngspice/sharedspice.h>
int ng_exit(int status, bool immediate, bool quitexit, int ident, void *userdata) {
return status;
}
int main() {
return ngSpice_Init(NULL, NULL, ng_exit, NULL, NULL, NULL, NULL);
}
EOS
system ENV.cc, "test.cpp", "-I#{include}", "-L#{lib}", "-lngspice", "-o", "test"
system "./test"
end
end

0 comments on commit ca28b18

Please sign in to comment.