Skip to content

Instantly share code, notes, and snippets.

@victusfate
Created November 6, 2013 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save victusfate/7344987 to your computer and use it in GitHub Desktop.
Save victusfate/7344987 to your computer and use it in GitHub Desktop.
require 'formula'
# Use a mirror because of:
# http://lists.cairographics.org/archives/cairo/2012-September/023454.html
class Cairo < Formula
homepage 'http://cairographics.org/'
url 'http://cairographics.org/releases/cairo-1.12.16.tar.xz'
mirror 'https://downloads.sourceforge.net/project/machomebrew/mirror/cairo-1.12.16.tar.xz'
sha256 '2505959eb3f1de3e1841023b61585bfd35684b9733c7b6a3643f4f4cbde6d846'
keg_only :provided_pre_mountain_lion
option :universal
option 'without-x', 'Build without X11 support'
depends_on 'pkg-config' => :build
depends_on 'xz'=> :build
# harfbuzz requires cairo-ft to build
depends_on 'freetype' if build.without? 'x'
depends_on :libpng
depends_on 'pixman'
depends_on 'glib' => :recommended
depends_on :x11 if build.with? 'x'
env :std if build.universal?
def install
ENV.universal_binary if build.universal?
args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
]
if build.without? 'x'
args << '--enable-xlib=no' << '--enable-xlib-xrender=no'
else
args << '--with-x'
end
if build.with? 'glib'
args << '--enable-gobject=yes'
else
args << '--enable-gobject=no'
end
args << "CC=clang"
args << "CXX=clang++"
# args << "CXXFLAGS=-O3 -stdlib=libstdc++"
args << "CXXFLAGS=-O3 -stdlib=libc++"
args << "LIBS=-lc++ -lc++abi"
args << '--enable-xcb=no' if MacOS.version <= :leopard
system "./configure", *args
system "make install"
end
end
require 'formula'
class Cairomm < Formula
homepage 'http://cairographics.org/cairomm/'
url 'http://cairographics.org/releases/cairomm-1.10.0.tar.gz'
sha256 '068d96c43eae7b0a3d98648cbfc6fbd16acc385858e9ba6d37b5a47e4dba398f'
option 'without-x', 'Build without X11 support'
depends_on 'pkg-config' => :build
depends_on 'libsigc++'
depends_on 'cairo' => 'with-glib'
depends_on :x11 unless build.include? 'without-x'
def install
args = %W[
--disable-dependency-tracking
--prefix=#{prefix}
]
args << "CC=clang"
args << "CXX=clang++"
# args << "CXXFLAGS=-O3 -stdlib=libstdc++"
args << "CXXFLAGS=-O3 -stdlib=libc++"
args << "LIBS=-lc++ -lc++abi"
system "./configure", *args
system "make install"
end
end
require 'formula'
class Ffmpeglatest < Formula
homepage 'http://ffmpeg.org/'
url 'http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2'
head 'git://git.videolan.org/ffmpeg.git'
option "without-xvid", "Disable Xvid MPEG-4 video encoder"
option "with-x264", "Enable H.264 encoder"
option "with-opencl", "Enable OpenCL"
option "with-lame", "Enable MP3 encoder"
option "with-rtmpdump", "Enable RTMP protocol"
option "with-libvo-aacenc", "Enable VisualOn AAC encoder"
option "with-libass", "Enable ASS/SSA subtitle format"
option "with-openjpeg", 'Enable JPEG 2000 image format'
option 'with-openssl', 'Enable SSL support'
option 'with-schroedinger', 'Enable Dirac video format'
option 'with-ffplay', 'Enable FFplay media player'
option 'with-tools', 'Enable additional FFmpeg tools'
option 'with-fdk-aac', 'Enable the Fraunhofer FDK AAC library'
depends_on 'pkg-config' => :build
# manpages won't be built without texi2html
depends_on 'texi2html' => :build if MacOS.version >= :mountain_lion
depends_on 'yasm' => :build
depends_on 'x264' => :recommended
depends_on 'faac' => :recommended
depends_on 'lame' => :recommended
depends_on 'xvid' => :recommended
depends_on 'libvorbis' => :recommended
depends_on 'libvpx' => :recommended
depends_on :freetype => :optional
depends_on 'theora' => :optional
depends_on 'rtmpdump' => :optional
depends_on 'opencore-amr' => :optional
depends_on 'libvo-aacenc' => :optional
depends_on 'libass' => :optional
depends_on 'openjpeg' => :optional
depends_on 'sdl' if build.include? 'with-ffplay'
depends_on 'speex' => :optional
depends_on 'schroedinger' => :optional
depends_on 'fdk-aac' => :optional
depends_on 'opus' => :optional
depends_on 'frei0r' => :optional
depends_on 'libcaca' => :optional
def install
args = ["--prefix=#{prefix}",
"--enable-shared",
"--enable-pthreads",
"--enable-gpl",
"--enable-version3",
"--enable-nonfree",
"--enable-hardcoded-tables",
"--enable-avresample",
"--enable-vda",
"--enable-opencl",
"--enable-libx264",
"--enable-libfaac",
"--enable-libmp3lame",
"--enable-openssl",
"--enable-ffplay",
"--enable-libvpx",
"--enable-libvorbis",
"--cc=#{ENV.cc}",
"--host-cflags=#{ENV.cflags}",
"--host-ldflags=#{ENV.ldflags}"
]
args << "--enable-libx264" if build.with? 'x264'
args << "--enable-libfaac" if build.with? 'faac'
args << "--enable-libmp3lame" if build.with? 'lame'
args << "--enable-libxvid" if build.with? 'xvid'
args << "--enable-libfreetype" if build.with? 'freetype'
args << "--enable-libtheora" if build.with? 'theora'
args << "--enable-libvorbis" if build.with? 'libvorbis'
args << "--enable-libvpx" if build.with? 'libvpx'
args << "--enable-librtmp" if build.with? 'rtmpdump'
args << "--enable-libopencore-amrnb" << "--enable-libopencore-amrwb" if build.with? 'opencore-amr'
args << "--enable-libvo-aacenc" if build.with? 'libvo-aacenc'
args << "--enable-libass" if build.with? 'libass'
args << "--enable-ffplay" if build.include? 'with-ffplay'
args << "--enable-libspeex" if build.with? 'speex'
args << '--enable-libschroedinger' if build.with? 'schroedinger'
args << "--enable-libfdk-aac" if build.with? 'fdk-aac'
args << "--enable-openssl" if build.with? 'openssl'
args << "--enable-libopus" if build.with? 'opus'
args << "--enable-frei0r" if build.with? 'frei0r'
args << "--enable-libcaca" if build.with? 'libcaca'
args << "--enable-opencl" if build.with? 'opencl'
if build.with? 'openjpeg'
args << '--enable-libopenjpeg'
args << '--extra-cflags=' + %x[pkg-config --cflags libopenjpeg].chomp
end
# For 32-bit compilation under gcc 4.2, see:
# http://trac.macports.org/ticket/20938#comment:22
ENV.append_to_cflags "-mdynamic-no-pic" if Hardware.is_32_bit? && Hardware.cpu_type == :intel && ENV.compiler == :clang
system "./configure", *args
if MacOS.prefer_64_bit?
inreplace 'config.mak' do |s|
shflags = s.get_make_var 'SHFLAGS'
if shflags.gsub!(' -Wl,-read_only_relocs,suppress', '')
s.change_make_var! 'SHFLAGS', shflags
end
end
end
system "make install"
if build.include? 'with-tools'
system "make alltools"
bin.install Dir['tools/*'].select {|f| File.executable? f}
end
end
end
require 'formula'
class Graphicsmagick < Formula
homepage 'http://www.graphicsmagick.org/'
url 'http://downloads.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.18/GraphicsMagick-1.3.18.tar.bz2'
sha256 '768b89a685d29b0e463ade21bc0649f2727800ebc5a8e13fa6fc17ccb9da769b'
head 'hg://http://graphicsmagick.hg.sourceforge.net:8000/hgroot/graphicsmagick/graphicsmagick'
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-magick-plus-plus', 'disable build/install of Magick++'
option 'without-svg', 'Compile without svg support'
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 'libtiff' => :optional
depends_on 'little-cms' => :optional
depends_on 'little-cms2' => :optional
depends_on 'jasper' => :optional
depends_on 'libwmf' => :optional
depends_on 'ghostscript' => :optional
opoo '--with-ghostscript is not recommended' if build.with? 'ghostscript'
if build.with? 'openmp' and (MacOS.version == :leopard or ENV.compiler == :clang)
opoo '--with-openmp is not supported on Leopard or with Clang'
end
fails_with :llvm do
build 2335
end
skip_clean :la
def ghostscript_fonts?
File.directory? "#{HOMEBREW_PREFIX}/share/ghostscript/fonts"
end
def install
args = [ "--prefix=#{prefix}",
"--disable-dependency-tracking",
"--enable-shared",
"--disable-static",
"--with-modules"]
args << "--disable-openmp" unless build.include? 'enable-openmp'
args << "--without-gslib" unless build.with? 'ghostscript'
args << "--with-gs-font-dir=#{HOMEBREW_PREFIX}/share/ghostscript/fonts" unless build.with? 'ghostscript'
args << "--without-magick-plus-plus" if build.without? 'magick-plus-plus'
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 << "--without-x" unless build.with? 'x11'
args << "--without-ttf" if build.without? 'freetype'
args << "--without-xml" if build.without? 'svg'
args << "--without-lcms" unless build.with? 'little-cms'
args << "--without-lcms2" unless build.with? 'little-cms2'
args << "CC=clang"
args << "CXX=clang++"
# args << "CXXFLAGS=-O3 -stdlib=libstdc++"
args << "CXXFLAGS=-O3 -stdlib=libc++"
args << "LIBS=-lc++ -lc++abi"
# versioned stuff in main tree is pointless for us
inreplace 'configure', '${PACKAGE_NAME}-${PACKAGE_VERSION}', '${PACKAGE_NAME}'
system "./configure", *args
system "make install"
end
test do
system "#{bin}/gm", "identify", "/usr/share/doc/cups/images/cups.png"
end
end
require 'formula'
class Opencv < Formula
homepage 'http://opencv.org/'
url 'http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.6.1/opencv-2.4.6.1.tar.gz'
sha1 'e015bd67218844b38daf3cea8aab505b592a66c0'
option '64-bit'
option 'with-qt', 'Build the Qt4 backend to HighGUI'
option 'with-tbb', 'Enable parallel code in OpenCV using Intel TBB'
# option 'without-opencl', 'Disable gpu code in OpenCV using OpenCL'
option 'with-opencl', 'enable gpu code in OpenCV using OpenCL'
option 'with-ffmpeg', 'enable ffmpeg'
option :cxx11
depends_on 'cmake' => :build
depends_on 'pkg-config' => :build
depends_on 'numpy' => :python
depends_on :python
depends_on 'eigen' => :optional
depends_on 'libtiff' => :optional
depends_on 'jasper' => :optional
depends_on 'tbb' => :optional
depends_on 'qt' => :optional
depends_on :libpng
# Can also depend on ffmpeg, but this pulls in a lot of extra stuff that
# you don't need unless you're doing video analysis, and some of it isn't
# in Homebrew anyway. Will depend on openexr if it's installed.
depends_on 'ffmpeglatest'
def install
ENV.cxx11 if build.cxx11?
args = std_cmake_args + %W[
-DCMAKE_OSX_DEPLOYMENT_TARGET=
-DWITH_CUDA=OFF
-DBUILD_ZLIB=OFF
-DBUILD_TIFF=OFF
-DBUILD_PNG=ON
-DBUILD_JPEG=ON
-DBUILD_JASPER=OFF
-DBUILD_TESTS=OFF
-DBUILD_PERF_TESTS=OFF
-DPYTHON_INCLUDE_DIR='#{python.incdir}'
-DPYTHON_LIBRARY='#{python.libdir}/lib#{python.xy}.dylib'
-DPYTHON_EXECUTABLE='#{python.binary}'
]
if build.build_32_bit?
args << "-DCMAKE_OSX_ARCHITECTURES=i386"
args << "-DOPENCV_EXTRA_C_FLAGS='-arch i386 -m32'"
args << "-DOPENCV_EXTRA_CXX_FLAGS='-arch i386 -m32'"
end
args << '-DWITH_QT=ON' if build.with? 'qt'
args << '-DWITH_TBB=ON' if build.with? 'tbb'
# OpenCL 1.1 is required, but Snow Leopard and older come with 1.0
# args << '-DWITH_OPENCL=OFF' if build.without? 'opencl' or MacOS.version < :lion
# args << '-DWITH_FFMPEG=OFF' unless build.with? 'ffmpeg'
args << "CC=clang"
args << "CXX=clang++"
# args << "CXXFLAGS=-O3 -stdlib=libstdc++"
args << "CXXFLAGS=-O3 -stdlib=libc++"
args << "LIBS=-lc++ -lc++abi"
args << '..'
mkdir 'macbuild' do
system 'cmake', *args
system "make"
system "make install"
end
end
def caveats
python.standard_caveats if python
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment