class Libxc < Formula desc "Library of exchange and correlation functionals for codes" homepage "https://tddft.org/programs/libxc/" url "https://gitlab.com/libxc/libxc/-/archive/4.3.4/libxc-4.3.4.tar.bz2" sha256 "0efe8b33d151de8787e33c4ba8e2161ffb9da978753f3bd12c5c0a018e7d3ef5" bottle do cellar :any rebuild 1 sha256 "072df8c5f3e00bf045f4e062993ecb08e324872daf3503b8f2bacef866a3de14" => :catalina sha256 "7727321091982306464ad87e055074b2675d83ee3c8416cf6b0681a4db31bc85" => :mojave sha256 "c8f820ca8dce64220c8c1e60002a13c4ed21d5decfd6b1189b6d286ca5c47ab4" => :high_sierra end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build depends_on "gcc" # for gfortran def install system "autoreconf", "-fiv" system "./configure", "--prefix=#{prefix}", "--enable-shared", "FCCPP=gfortran -E -x c", "CC=#{ENV.cc}" system "make", "install" end test do (testpath/"test.c").write <<~EOS #include #include int main() { int major, minor, micro; xc_version(&major, &minor, µ); printf(\"%d.%d.%d\", major, minor, micro); } EOS system ENV.cc, "test.c", "-L#{lib}", "-lxc", "-I#{include}", "-o", "ctest" system "./ctest" (testpath/"test.f90").write <<~EOS program lxctest use xc_f90_types_m use xc_f90_lib_m end program lxctest EOS system "gfortran", "test.f90", "-L#{lib}", "-lxc", "-I#{include}", "-o", "ftest" system "./ftest" end end