class ApacheArrowGlib < Formula desc "GLib bindings for Apache Arrow" homepage "https://arrow.apache.org/" url "https://www.apache.org/dyn/closer.cgi?path=arrow/arrow-0.12.0/apache-arrow-0.12.0.tar.gz" sha256 "34dae7e4dde9274e9a52610683e78a80f3ca312258ad9e9f2c0973cf44247a98" bottle do sha256 "86bb1c38e067659c9d62f81c28ae72a16abd6051fc663e6660c6dd9bb5f5a43d" => :mojave sha256 "b25ddae0d8fe9ef0abccaad018af462e9ad4946c116be416e942656156fa7900" => :high_sierra sha256 "a22ad4653da78716cda18cf7534a5b22050d367b97ba87276169c4bc2f27f21e" => :sierra end depends_on "gobject-introspection" => :build depends_on "pkg-config" => :build depends_on "apache-arrow" depends_on "glib" def install cd "c_glib" do system "./configure", "--prefix=#{prefix}" system "make" system "make", "install" end end test do (testpath/"test.c").write <<~SOURCE #include int main(void) { GArrowNullArray *array = garrow_null_array_new(10); g_object_unref(array); return 0; } SOURCE apache_arrow = Formula["apache-arrow"] glib = Formula["glib"] flags = %W[ -I#{include} -I#{apache_arrow.opt_include} -I#{glib.opt_include}/glib-2.0 -I#{glib.opt_lib}/glib-2.0/include -L#{lib} -L#{apache_arrow.opt_lib} -L#{glib.opt_lib} -DNDEBUG -larrow-glib -larrow -lglib-2.0 -lgobject-2.0 -lgio-2.0 ] system ENV.cc, "test.c", "-o", "test", *flags system "./test" end end