2015-05-26 18:00:19 +00:00
|
|
|
class JsonFortran < Formula
|
2015-08-01 09:35:45 +00:00
|
|
|
desc "Fortran 2008 JSON API"
|
2015-05-26 18:00:19 +00:00
|
|
|
homepage "https://github.com/jacobwilliams/json-fortran"
|
2015-08-05 14:24:35 +00:00
|
|
|
url "https://github.com/jacobwilliams/json-fortran/archive/4.2.0.tar.gz"
|
|
|
|
sha256 "5cf12ce527809b644ae35a0a34ce330804285d3b7987b17488d1752330dd7a81"
|
2015-05-26 18:00:19 +00:00
|
|
|
|
|
|
|
head "https://github.com/jacobwilliams/json-fortran.git"
|
|
|
|
|
2015-06-06 04:33:28 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2015-08-05 16:11:38 +00:00
|
|
|
sha256 "bb9cbce17fa229548bb63d71c4905a669ddeca4c4d18553e5a2d9fb5da6a29a5" => :yosemite
|
|
|
|
sha256 "2bedbab56f3f1e042423732ae20e69318e26a42143f66461148794f1913db03c" => :mavericks
|
|
|
|
sha256 "0c2ec996d2fe95095a66cfe2aa6f4de7b995edf729494b02b3bc251b9007d8f4" => :mountain_lion
|
2015-06-06 04:33:28 +00:00
|
|
|
end
|
|
|
|
|
2015-05-26 18:00:19 +00:00
|
|
|
option "with-unicode-support", "Build json-fortran to support unicode text in json objects and files"
|
|
|
|
option "without-test", "Skip running build-time tests (not recommended)"
|
2015-08-05 14:24:35 +00:00
|
|
|
option "without-docs", "Do not build and install FORD generated documentation for json-fortran"
|
2015-05-26 18:00:19 +00:00
|
|
|
|
2015-08-05 14:24:35 +00:00
|
|
|
deprecated_option "without-robodoc" => "without-docs"
|
|
|
|
|
|
|
|
depends_on "ford" => :build if build.with? "docs"
|
2015-05-26 18:00:19 +00:00
|
|
|
depends_on "cmake" => :build
|
|
|
|
depends_on :fortran
|
|
|
|
|
|
|
|
def install
|
|
|
|
mkdir "build" do
|
|
|
|
args = std_cmake_args
|
|
|
|
args << "-DUSE_GNU_INSTALL_CONVENTION:BOOL=TRUE" # Use more GNU/Homebrew-like install layout
|
|
|
|
args << "-DENABLE_UNICODE:BOOL=TRUE" if build.with? "unicode-support"
|
2015-08-05 14:24:35 +00:00
|
|
|
args << "-DSKIP_DOC_GEN:BOOL=TRUE" if build.without? "docs"
|
2015-05-26 18:00:19 +00:00
|
|
|
system "cmake", "..", *args
|
2015-08-05 14:24:35 +00:00
|
|
|
system "make", "check" if build.with? "test"
|
2015-05-26 18:00:19 +00:00
|
|
|
system "make", "install"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
ENV.fortran
|
|
|
|
(testpath/"json_test.f90").write <<-EOS.undent
|
|
|
|
program json_test
|
|
|
|
use json_module
|
|
|
|
use ,intrinsic :: iso_fortran_env ,only: error_unit
|
|
|
|
implicit none
|
|
|
|
call json_initialize()
|
|
|
|
if ( json_failed() ) then
|
|
|
|
call json_print_error_message(error_unit)
|
|
|
|
stop 2
|
|
|
|
endif
|
|
|
|
end program
|
|
|
|
EOS
|
|
|
|
system ENV.fc, "-ojson_test", "-ljsonfortran", "-I#{HOMEBREW_PREFIX}/include", testpath/"json_test.f90"
|
|
|
|
system "./json_test"
|
|
|
|
end
|
|
|
|
end
|