homebrew-core/Formula/ngspice.rb
2019-01-13 12:22:48 +01:00

62 lines
1.5 KiB
Ruby

class Ngspice < Formula
desc "Spice circuit simulator"
homepage "https://ngspice.sourceforge.io/"
url "https://downloads.sourceforge.net/project/ngspice/ng-spice-rework/30/ngspice-30.tar.gz"
sha256 "08fe0e2f3768059411328a33e736df441d7e6e7304f8dad0ed5f28e15d936097"
revision 1
bottle do
sha256 "8fa9e572ad932e60c5a8ddb8fdadcb427ba3ccd7fc5d9b896105d582fb89ee53" => :mojave
sha256 "1cbc79bf436467cc179e797aae4e1d89898084d0e83e3b12e52643e1327d4968" => :high_sierra
sha256 "dbceb83309dc75661fc943d3a7033e381813accf65c262d8547f618e7ad34166" => :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 "libtool" => :build
end
deprecated_option "with-x" => "with-x11"
depends_on "readline"
depends_on :x11 => :optional
def install
system "./autogen.sh" if build.head?
args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
--with-readline=yes
--enable-xspice
]
if build.with? "x11"
args << "--with-x"
else
args << "--without-x"
end
system "./configure", *args
system "make", "install"
end
test do
(testpath/"test.cir").write <<~EOS
RC test circuit
v1 1 0 1
r1 1 2 1
c1 2 0 1 ic=0
.tran 100u 100m uic
.control
run
quit
.endc
.end
EOS
system "#{bin}/ngspice", "test.cir"
end
end