homebrew-core/Formula/gd.rb

94 lines
2.4 KiB
Ruby

class Gd < Formula
desc "Graphics library to dynamically manipulate images"
homepage "https://libgd.github.io/"
url "https://github.com/libgd/libgd/releases/download/gd-2.2.3/libgd-2.2.3.tar.xz"
sha256 "746b6cbd6769a22ff3ba6f5756f3512a769bd4cdf4695dff17f4867f25fa7d3c"
revision 1
bottle do
cellar :any
sha256 "597c7c0c430cbcee3aaee8a22074dcdccdd6575886dc746a02dd6b24e6fef09d" => :sierra
sha256 "31dfa0f6b8816983e9837cee2e57a49c5aadff0f8622831c9ce8b62eaa58052b" => :el_capitan
sha256 "1f3ee5e4bdc25d90d76be1b6282039e8e08117b7d195067a3569d8de9b056bde" => :yosemite
sha256 "76800f3d1c37d0db1f78e94fdf0fd6c40542920da2c1efbcb1d6d59c7a47dae3" => :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