homebrew-core/Formula/gd.rb
2016-07-10 17:54:42 +01:00

104 lines
2.8 KiB
Ruby

class Gd < Formula
desc "Graphics library to dynamically manipulate images"
homepage "https://libgd.github.io/"
stable do
url "https://github.com/libgd/libgd/releases/download/gd-2.2.2/libgd-2.2.2.tar.xz"
sha256 "489f756ce07f0c034b1a794f4d34fdb4d829256112cb3c36feb40bb56b79218c"
# OS X linker restricts the revision field to 8 bits: libgd/libgd#214.
# Same as https://github.com/libgd/libgd/commit/502e4cd8, but recommended by
# upstream for patching the release tarball; already fixed in HEAD.
patch do
url "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/gd/files/gd-2.2.2-osx-libtool.patch?id=ede657b970d1deee8305dbefaf5651c37aea115c"
sha256 "8af30e9f8da6ca7ed28ee766e87b66d8ccf034745851760fb4fc8e9bc4907f14"
end
end
revision 1
bottle do
cellar :any
sha256 "31c6b0fb47c2b642ec724fe9b68166dca2f3f5c6bfd35741b8bfcb7f1bbbc854" => :el_capitan
sha256 "5594b49a62e3937ee5296c22f79ee172bf1751f465371ba8e110fa8eafe46d8e" => :yosemite
sha256 "90bd0d811da0e6be475c22fc656075e7d2c9e9ab012f2561debb50418edd7c31" => :mavericks
end
head do
url "https://github.com/libgd/libgd.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
option :universal
depends_on "fontconfig" => :recommended
depends_on "freetype" => :recommended
depends_on "jpeg" => :recommended
depends_on "libpng" => :recommended
depends_on "libtiff" => :recommended
depends_on "webp" => :recommended
fails_with :llvm do
build 2326
cause "Undefined symbols when linking"
end
def install
ENV.universal_binary if build.universal?
args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
--without-x
--without-xpm
]
if build.with? "libpng"
args << "--with-png=#{Formula["libpng"].opt_prefix}"
else
args << "--without-png"
end
if build.with? "fontconfig"
args << "--with-fontconfig=#{Formula["fontconfig"].opt_prefix}"
else
args << "--without-fontconfig"
end
if build.with? "freetype"
args << "--with-freetype=#{Formula["freetype"].opt_prefix}"
else
args << "--without-freetype"
end
if build.with? "jpeg"
args << "--with-jpeg=#{Formula["jpeg"].opt_prefix}"
else
args << "--without-jpeg"
end
if build.with? "libtiff"
args << "--with-tiff=#{Formula["libtiff"].opt_prefix}"
else
args << "--without-tiff"
end
if build.with? "webp"
args << "--with-webp=#{Formula["webp"].opt_prefix}"
else
args << "--without-webp"
end
system "./bootstrap.sh" if build.head?
system "./configure", *args
system "make", "install"
end
test do
system "#{bin}/pngtogd", test_fixtures("test.png"), "gd_test.gd"
system "#{bin}/gdtopng", "gd_test.gd", "gd_test.png"
end
end