class Libosinfo < Formula desc "The Operating System information database" homepage "https://libosinfo.org/" url "https://releases.pagure.org/libosinfo/libosinfo-1.4.0.tar.gz" sha256 "a29e61a82b1a5727b145403914812273dfa033a0c07a15500078726bb3b84165" bottle do sha256 "65f55dfae3d1c883d0368883e16c1a7f68e64ab4a0b4451ec13a57fbc0586bf8" => :mojave sha256 "b75e0154484d4206e833df6757750802d74e85bbab41f68cbe98edc776640029" => :high_sierra sha256 "2f1b47a9f2b6cf3c877a79c14ae6f8f7cf3f85a1fbf7c8226f195ae0a3af02a7" => :sierra end depends_on "gobject-introspection" => :build depends_on "pkg-config" => :build depends_on "check" depends_on "gettext" depends_on "glib" depends_on "libsoup" depends_on "libxml2" def install # avoid wget dependency inreplace "Makefile.in", "wget -q -O", "curl -o" args = %W[ --prefix=#{prefix} --localstatedir=#{var} --mandir=#{man} --sysconfdir=#{etc} --disable-silent-rules --disable-udev --disable-vala --enable-introspection --enable-tests ] system "./configure", *args # Compilation of docs doesn't get done if we jump straight to "make install" system "make" system "make", "install" end test do (testpath/"test.c").write <<~EOS #include int main(int argc, char *argv[]) { OsinfoPlatformList *list = osinfo_platformlist_new(); return 0; } EOS gettext = Formula["gettext"] glib = Formula["glib"] flags = %W[ -I#{gettext.opt_include} -I#{glib.opt_include}/glib-2.0 -I#{glib.opt_lib}/glib-2.0/include -I#{include}/libosinfo-1.0 -L#{gettext.opt_lib} -L#{glib.opt_lib} -L#{lib} -losinfo-1.0 -lglib-2.0 -lgobject-2.0 ] system ENV.cc, "test.c", "-o", "test", *flags system "./test" end end