class Libgtop < Formula desc "Library for portably obtaining information about processes" homepage "https://library.gnome.org/devel/libgtop/stable/" url "https://download.gnome.org/sources/libgtop/2.30/libgtop-2.30.0.tar.xz" sha256 "463bcbe5737b1b93f3345ee34abf601e8eb864f507c49ff1921c2737abafc1e5" bottle do sha256 "76b362a4cf84a8a0108e34edf471fe7c621faf008d27397c55a58a852be9c14c" => :yosemite sha256 "fd8b42216d86fb0550e9099a90aaf20648e070a8aab5da8c26b78cf17345de9d" => :mavericks sha256 "21ea0635fb571d1820e63d6a0873b10633db1eb679da0deb21cd974167773974" => :mountain_lion end depends_on "pkg-config" => :build depends_on "intltool" => :build depends_on "gettext" depends_on "glib" def install system "./configure", "--disable-debug", "--disable-dependency-tracking", "--prefix=#{prefix}", "--without-x" system "make", "install" end test do (testpath/"test.c").write <<-EOS.undent #include int main(int argc, char *argv[]) { const glibtop_sysinfo *info = glibtop_get_sysinfo(); return 0; } EOS gettext = Formula["gettext"] glib = Formula["glib"] 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}/libgtop-2.0 -L#{gettext.opt_lib} -L#{glib.opt_lib} -L#{lib} -lglib-2.0 -lgtop-2.0 -lintl ] system ENV.cc, "test.c", "-o", "test", *flags system "./test" end end