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.14.1/apache-arrow-0.14.1.tar.gz" sha256 "9948ddb6d4798b51552d0dca3252dd6e3a7d0f9702714fc6f5a1b59397ce1d28" bottle do sha256 "d6ff545cd34ba76d19e8d5cf4658d8d7487d2f8ee0560c529012b4d5941815d2" => :mojave sha256 "01670458faa03b562e508dd8704e3f138124313b37d4145a486197d2fc9e4f6d" => :high_sierra sha256 "deb1cc235f7ad6d1bce0aac47f5c83710286c1819051a391318f1010cbe7b7d4" => :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