2013-07-30 16:09:01 +00:00
|
|
|
class Libxc < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Library of exchange and correlation functionals for codes"
|
2015-03-16 22:25:47 +00:00
|
|
|
homepage "http://www.tddft.org/programs/octopus/wiki/index.php/Libxc"
|
|
|
|
url "http://www.tddft.org/programs/octopus/down.php?file=libxc/libxc-2.2.2.tar.gz"
|
|
|
|
sha256 "6ca1d0bb5fdc341d59960707bc67f23ad54de8a6018e19e02eee2b16ea7cc642"
|
2015-05-22 22:05:07 +00:00
|
|
|
revision 1
|
2013-07-30 16:09:01 +00:00
|
|
|
|
2014-07-03 21:27:44 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2015-05-23 19:06:23 +00:00
|
|
|
sha256 "21c14d74f3b61c2a90518208500aee11fc18d0f0449cb76b0d3d30a0e8ec0fe9" => :yosemite
|
|
|
|
sha256 "c6d5ac5639158a1c0c7e66abd31bdfe5fa3d036c702dc64d75d3d4a625897e4a" => :mavericks
|
|
|
|
sha256 "63b05a1fb40be747e31c0d7addf8d424df06d42dd028a907e92ea738d1b0e684" => :mountain_lion
|
2014-07-03 21:27:44 +00:00
|
|
|
end
|
|
|
|
|
2013-07-30 16:09:01 +00:00
|
|
|
depends_on :fortran
|
|
|
|
|
|
|
|
def install
|
|
|
|
system "./configure", "--prefix=#{prefix}",
|
|
|
|
"--enable-shared",
|
2013-11-16 23:37:51 +00:00
|
|
|
"FCCPP=#{ENV.fc} -E -x c",
|
2013-07-30 16:09:01 +00:00
|
|
|
"CC=#{ENV.cc}",
|
|
|
|
"CFLAGS=-pipe"
|
|
|
|
system "make"
|
2015-03-16 22:25:47 +00:00
|
|
|
system "make", "check"
|
|
|
|
system "make", "install"
|
2013-07-30 16:09:01 +00:00
|
|
|
end
|
2015-05-22 22:05:07 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"test.c").write <<-EOS.undent
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <xc.h>
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
int i, vmajor, vminor, func_id = 1;
|
|
|
|
xc_version(&vmajor, &vminor);
|
|
|
|
printf(\"%d.%d\", vmajor, vminor);
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
system ENV.cc, "test.c", "-L#{lib}", "-lxc", "-I#{include}", "-o", "ctest"
|
|
|
|
system "./ctest"
|
|
|
|
|
|
|
|
(testpath/"test.f90").write <<-EOS.undent
|
|
|
|
program lxctest
|
|
|
|
use xc_f90_types_m
|
|
|
|
use xc_f90_lib_m
|
|
|
|
end program lxctest
|
|
|
|
EOS
|
|
|
|
ENV.fortran
|
|
|
|
system ENV.fc, "test.f90", "-L#{lib}", "-lxc", "-I#{include}", "-o", "ftest"
|
|
|
|
system "./ftest"
|
|
|
|
end
|
2013-07-30 16:09:01 +00:00
|
|
|
end
|