From 7e410db7ad85860cc106d92a4ed0c3ecbeec5658 Mon Sep 17 00:00:00 2001 From: Adrian Ho Date: Tue, 17 Jan 2023 11:30:52 +0800 Subject: [PATCH] libfyaml: add 0.7.12 bottle. --- Formula/libfyaml.rb | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Formula/libfyaml.rb diff --git a/Formula/libfyaml.rb b/Formula/libfyaml.rb new file mode 100644 index 00000000000..c912857b266 --- /dev/null +++ b/Formula/libfyaml.rb @@ -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 + #include + + 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