Skip to content

Commit

Permalink
portmidi: vendor cython for --with-python
Browse files Browse the repository at this point in the history
Closes Homebrew/legacy-homebrew#50562.

Closes Homebrew#175.

Signed-off-by: Tim D. Smith <[email protected]>
  • Loading branch information
tdsmith committed Apr 10, 2016
1 parent deab4b7 commit 2f176b0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Formula/portmidi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ class Portmidi < Formula

depends_on "cmake" => :build
depends_on :python => :optional
depends_on "Cython" => :python if build.with? "python"

# 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
patch :DATA if build.without? "java"

resource "Cython" do
url "https://pypi.python.org/packages/source/C/Cython/Cython-0.24.tar.gz"
sha256 "6de44d8c482128efc12334641347a9c3e5098d807dd3c69e867fa8f84ec2a3f1"
end

def install
inreplace "pm_mac/Makefile.osx", "PF=/usr/local", "PF=#{prefix}"

Expand All @@ -36,14 +40,20 @@ def install
system "make", "-f", "pm_mac/Makefile.osx", "install"

if build.with? "python"
ENV.prepend_create_path "PYTHONPATH", buildpath/"cython/lib/python2.7/site-packages"
resource("Cython").stage do
system "python", *Language::Python.setup_install_args(buildpath/"cython")
end
ENV.prepend_path "PATH", buildpath/"cython/bin"

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}"
system "python", *Language::Python.setup_install_args(prefix)
end
end
end
Expand Down

0 comments on commit 2f176b0

Please sign in to comment.