class Libpng < Formula desc "Library for manipulating PNG images" homepage "http://www.libpng.org/pub/png/libpng.html" url "ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.27.tar.xz" mirror "https://downloads.sourceforge.net/project/libpng/libpng16/1.6.27/libpng-1.6.27.tar.xz" sha256 "fca2ffd97336356cdab9bfa8936b9d6dfd580a70205e5dfead3ac42cb054b57b" bottle do cellar :any sha256 "fa57be46b1618c1210357bdad465cfc1366e89338671959d2292bdb66727ed5e" => :sierra sha256 "4f26a6a98c66ddc3491b0b316dc410048f44c88537c58268a7ef720383031332" => :el_capitan sha256 "24342c1ff1c90cee57947a0a18204df5b8220ffa9555bd0174cad8049bfe7a6e" => :yosemite end head do url "https://github.com/glennrp/libpng.git" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build end keg_only :provided_pre_mountain_lion option :universal def install ENV.universal_binary if build.universal? system "./configure", "--disable-dependency-tracking", "--disable-silent-rules", "--prefix=#{prefix}" system "make" system "make", "test" system "make", "install" end test do (testpath/"test.c").write <<-EOS.undent #include int main() { png_structp png_ptr; png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); png_destroy_write_struct(&png_ptr, (png_infopp)NULL); return 0; } EOS system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-lpng", "-o", "test" system "./test" end end