homebrew-core/Formula/dynare.rb

84 lines
2.8 KiB
Ruby

class Dynare < Formula
desc "Platform for economic models, particularly DSGE and OLG models"
homepage "https://www.dynare.org/"
url "https://www.dynare.org/release/source/dynare-4.5.7.tar.xz"
sha256 "9224ec5279d79d55d91a01ed90022e484f66ce93d56ca6d52933163f538715d4"
license "GPL-3.0-or-later"
revision 13
bottle do
cellar :any
sha256 "405340f12c76b7d99b39663e88f0c379b304f6e8548cb8c7d985f96857653769" => :catalina
sha256 "b08d5deb853d4aade3ddc1c65c32ed67a07bd85234f2fe07b16e1c6460767abb" => :mojave
sha256 "bd22eddfc2a888987210f5d4736457a1e3b3a7b410f90f4116775a4d8a9d7136" => :high_sierra
end
head do
url "https://git.dynare.org/Dynare/dynare.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "bison" => :build
depends_on "flex" => :build
end
depends_on "boost" => :build
depends_on "cweb" => :build
depends_on "fftw"
depends_on "gcc" # for gfortran
depends_on "gsl"
depends_on "hdf5"
depends_on "libmatio"
depends_on "metis"
depends_on "octave"
depends_on "openblas"
depends_on "suite-sparse"
resource "slicot" do
url "https://deb.debian.org/debian/pool/main/s/slicot/slicot_5.0+20101122.orig.tar.gz"
sha256 "fa80f7c75dab6bfaca93c3b374c774fd87876f34fba969af9133eeaea5f39a3d"
end
def install
ENV.cxx11
resource("slicot").stage do
system "make", "lib", "OPTS=-fPIC", "SLICOTLIB=../libslicot_pic.a",
"FORTRAN=gfortran", "LOADER=gfortran"
system "make", "clean"
system "make", "lib", "OPTS=-fPIC -fdefault-integer-8",
"FORTRAN=gfortran", "LOADER=gfortran",
"SLICOTLIB=../libslicot64_pic.a"
(buildpath/"slicot/lib").install "libslicot_pic.a", "libslicot64_pic.a"
end
system "autoreconf", "-fvi" if build.head?
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--disable-matlab",
"--with-slicot=#{buildpath}/slicot",
"--with-boost=#{Formula["boost"].prefix}",
"--disable-doc"
# Octave hardcodes its paths which causes problems on GCC minor version bumps
gcc = Formula["gcc"]
gcc_major_ver = gcc.any_installed_version.major
flibs = "-L#{gcc.lib}/gcc/#{gcc_major_ver} -lgfortran -lquadmath -lm"
system "make", "install", "FLIBS=#{flibs}"
end
def caveats
<<~EOS
To get started with Dynare, open Octave and type
addpath #{opt_lib}/dynare/matlab
EOS
end
test do
cp lib/"dynare/examples/bkk.mod", testpath
system Formula["octave"].opt_bin/"octave", "--no-gui", "-H", "--path",
"#{lib}/dynare/matlab", "--eval", "dynare bkk.mod console"
end
end