class GnomeAutoar < Formula desc "GNOME library for archive handling" homepage "https://github.com/GNOME/gnome-autoar" url "https://download.gnome.org/sources/gnome-autoar/0.2/gnome-autoar-0.2.4.tar.xz" sha256 "0a34c377f8841abbf4c29bc848b301fbd8e4e20c03d7318c777c58432033657a" bottle do cellar :any sha256 "e98e396441864f69d9866921363bbff8fe3a0e6e7048e9fcebfa98d0f8e3100c" => :catalina sha256 "8f87552420faa2d64fee8cf655a15c58eb988bba92284b00e4fcb3cf2f10ce82" => :mojave sha256 "bc17062bdb3f3b299c5122ffd887ff872d22f9d3021faed94db07da9687d096c" => :high_sierra end depends_on "pkg-config" => :build depends_on "gtk+3" depends_on "libarchive" def install system "./configure", "--disable-debug", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}", "--disable-glibtest", "--disable-schemas-compile" system "make", "install" end def post_install system "#{Formula["glib"].opt_bin}/glib-compile-schemas", "#{HOMEBREW_PREFIX}/share/glib-2.0/schemas" end test do (testpath/"test.c").write <<~EOS #include int main(int argc, char *argv[]) { GType type = autoar_extractor_get_type(); return 0; } EOS gettext = Formula["gettext"] glib = Formula["glib"] libarchive = Formula["libarchive"] pcre = Formula["pcre"] flags = (ENV.cflags || "").split + (ENV.cppflags || "").split + (ENV.ldflags || "").split flags += %W[ -I#{gettext.opt_include} -I#{glib.opt_include}/glib-2.0 -I#{glib.opt_lib}/glib-2.0/include -I#{include}/gnome-autoar-0 -I#{libarchive.opt_include} -I#{pcre.opt_include} -D_REENTRANT -L#{gettext.opt_lib} -L#{glib.opt_lib} -L#{libarchive.opt_lib} -L#{lib} -larchive -lgio-2.0 -lglib-2.0 -lgnome-autoar-0 -lgobject-2.0 -lintl ] system ENV.cc, "test.c", "-o", "test", *flags system "./test" end end