class Libgweather < Formula desc "GNOME library for weather, locations and timezones" homepage "https://wiki.gnome.org/Projects/LibGWeather" url "https://download.gnome.org/sources/libgweather/3.28/libgweather-3.28.2.tar.xz" sha256 "081ce81653afc614e12641c97a8dd9577c524528c63772407ae2dbcde12bde75" bottle do sha256 "c05c1a3b582b0910587d135d29c8ebfb731ba11cca9ec99e05b1ecc8f0f0e9e3" => :mojave sha256 "2eb44ffb03a8d0ef04e3f60249136acb7ae5d6581b7eb2b3354f4e33dfae9b92" => :high_sierra sha256 "9fc3c60b4f111e74e9d508ca95f85f16c347880cc3dd689a9b73ac772f316992" => :sierra sha256 "d47872fbe5c9325b3a40cc922c75728651665b25585c9bf9610d98bd6e60ac0a" => :el_capitan end depends_on "gobject-introspection" => :build depends_on "meson-internal" => :build depends_on "ninja" => :build depends_on "pkg-config" => :build depends_on "python" => :build depends_on "geocode-glib" depends_on "gtk+3" depends_on "libsoup" depends_on "vala" => :optional def install ENV.refurbish_args ENV["DESTDIR"] = "" inreplace "meson/meson_post_install.py", "if not os.environ.get('DESTDIR'):", "if 'DESTDIR' not in os.environ:" mkdir "build" do system "meson", "--prefix=#{prefix}", ".." system "ninja" system "ninja", "install" end 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 = gweather_info_get_type(); return 0; } EOS ENV.libxml2 atk = Formula["atk"] cairo = Formula["cairo"] fontconfig = Formula["fontconfig"] freetype = Formula["freetype"] gdk_pixbuf = Formula["gdk-pixbuf"] gettext = Formula["gettext"] glib = Formula["glib"] gtkx3 = Formula["gtk+3"] libepoxy = Formula["libepoxy"] libpng = Formula["libpng"] libsoup = Formula["libsoup"] pango = Formula["pango"] pixman = Formula["pixman"] flags = %W[ -I#{atk.opt_include}/atk-1.0 -I#{cairo.opt_include}/cairo -I#{fontconfig.opt_include} -I#{freetype.opt_include}/freetype2 -I#{gdk_pixbuf.opt_include}/gdk-pixbuf-2.0 -I#{gettext.opt_include} -I#{glib.opt_include}/gio-unix-2.0/ -I#{glib.opt_include}/glib-2.0 -I#{glib.opt_lib}/glib-2.0/include -I#{gtkx3.opt_include}/gtk-3.0 -I#{include}/libgweather-3.0 -I#{libepoxy.opt_include} -I#{libpng.opt_include}/libpng16 -I#{libsoup.opt_include}/libsoup-2.4 -I#{pango.opt_include}/pango-1.0 -I#{pixman.opt_include}/pixman-1 -D_REENTRANT -L#{atk.opt_lib} -L#{cairo.opt_lib} -L#{gdk_pixbuf.opt_lib} -L#{gettext.opt_lib} -L#{glib.opt_lib} -L#{gtkx3.opt_lib} -L#{lib} -L#{pango.opt_lib} -latk-1.0 -lcairo -lcairo-gobject -lgdk-3 -lgdk_pixbuf-2.0 -lgio-2.0 -lglib-2.0 -lgobject-2.0 -lgtk-3 -lgweather-3 -lintl -lpango-1.0 -lpangocairo-1.0 ] system ENV.cc, "-DGWEATHER_I_KNOW_THIS_IS_UNSTABLE=1", "test.c", "-o", "test", *flags system "./test" end end