homebrew-core/Formula/libngspice.rb

59 lines
1.6 KiB
Ruby

class Libngspice < Formula
desc "Spice circuit simulator as shared library"
homepage "https://ngspice.sourceforge.io/"
url "https://downloads.sourceforge.net/project/ngspice/ng-spice-rework/32/ngspice-32.tar.gz"
sha256 "3cd90c4e94516d87c5b4d02a3a6405b1136b25d05c871d4fee1fd7c4c0d03ef2"
livecheck do
url :stable
regex(%r{url=.*?/ngspice[._-]v?(\d+(?:\.\d+)*)\.t}i)
end
bottle do
sha256 "841f339c398271eb34271fbcdfc0bb8fadf9d17946366f4d846b1e4d6787b54d" => :catalina
sha256 "2e23db9a3e98328340cb5d1f91d784d23cd29108b2dd3a598a133effc0e2b983" => :mojave
sha256 "a82395ca8c0b71c8ac9727ac327f31123bd88453632d00d7efbc6f2240cd1f31" => :high_sierra
end
head do
url "https://git.code.sf.net/p/ngspice/ngspice.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "bison" => :build
depends_on "flex" => :build
depends_on "libtool" => :build
end
def install
system "./autogen.sh" if build.head?
args = %W[
--disable-debug
--disable-dependency-tracking
--prefix=#{prefix}
--with-ngshared
--enable-cider
--enable-xspice
]
system "./configure", *args
system "make", "install"
end
test do
(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