homebrew-core/Formula/libcaca.rb
Samuel John f6e80bdea2 Python 2.x and 3.x support
New `depends_on :python` Dependency.
New `depends_on :python3` Dependency.

To avoid having multiple formulae with endings -py2 and -py3,
we will handle support for different pythons (2.x vs. 3.x)
in the same formula.
Further brewed vs. external python will be transparently supported.

The formula also gets a new object `python`, which is false if
no Python is available or the user has disabled it. Otherwise
it is defined and provides several support methods:

python.site_packages # the site-packages in the formula's Cellar
python.global_site_packages
python.binary # the full path to the python binary
python.prefix
python.version
python.version.major
python.version.minor
python.xy # => e.g. "python2.7"
python.incdir # includes of python
python.libdir # the python dylib library
python.pkg_config_path # used internally by brew
python.from_osx?
python.framework?
python.universal?
python.pypy?
python.standard_caveats # Text to set PYTHONPATH for python.from_osx?
python.if3then3 # => "" for 2.x and to "3" for 3.x.

Further, to avoid code duplication, `python` takes an optional
block that is run twice if the formula defines depends_on
:python AND :python3.

python do
  system python, 'setup.py', "--prefix=#{prefix}"
end

Read more in the Homebrew wiki.
2013-06-03 17:29:43 +02:00

65 lines
2.1 KiB
Ruby

require 'formula'
class Libcaca < Formula
homepage 'http://caca.zoy.org/wiki/libcaca'
url 'http://caca.zoy.org/files/libcaca/libcaca-0.99.beta18.tar.gz'
version '0.99b18'
sha1 '0cbf8075c01d59b53c3cdfec7df9818696a41128'
option 'with-imlib2', 'Build with Imlib2 support'
depends_on :x11 if MacOS::X11.installed? or build.include? "with-imlib2"
depends_on :python => :recommended
if build.include? "with-imlib2"
depends_on 'pkg-config' => :build
depends_on 'imlib2' => :optional
end
fails_with :llvm do
cause "Unsupported inline asm: input constraint with a matching output constraint of incompatible type"
end
# Make libcaca build with clang; see http://caca.zoy.org/ticket/90
def patches; DATA; end
def install
# Some people can't compile when Java is enabled. See:
# https://github.com/mxcl/homebrew/issues/issue/2049
# Don't build csharp bindings
# Don't build ruby bindings; fails for adamv w/ Homebrew Ruby 1.9.2
# Fix --destdir issue.
# ../.auto/py-compile: Missing argument to --destdir.
inreplace 'python/Makefile.in', '$(am__py_compile) --destdir "$(DESTDIR)"', "$(am__py_compile) --destdir \"$(cacadir)\""
system "./configure", "--disable-dependency-tracking",
"--prefix=#{prefix}",
"--disable-doc",
"--disable-slang",
"--disable-java",
"--disable-csharp",
"--disable-ruby"
system "make"
ENV.j1 # Or install can fail making the same folder at the same time
system "make install"
end
def test
system "#{bin}/img2txt", "--version"
end
end
__END__
--- a/caca/caca.h 2011-07-05 00:09:51.000000000 -0700
+++ b/caca/caca.h 2011-07-05 00:10:10.000000000 -0700
@@ -645,7 +645,7 @@ typedef struct cucul_buffer cucul_buffer
# define CACA_DEPRECATED
# endif
-# if defined __GNUC__ && __GNUC__ > 3
+# if !defined __APPLE__ && defined __GNUC__ && __GNUC__ > 3
# define CACA_ALIAS(x) __attribute__ ((weak, alias(#x)))
# else
# define CACA_ALIAS(x)