f6e80bdea2
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.
74 lines
2.8 KiB
Ruby
74 lines
2.8 KiB
Ruby
require 'formula'
|
|
|
|
class Portmidi < Formula
|
|
homepage 'http://sourceforge.net/apps/trac/portmedia/wiki/portmidi'
|
|
url 'http://downloads.sourceforge.net/project/portmedia/portmidi/217/portmidi-src-217.zip'
|
|
sha1 'f45bf4e247c0d7617deacd6a65d23d9fddae6117'
|
|
|
|
option 'with-java', 'Build java based app and bindings. You need the Java SDK for this.'
|
|
|
|
depends_on 'cmake' => :build
|
|
depends_on :python => :optional
|
|
depends_on 'Cython' => :python if build.with? 'python'
|
|
|
|
def patches
|
|
# Avoid that the Makefile.osx builds the java app and fails because: fatal error: 'jni.h' file not found
|
|
# Since 217 the Makefile.osx includes pm_common/CMakeLists.txt wich builds the Java app
|
|
DATA unless build.include? 'with-java'
|
|
end
|
|
|
|
def install
|
|
inreplace 'pm_mac/Makefile.osx', 'PF=/usr/local', "PF=#{prefix}"
|
|
|
|
# need to create include/lib directories since make won't create them itself
|
|
include.mkpath
|
|
lib.mkpath
|
|
|
|
# Fix outdated SYSROOT to avoid: No rule to make target `/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/CoreAudio.framework', needed by `latency'. Stop.
|
|
inreplace 'pm_common/CMakeLists.txt', 'set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk CACHE', "set(CMAKE_OSX_SYSROOT /#{MacOS.sdk_path} CACHE"
|
|
|
|
system 'make -f pm_mac/Makefile.osx'
|
|
system 'make -f pm_mac/Makefile.osx install'
|
|
|
|
python do
|
|
cd 'pm_python' do
|
|
# There is no longer a CHANGES.txt or TODO.txt.
|
|
inreplace 'setup.py', "CHANGES = open('CHANGES.txt').read()", 'CHANGES = ""'
|
|
inreplace 'setup.py', "TODO = open('TODO.txt').read()", 'TODO = ""'
|
|
# Provide correct dirs (that point into the Cellar)
|
|
ENV.append 'CFLAGS', "-I#{include}"
|
|
ENV.append 'LDFLAGS', "-L#{lib}"
|
|
system python, "setup.py", "install", "--prefix=#{prefix}"
|
|
end
|
|
end
|
|
end
|
|
|
|
def test
|
|
if build.with?('python') || Tab.for_formula('portmidi').with?('python')
|
|
system "python", "-c", "import pyportmidi; pyportmidi.init()"
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
__END__
|
|
diff --git a/pm_common/CMakeLists.txt b/pm_common/CMakeLists.txt
|
|
index e171047..b010c35 100644
|
|
--- a/pm_common/CMakeLists.txt
|
|
+++ b/pm_common/CMakeLists.txt
|
|
@@ -112,14 +112,9 @@ target_link_libraries(portmidi-static ${PM_NEEDED_LIBS})
|
|
# define the jni library
|
|
include_directories(${JAVA_INCLUDE_PATHS})
|
|
|
|
-set(JNISRC ${LIBSRC} ../pm_java/pmjni/pmjni.c)
|
|
-add_library(pmjni SHARED ${JNISRC})
|
|
-target_link_libraries(pmjni ${JNI_EXTRA_LIBS})
|
|
-set_target_properties(pmjni PROPERTIES EXECUTABLE_EXTENSION "jnilib")
|
|
-
|
|
# install the libraries (Linux and Mac OS X command line)
|
|
if(UNIX)
|
|
- INSTALL(TARGETS portmidi-static pmjni
|
|
+ INSTALL(TARGETS portmidi-static
|
|
LIBRARY DESTINATION /usr/local/lib
|
|
ARCHIVE DESTINATION /usr/local/lib)
|
|
# .h files installed by pm_dylib/CMakeLists.txt, so don't need them here
|