Skip to content

Commit

Permalink
libfyaml: add 0.7.12 bottle.
Browse files Browse the repository at this point in the history
  • Loading branch information
gromgit committed Jan 17, 2023
1 parent f940cac commit 7e410db
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions Formula/libfyaml.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
class Libfyaml < Formula
desc "Fully feature complete YAML parser and emitter"
homepage "https://github.com/pantoniou/libfyaml"
url "https://github.com/pantoniou/libfyaml/releases/download/v0.7.12/libfyaml-0.7.12.tar.gz"
sha256 "485342c6920e9fdc2addfe75e5c3e0381793f18b339ab7393c1b6edf78bf8ca8"
license "MIT"

bottle do
root_url "https://github.com/gromgit/homebrew-core-mojave/releases/download/libfyaml"
sha256 cellar: :any, mojave: "5b8860d4141790f7e53c9986a79e0fa13b7032c0b8f60b144fd6c47f595b3c21"
end

# Fix -flat_namespace being used on Big Sur and later.
patch do
url "https://raw.githubusercontent.com/Homebrew/formula-patches/03cf8088210822aa2c1ab544ed58ea04c897d9c4/libtool/configure-big_sur.diff"
sha256 "35acd6aebc19843f1a2b3a63e880baceb0f5278ab1ace661e57a502d9d78c93c"
end

def install
system "./configure", *std_configure_args, "--disable-silent-rules"
system "make"
system "make", "install"
end

test do
(testpath/"test.cpp").write <<~EOS
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <iostream>
#include <libfyaml.h>
int main(int argc, char *argv[])
{
std::cout << fy_library_version() << std::endl;
return EXIT_SUCCESS;
}
EOS
system ENV.cxx, "test.cpp", "-I#{include}", "-L#{lib}", "-lfyaml", "-o", "test"
assert_equal 0, $CHILD_STATUS.exitstatus
assert_equal version.to_s, shell_output("#{testpath}/test").strip
assert_equal version.to_s, shell_output("fy-tool --version").strip
end
end

0 comments on commit 7e410db

Please sign in to comment.