Skip to content

Instantly share code, notes, and snippets.

@rochoa
Last active August 29, 2015 13:58
Show Gist options
  • Save rochoa/10006522 to your computer and use it in GitHub Desktop.
Save rochoa/10006522 to your computer and use it in GitHub Desktop.
Homebrew Formula for ImageMagick 6.6.9-10
diff --git a/coders/png.c b/coders/png.c
index fd185e3..1319fec 100644
--- a/coders/png.c
+++ b/coders/png.c
@@ -612,48 +612,48 @@ static SemaphoreInfo
portable, we use ASCII numbers like this, not characters.
*/
-static png_byte FARDATA mng_MHDR[5]={ 77, 72, 68, 82, (png_byte) '\0'};
-static png_byte FARDATA mng_BACK[5]={ 66, 65, 67, 75, (png_byte) '\0'};
-static png_byte FARDATA mng_BASI[5]={ 66, 65, 83, 73, (png_byte) '\0'};
-static png_byte FARDATA mng_CLIP[5]={ 67, 76, 73, 80, (png_byte) '\0'};
-static png_byte FARDATA mng_CLON[5]={ 67, 76, 79, 78, (png_byte) '\0'};
-static png_byte FARDATA mng_DEFI[5]={ 68, 69, 70, 73, (png_byte) '\0'};
-static png_byte FARDATA mng_DHDR[5]={ 68, 72, 68, 82, (png_byte) '\0'};
-static png_byte FARDATA mng_DISC[5]={ 68, 73, 83, 67, (png_byte) '\0'};
-static png_byte FARDATA mng_ENDL[5]={ 69, 78, 68, 76, (png_byte) '\0'};
-static png_byte FARDATA mng_FRAM[5]={ 70, 82, 65, 77, (png_byte) '\0'};
-static png_byte FARDATA mng_IEND[5]={ 73, 69, 78, 68, (png_byte) '\0'};
-static png_byte FARDATA mng_IHDR[5]={ 73, 72, 68, 82, (png_byte) '\0'};
-static png_byte FARDATA mng_JHDR[5]={ 74, 72, 68, 82, (png_byte) '\0'};
-static png_byte FARDATA mng_LOOP[5]={ 76, 79, 79, 80, (png_byte) '\0'};
-static png_byte FARDATA mng_MAGN[5]={ 77, 65, 71, 78, (png_byte) '\0'};
-static png_byte FARDATA mng_MEND[5]={ 77, 69, 78, 68, (png_byte) '\0'};
-static png_byte FARDATA mng_MOVE[5]={ 77, 79, 86, 69, (png_byte) '\0'};
-static png_byte FARDATA mng_PAST[5]={ 80, 65, 83, 84, (png_byte) '\0'};
-static png_byte FARDATA mng_PLTE[5]={ 80, 76, 84, 69, (png_byte) '\0'};
-static png_byte FARDATA mng_SAVE[5]={ 83, 65, 86, 69, (png_byte) '\0'};
-static png_byte FARDATA mng_SEEK[5]={ 83, 69, 69, 75, (png_byte) '\0'};
-static png_byte FARDATA mng_SHOW[5]={ 83, 72, 79, 87, (png_byte) '\0'};
-static png_byte FARDATA mng_TERM[5]={ 84, 69, 82, 77, (png_byte) '\0'};
-static png_byte FARDATA mng_bKGD[5]={ 98, 75, 71, 68, (png_byte) '\0'};
-static png_byte FARDATA mng_cHRM[5]={ 99, 72, 82, 77, (png_byte) '\0'};
-static png_byte FARDATA mng_gAMA[5]={103, 65, 77, 65, (png_byte) '\0'};
-static png_byte FARDATA mng_iCCP[5]={105, 67, 67, 80, (png_byte) '\0'};
-static png_byte FARDATA mng_nEED[5]={110, 69, 69, 68, (png_byte) '\0'};
-static png_byte FARDATA mng_pHYg[5]={112, 72, 89, 103, (png_byte) '\0'};
-static png_byte FARDATA mng_vpAg[5]={118, 112, 65, 103, (png_byte) '\0'};
-static png_byte FARDATA mng_pHYs[5]={112, 72, 89, 115, (png_byte) '\0'};
-static png_byte FARDATA mng_sBIT[5]={115, 66, 73, 84, (png_byte) '\0'};
-static png_byte FARDATA mng_sRGB[5]={115, 82, 71, 66, (png_byte) '\0'};
-static png_byte FARDATA mng_tRNS[5]={116, 82, 78, 83, (png_byte) '\0'};
+static png_byte mng_MHDR[5]={ 77, 72, 68, 82, (png_byte) '\0'};
+static png_byte mng_BACK[5]={ 66, 65, 67, 75, (png_byte) '\0'};
+static png_byte mng_BASI[5]={ 66, 65, 83, 73, (png_byte) '\0'};
+static png_byte mng_CLIP[5]={ 67, 76, 73, 80, (png_byte) '\0'};
+static png_byte mng_CLON[5]={ 67, 76, 79, 78, (png_byte) '\0'};
+static png_byte mng_DEFI[5]={ 68, 69, 70, 73, (png_byte) '\0'};
+static png_byte mng_DHDR[5]={ 68, 72, 68, 82, (png_byte) '\0'};
+static png_byte mng_DISC[5]={ 68, 73, 83, 67, (png_byte) '\0'};
+static png_byte mng_ENDL[5]={ 69, 78, 68, 76, (png_byte) '\0'};
+static png_byte mng_FRAM[5]={ 70, 82, 65, 77, (png_byte) '\0'};
+static png_byte mng_IEND[5]={ 73, 69, 78, 68, (png_byte) '\0'};
+static png_byte mng_IHDR[5]={ 73, 72, 68, 82, (png_byte) '\0'};
+static png_byte mng_JHDR[5]={ 74, 72, 68, 82, (png_byte) '\0'};
+static png_byte mng_LOOP[5]={ 76, 79, 79, 80, (png_byte) '\0'};
+static png_byte mng_MAGN[5]={ 77, 65, 71, 78, (png_byte) '\0'};
+static png_byte mng_MEND[5]={ 77, 69, 78, 68, (png_byte) '\0'};
+static png_byte mng_MOVE[5]={ 77, 79, 86, 69, (png_byte) '\0'};
+static png_byte mng_PAST[5]={ 80, 65, 83, 84, (png_byte) '\0'};
+static png_byte mng_PLTE[5]={ 80, 76, 84, 69, (png_byte) '\0'};
+static png_byte mng_SAVE[5]={ 83, 65, 86, 69, (png_byte) '\0'};
+static png_byte mng_SEEK[5]={ 83, 69, 69, 75, (png_byte) '\0'};
+static png_byte mng_SHOW[5]={ 83, 72, 79, 87, (png_byte) '\0'};
+static png_byte mng_TERM[5]={ 84, 69, 82, 77, (png_byte) '\0'};
+static png_byte mng_bKGD[5]={ 98, 75, 71, 68, (png_byte) '\0'};
+static png_byte mng_cHRM[5]={ 99, 72, 82, 77, (png_byte) '\0'};
+static png_byte mng_gAMA[5]={103, 65, 77, 65, (png_byte) '\0'};
+static png_byte mng_iCCP[5]={105, 67, 67, 80, (png_byte) '\0'};
+static png_byte mng_nEED[5]={110, 69, 69, 68, (png_byte) '\0'};
+static png_byte mng_pHYg[5]={112, 72, 89, 103, (png_byte) '\0'};
+static png_byte mng_vpAg[5]={118, 112, 65, 103, (png_byte) '\0'};
+static png_byte mng_pHYs[5]={112, 72, 89, 115, (png_byte) '\0'};
+static png_byte mng_sBIT[5]={115, 66, 73, 84, (png_byte) '\0'};
+static png_byte mng_sRGB[5]={115, 82, 71, 66, (png_byte) '\0'};
+static png_byte mng_tRNS[5]={116, 82, 78, 83, (png_byte) '\0'};
#if defined(JNG_SUPPORTED)
-static png_byte FARDATA mng_IDAT[5]={ 73, 68, 65, 84, (png_byte) '\0'};
-static png_byte FARDATA mng_JDAT[5]={ 74, 68, 65, 84, (png_byte) '\0'};
-static png_byte FARDATA mng_JDAA[5]={ 74, 68, 65, 65, (png_byte) '\0'};
-static png_byte FARDATA mng_JdAA[5]={ 74, 100, 65, 65, (png_byte) '\0'};
-static png_byte FARDATA mng_JSEP[5]={ 74, 83, 69, 80, (png_byte) '\0'};
-static png_byte FARDATA mng_oFFs[5]={111, 70, 70, 115, (png_byte) '\0'};
+static png_byte mng_IDAT[5]={ 73, 68, 65, 84, (png_byte) '\0'};
+static png_byte mng_JDAT[5]={ 74, 68, 65, 84, (png_byte) '\0'};
+static png_byte mng_JDAA[5]={ 74, 68, 65, 65, (png_byte) '\0'};
+static png_byte mng_JdAA[5]={ 74, 100, 65, 65, (png_byte) '\0'};
+static png_byte mng_JSEP[5]={ 74, 83, 69, 80, (png_byte) '\0'};
+static png_byte mng_oFFs[5]={111, 70, 70, 115, (png_byte) '\0'};
#endif
/*

Homebrew Formula patching old ImageMagick release 6.6.9-10

Install

$ brew install https://gist.githubusercontent.com/rochoa/10006522/raw/9e3ffb85bbc897ec7608b710ce58196d0ee86d43/imagemagick.rb

Tested

Mac OS X 10.9.2

$ cc --version
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix
require 'formula'
class Imagemagick < Formula
homepage 'http://www.imagemagick.org'
url 'http://www.imagemagick.org/download/legacy/ImageMagick-6.6.9-10.tar.bz2'
sha1 'e4105e82efb6eb907056c134ff47726668bbdd39'
patch do
url "https://gist.githubusercontent.com/rochoa/10006522/raw/35ae67af2e1c4db9e479d7998cdeeaac381a7aa3/coders_png.c.patch"
sha1 "fc5d24011d42af516d0498a24b29ca256d2eecd6"
end
head 'https://www.imagemagick.org/subversion/ImageMagick/trunk',
:using => UnsafeSubversionDownloadStrategy
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 'with-perl', 'enable build/install of PerlMagick'
option 'without-magick-plus-plus', 'disable build/install of Magick++'
depends_on :libtool => :run
depends_on 'pkg-config' => :build
depends_on 'jpeg' => :recommended
depends_on 'libpng' => :recommended
depends_on 'freetype' => :recommended
depends_on :x11 => :optional
depends_on 'fontconfig' => :optional
depends_on 'libtiff' => :optional
depends_on 'little-cms' => :optional
depends_on 'little-cms2' => :optional
depends_on 'jasper' => :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
opoo '--with-ghostscript is not recommended' if build.with? 'ghostscript'
skip_clean :la
def install
args = [ "--disable-osx-universal-binary",
"--prefix=#{prefix}",
"--disable-dependency-tracking",
"--enable-shared",
"--disable-static",
"--without-pango",
"--with-modules",
"--disable-openmp"]
args << "--disable-opencl" if build.include? 'disable-opencl'
args << "--without-gslib" if build.without? 'ghostscript'
args << "--without-perl" if build.without? '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.include? 'enable-hdri'
if build.with? 'quantum-depth-32'
quantum_depth = 32
elsif build.with? 'quantum-depth-16'
quantum_depth = 16
elsif build.with? 'quantum-depth-8'
quantum_depth = 8
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.include? '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 must install the Image::Magick module from the CPAN.
https://metacpan.org/module/Image::Magick
The version of the Perl module and ImageMagick itself need to be kept in sync.
If you upgrade one, you must upgrade the other.
For this version of ImageMagick you should install
version #{version} of the Image::Magick Perl module.
EOS
s if build.with? 'perl'
end
test do
system "#{bin}/identify", "/usr/share/doc/cups/images/cups.png"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment