130 lines
4.8 KiB
Ruby
130 lines
4.8 KiB
Ruby
class Imagemagick < Formula
|
|
desc "Tools and libraries to manipulate images in many formats"
|
|
homepage "https://www.imagemagick.org/"
|
|
# Please always keep the Homebrew mirror as the primary URL as the
|
|
# ImageMagick site removes tarballs regularly which means we get issues
|
|
# unnecessarily and older versions of the formula are broken.
|
|
url "https://dl.bintray.com/homebrew/mirror/ImageMagick-6.9.4-0.tar.xz"
|
|
mirror "https://www.imagemagick.org/download/ImageMagick-6.9.4-0.tar.xz"
|
|
sha256 "7d2a20ac185f9ac9b6f5a7fbb6320bd04ce04ffd63e06ae608625592aa444306"
|
|
|
|
head "http://git.imagemagick.org/repos/ImageMagick.git"
|
|
|
|
bottle do
|
|
sha256 "285fc68ae0d983a09f836874eb5a4274febcb42545338fa6fa7c2ed67267641d" => :el_capitan
|
|
sha256 "86b5b9a59a12fe3b2f612c3e9269bc7f2d3ef39a7ccfbb83bc33d05589097d7e" => :yosemite
|
|
sha256 "cb401b06bf7c12e4db0989c889671e0f55ff982a5b8c0c2b8f75a70fd5eb68ed" => :mavericks
|
|
end
|
|
|
|
deprecated_option "enable-hdri" => "with-hdri"
|
|
|
|
option "with-fftw", "Compile with FFTW support"
|
|
option "with-hdri", "Compile with HDRI support"
|
|
option "with-jp2", "Compile with Jpeg2000 support"
|
|
option "with-openmp", "Compile with OpenMP support"
|
|
option "with-perl", "enable build/install of PerlMagick"
|
|
option "with-quantum-depth-8", "Compile with a quantum depth of 8 bit"
|
|
option "with-quantum-depth-16", "Compile with a quantum depth of 16 bit"
|
|
option "with-quantum-depth-32", "Compile with a quantum depth of 32 bit"
|
|
option "without-opencl", "Disable OpenCL"
|
|
option "without-magick-plus-plus", "disable build/install of Magick++"
|
|
|
|
depends_on "xz"
|
|
depends_on "libtool" => :run
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "jpeg" => :recommended
|
|
depends_on "libpng" => :recommended
|
|
depends_on "libtiff" => :recommended
|
|
depends_on "freetype" => :recommended
|
|
|
|
depends_on :x11 => :optional
|
|
depends_on "fontconfig" => :optional
|
|
depends_on "little-cms" => :optional
|
|
depends_on "little-cms2" => :optional
|
|
depends_on "libwmf" => :optional
|
|
depends_on "librsvg" => :optional
|
|
depends_on "liblqr" => :optional
|
|
depends_on "openexr" => :optional
|
|
depends_on "ghostscript" => :optional
|
|
depends_on "webp" => :optional
|
|
depends_on "homebrew/versions/openjpeg21" if build.with? "jp2"
|
|
depends_on "fftw" => :optional
|
|
depends_on "pango" => :optional
|
|
|
|
needs :openmp if build.with? "openmp"
|
|
|
|
skip_clean :la
|
|
|
|
# Disables vulnerable coders: https://medium.com/@rhuber/imagemagick-is-on-fire-cve-2016-3714-379faf762247#.2tjfb3iks
|
|
# Next release will probably have a patch for the coders themselves,
|
|
# allowing us to remove this workaround.
|
|
patch do
|
|
url "https://raw.githubusercontent.com/Homebrew/patches/2e4d1d1c2b13cca6292ab534b8a68cb2ac334c6c/imagemagick/disable-coders.diff"
|
|
sha256 "8824d64bd62b75c2cff4c54bc0afc874f3e1b1a11b8916daadafe799600b6f6a"
|
|
end
|
|
|
|
def install
|
|
args = %W[
|
|
--disable-osx-universal-binary
|
|
--prefix=#{prefix}
|
|
--disable-dependency-tracking
|
|
--disable-silent-rules
|
|
--enable-shared
|
|
--disable-static
|
|
--with-modules
|
|
]
|
|
|
|
if build.with? "openmp"
|
|
args << "--enable-openmp"
|
|
else
|
|
args << "--disable-openmp"
|
|
end
|
|
args << "--disable-opencl" if build.without? "opencl"
|
|
args << "--without-gslib" if build.without? "ghostscript"
|
|
args << "--with-perl" << "--with-perl-options='PREFIX=#{prefix}'" if build.with? "perl"
|
|
args << "--with-gs-font-dir=#{HOMEBREW_PREFIX}/share/ghostscript/fonts" if build.without? "ghostscript"
|
|
args << "--without-magick-plus-plus" if build.without? "magick-plus-plus"
|
|
args << "--enable-hdri=yes" if build.with? "hdri"
|
|
args << "--enable-fftw=yes" if build.with? "fftw"
|
|
args << "--without-pango" if build.without? "pango"
|
|
|
|
if build.with? "quantum-depth-32"
|
|
quantum_depth = 32
|
|
elsif build.with?("quantum-depth-16") || build.with?("perl")
|
|
quantum_depth = 16
|
|
elsif build.with? "quantum-depth-8"
|
|
quantum_depth = 8
|
|
end
|
|
|
|
if build.with? "jp2"
|
|
args << "--with-openjp2"
|
|
else
|
|
args << "--without-openjp2"
|
|
end
|
|
|
|
args << "--with-quantum-depth=#{quantum_depth}" if quantum_depth
|
|
args << "--with-rsvg" if build.with? "librsvg"
|
|
args << "--without-x" if build.without? "x11"
|
|
args << "--with-fontconfig=yes" if build.with? "fontconfig"
|
|
args << "--with-freetype=yes" if build.with? "freetype"
|
|
args << "--with-webp=yes" if build.with? "webp"
|
|
|
|
# versioned stuff in main tree is pointless for us
|
|
inreplace "configure", "${PACKAGE_NAME}-${PACKAGE_VERSION}", "${PACKAGE_NAME}"
|
|
system "./configure", *args
|
|
system "make", "install"
|
|
end
|
|
|
|
def caveats
|
|
s = <<-EOS.undent
|
|
For full Perl support you may need to adjust your PERL5LIB variable:
|
|
export PERL5LIB="#{HOMEBREW_PREFIX}/lib/perl5/site_perl":$PERL5LIB
|
|
EOS
|
|
s if build.with? "perl"
|
|
end
|
|
|
|
test do
|
|
system "#{bin}/identify", test_fixtures("test.png")
|
|
end
|
|
end
|