Skip to content

Instantly share code, notes, and snippets.

@zbeekman
Last active January 31, 2016 04:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zbeekman/0fd245c175925b9d6bd8 to your computer and use it in GitHub Desktop.
Save zbeekman/0fd245c175925b9d6bd8 to your computer and use it in GitHub Desktop.
[Homebrew](http://brew.sh) formula for datetime-fortran.
class DatetimeFortran < Formula
desc "Fortran time and date manipulation library"
homepage "https://github.com/milancurcic/datetime-fortran"
url "https://github.com/milancurcic/datetime-fortran/archive/v1.4.2.tar.gz"
sha256 "b500da7e28241ffecb3d06d93fc4d25df71509cb949e472e92a96df843a9f4c9"
head do
url "https://github.com/milancurcic/datetime-fortran.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "pkg-config" => :build
end
option "without-test", "Run build time tests"
depends_on :fortran
def install
system "autoreconf", "-fvi" if build.head?
system "./configure", "--prefix=#{prefix}",
"--disable-silent-rules"
system "make", "check" if build.with? "test"
system "make", "install"
(pkgshare/"test").install "src/tests/datetime_tests.f90"
end
test do
ENV.fortran
system ENV.fc, "-odatetime_test", "-ldatetime", "-I#{HOMEBREW_PREFIX}/include", pkgshare/"test/datetime_tests.f90"
system testpath/"datetime_test"
end
end
class DatetimeFortran < Formula
desc "Fortran time and date manipulation library"
homepage "https://github.com/milancurcic/datetime-fortran"
url "https://github.com/milancurcic/datetime-fortran/archive/v1.4.2.tar.gz"
sha256 "a164d377884828b43c01a46ebbc0e95f7549dd8ea198ee9868f3b9eddf3addf3"
head do
url "https://github.com/milancurcic/datetime-fortran.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "pkg-config" => :build
end
option "without-test", "Run build time tests"
depends_on :fortran
def install
system "autoreconf", "-fvi" if build.head?
system "./configure", "--prefix=#{prefix}",
"--disable-silent-rules"
system "make", "check" if build.with? "test"
system "make", "install"
(pkgshare/"test").install "src/tests/datetime_tests.f90"
end
test do
ENV.fortran
system ENV.fc, "-odatetime_test", "-ldatetime", "-I#{HOMEBREW_PREFIX}/include", pkgshare/"test/datetime_tests.f90"
system testpath/"datetime_test"
end
end
@blippy
Copy link

blippy commented Jan 26, 2016

Very neat-looking.

@zbeekman
Copy link
Author

I would love to parse the output of system testpath/"datetime_test" for /FAIL/ but my ruby is sadly too limited to figure out how to do this...

@zbeekman
Copy link
Author

!assert_match /FAIL.*/, `#{testpath}/datetime_test`

from Homebrew/legacy-homebrew#48660

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment