diff options
| author | Anton Rieder | 2013-03-24 02:05:54 +0100 |
|---|---|---|
| committer | Samuel John | 2013-03-26 22:44:35 +0100 |
| commit | 98d37c2f7136fed5e7cddbfaead0b13e429e701b (patch) | |
| tree | 66afc8f52825149d0a42250ee22699a3fa535979 /Library/Formula/libplist.rb | |
| parent | 8e85e0ab051ab50b23ecfbbd5c03624379182da0 (diff) | |
| download | homebrew-98d37c2f7136fed5e7cddbfaead0b13e429e701b.tar.bz2 | |
libplist: Update to 1.10.0, enable Cython bindings
Closes #18691.
Signed-off-by: Samuel John <github@SamuelJohn.de>
Diffstat (limited to 'Library/Formula/libplist.rb')
| -rw-r--r-- | Library/Formula/libplist.rb | 117 |
1 files changed, 66 insertions, 51 deletions
diff --git a/Library/Formula/libplist.rb b/Library/Formula/libplist.rb index 6608c4f42..ea7ebe7ae 100644 --- a/Library/Formula/libplist.rb +++ b/Library/Formula/libplist.rb @@ -2,65 +2,80 @@ require 'formula' class Libplist < Formula homepage 'http://cgit.sukimashita.com/libplist.git/' - url 'http://cgit.sukimashita.com/libplist.git/snapshot/libplist-1.8.tar.bz2' - sha1 'dea18ac31cc497dba959bdb459a2a49fb41664c3' + url 'http://cgit.sukimashita.com/libplist.git/snapshot/libplist-1.10.tar.bz2' + sha1 'a642bb37eaa4bec428d0b2a4fa8399d80ee73a18' + + head 'http://git.sukimashita.com/libplist.git' + + option 'with-python', 'Enable Cython Python bindings' depends_on 'cmake' => :build - depends_on 'libxml2' - # Fix 3 Clang compile errors. Similar fixes are upstream. Reverify in 1.9 - # 2nd patch disables SWIG and Cython python bindings - def patches - DATA + if build.include? 'with-python' + depends_on 'Cython' => :python + # Needed to find the Cython executable + env :userpaths end def install ENV.deparallelize # make fails on an 8-core Mac Pro - system "cmake", ".", "-DCMAKE_INSTALL_NAME_DIR=#{lib}", *std_cmake_args - system "make install" - # Remove 'plutil', which duplicates the system-provided one. Leave the versioned one, though. - rm (bin+'plutil') + args = std_cmake_args + + # Disable Swig Python bindings + args << "-DENABLE_SWIG='OFF'" + + if build.include? 'with-python' + ## Taken from opencv.rb + # + # The CMake `FindPythonLibs` Module is dumber than a bag of hammers when + # more than one python installation is available---for example, it clings + # to the Header folder of the system Python Framework like a drowning + # sailor. + # + # This code was cribbed from the VTK formula and uses the output to + # `python-config` to do the job FindPythonLibs should be doing in the first + # place. + python_prefix = `python-config --prefix`.strip + # Python is actually a library. The libpythonX.Y.dylib points to this lib, too. + if File.exist? "#{python_prefix}/Python" + # Python was compiled with --framework: + args << "-DPYTHON_LIBRARY='#{python_prefix}/Python'" + if !MacOS::CLT.installed? and python_prefix.start_with? '/System/Library' + # For Xcode-only systems, the headers of system's python are inside of Xcode + args << "-DPYTHON_INCLUDE_DIR='#{MacOS.sdk_path}/System/Library/Frameworks/Python.framework/Versions/2.7/Headers'" + else + args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/Headers'" + end + else + python_lib = "#{python_prefix}/lib/lib#{which_python}" + if File.exists? "#{python_lib}.a" + args << "-DPYTHON_LIBRARY='#{python_lib}.a'" + else + args << "-DPYTHON_LIBRARY='#{python_lib}.dylib'" + end + args << "-DPYTHON_INCLUDE_DIR='#{python_prefix}/include/#{which_python}'" + end + else + # Also disable Cython Python bindings if we're not building with '--python' + args << "-DENABLE_CYTHON='OFF'" + end + + system "cmake", ".", "-DCMAKE_INSTALL_NAME_DIR=#{lib}", *args + system "make install" end -end -__END__ ---- a/libcnary/node.c 2011-06-24 18:00:48.000000000 -0700 -+++ b/libcnary/node.c 2012-01-26 13:59:51.000000000 -0800 -@@ -104,7 +104,7 @@ - - int node_insert(node_t* parent, unsigned int index, node_t* child) - { -- if (!parent || !child) return; -+ if (!parent || !child) return 0; - child->isLeaf = TRUE; - child->isRoot = FALSE; - child->parent = parent; ---- a/src/base64.c 2011-06-24 18:00:48.000000000 -0700 -+++ b/src/base64.c 2012-01-26 14:01:21.000000000 -0800 -@@ -104,9 +104,9 @@ - - unsigned char *base64decode(const char *buf, size_t *size) - { -- if (!buf) return; -+ if (!buf) return NULL; - size_t len = strlen(buf); -- if (len <= 0) return; -+ if (len <= 0) return NULL; - unsigned char *outbuf = (unsigned char*)malloc((len/4)*3+3); - - unsigned char *line; + def caveats + if build.include? 'with-python' + <<-EOS.undent + To use the Python bindings with non-homebrew Python, you need to amend your + PYTHONPATH like so: + export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH + EOS + end + end ---- a/CMakeLists.txt 2012-02-23 17:03:29.000000000 -0800 -+++ b/CMakeLists.txt 2012-02-23 17:03:51.000000000 -0800 -@@ -17,8 +17,8 @@ - - FIND_PACKAGE( LibXml2 REQUIRED ) - --OPTION(ENABLE_SWIG "Enable SWIG Python bindings (needs Swig)" ON) --OPTION(ENABLE_CYTHON "Enable Cython Python bindings (needs Cython)" ON) -+OPTION(ENABLE_SWIG "Enable SWIG Python bindings (needs Swig)" OFF) -+OPTION(ENABLE_CYTHON "Enable Cython Python bindings (needs Cython)" OFF) - - IF(ENABLE_SWIG) - FIND_PACKAGE( SWIG ) + def which_python + "python" + `python -c 'import sys;print(sys.version[:3])'`.strip + end +end |
