2011-06-16 20:21:46 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Shiboken < Formula
|
|
|
|
homepage 'http://www.pyside.org/docs/shiboken'
|
2013-01-11 02:18:09 +00:00
|
|
|
url 'http://qt-project.org/uploads/pyside/shiboken-1.1.2.tar.bz2'
|
|
|
|
mirror 'https://distfiles.macports.org/py-shiboken/shiboken-1.1.2.tar.bz2'
|
2012-10-13 18:26:35 +00:00
|
|
|
sha1 '2ffe9d47a3f536840ed9d7eff766a53040bb2a2e'
|
2011-06-16 20:21:46 +00:00
|
|
|
|
|
|
|
depends_on 'cmake' => :build
|
2012-07-12 23:47:43 +00:00
|
|
|
depends_on 'qt'
|
2011-06-16 20:21:46 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
# Building the tests also runs them. Not building and running tests cuts
|
2012-07-10 23:29:10 +00:00
|
|
|
# install time in half. As of 1.1.1 the install fails unless you do an
|
|
|
|
# out of tree build and put the source dir last in the args.
|
|
|
|
mkdir 'macbuild' do
|
|
|
|
args = std_cmake_args + %W[
|
|
|
|
-DBUILD_TESTS=OFF
|
|
|
|
]
|
2012-07-27 05:30:54 +00:00
|
|
|
|
|
|
|
|
|
|
|
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'"
|
2012-12-25 21:35:27 +00:00
|
|
|
if !MacOS::CLT.installed? and python_prefix.start_with? '/System/Library'
|
2012-07-27 05:30:54 +00:00
|
|
|
# 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_version = `python-config --libs`.match('-lpython(\d+\.\d+)').captures.at(0)
|
|
|
|
python_lib = "#{python_prefix}/lib/libpython#{python_version}"
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
args << '..'
|
2012-07-10 23:29:10 +00:00
|
|
|
system 'cmake', *args
|
|
|
|
system "make install"
|
|
|
|
end
|
2011-06-16 20:21:46 +00:00
|
|
|
end
|
2012-07-27 05:30:54 +00:00
|
|
|
|
|
|
|
def which_python
|
|
|
|
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
|
|
|
|
end
|
2011-06-16 20:21:46 +00:00
|
|
|
end
|