homebrew-core/Formula/graphicsmagick.rb
2018-11-21 23:52:24 +08:00

80 lines
2.5 KiB
Ruby

class Graphicsmagick < Formula
desc "Image processing tools collection"
homepage "http://www.graphicsmagick.org/"
url "https://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.31/GraphicsMagick-1.3.31.tar.xz"
sha256 "096bbb59d6f3abd32b562fc3b34ea90d88741dc5dd888731d61d17e100394278"
head "http://hg.code.sf.net/p/graphicsmagick/code", :using => :hg
bottle do
sha256 "6a897b2005fd451bcdcfa173d16b7bb79fd272bf873de5309de709166721820b" => :mojave
sha256 "db7ab60e8c022c0dc2a18a7d8dae0f6b1cd083aad1c90b15abf0a64f231e959d" => :high_sierra
sha256 "2a55a11637c14270380f5ea6a614603fdf7f27455569ffe85eab6cbcf5ff0e6e" => :sierra
end
option "with-perl", "Build PerlMagick; provides the Graphics::Magick module"
depends_on "pkg-config" => :build
depends_on "freetype"
depends_on "jasper"
depends_on "jpeg"
depends_on "libpng"
depends_on "libtiff"
depends_on "libtool"
depends_on "ghostscript" => :optional
depends_on "libwmf" => :optional
depends_on "little-cms2" => :optional
depends_on "webp" => :optional
depends_on :x11 => :optional
skip_clean :la
def install
args = %W[
--prefix=#{prefix}
--disable-dependency-tracking
--enable-shared
--disable-static
--with-modules
--without-lzma
--disable-openmp
--with-quantum-depth=16
]
args << "--without-gslib" if build.without? "ghostscript"
args << "--with-gs-font-dir=#{HOMEBREW_PREFIX}/share/ghostscript/fonts" if build.without? "ghostscript"
args << "--with-perl" if build.with? "perl"
args << "--with-webp=no" if build.without? "webp"
args << "--without-x" if build.without? "x11"
args << "--without-lcms2" if build.without? "little-cms2"
args << "--without-wmf" if build.without? "libwmf"
# versioned stuff in main tree is pointless for us
inreplace "configure", "${PACKAGE_NAME}-${PACKAGE_VERSION}", "${PACKAGE_NAME}"
system "./configure", *args
system "make", "install"
if build.with? "perl"
cd "PerlMagick" do
# Install the module under the GraphicsMagick prefix
system "perl", "Makefile.PL", "INSTALL_BASE=#{prefix}"
system "make"
system "make", "install"
end
end
end
def caveats
if build.with? "perl"
<<~EOS
The Graphics::Magick perl module has been installed under:
#{lib}
EOS
end
end
test do
fixture = test_fixtures("test.png")
assert_match "PNG 8x8+0+0", shell_output("#{bin}/gm identify #{fixture}")
end
end