diff options
| author | Michael Ummels | 2012-05-31 20:13:25 +0200 |
|---|---|---|
| committer | Adam Vandenberg | 2012-07-27 11:12:27 -0700 |
| commit | c58f24b85923ff4fb09c51f81ec6de6b9f3a47dd (patch) | |
| tree | c774c862eeb9044411c84bab72e947c93f5fa86c /Library/Formula | |
| parent | 2547ffdf0f070d82402e37aeeddbe935f2333b2b (diff) | |
| download | homebrew-c58f24b85923ff4fb09c51f81ec6de6b9f3a47dd.tar.bz2 | |
fontforge: Enable Python extension
Build the Python extension by default and install it to the right location.
Fixes #4689.
Closes #12535.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Formula')
| -rw-r--r-- | Library/Formula/fontforge.rb | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/Library/Formula/fontforge.rb b/Library/Formula/fontforge.rb index d1f1286fe..e6ee005bb 100644 --- a/Library/Formula/fontforge.rb +++ b/Library/Formula/fontforge.rb @@ -27,10 +27,23 @@ class Fontforge < Formula "--enable-double", "--without-freetype-bytecode"] - args << "--without-python" if ARGV.include? "--without-python" + if ARGV.include? "--without-python" + args << "--without-python" + else + python_prefix = `python-config --prefix`.strip + python_version = `python-config --libs`.match('-lpython(\d+\.\d+)').captures.at(0) + args << "--with-python-headers=#{python_prefix}/include/python#{python_version}" + args << "--with-python-lib=-lpython#{python_version}" + args << "--enable-pyextension" + end + # Fix linking to correct Python library + ENV.prepend "LDFLAGS", "-L#{python_prefix}/lib" unless ARGV.include? "--without-python" # Fix linker error; see: http://trac.macports.org/ticket/25012 ENV.append "LDFLAGS", "-lintl" + # Reset ARCHFLAGS to match how we build + ENV["ARCHFLAGS"] = MacOS.prefer_64_bit? ? "-arch x86_64" : "-arch i386" + system "./configure", *args # Fix hard-coded install locations that don't respect the target bindir @@ -39,6 +52,12 @@ class Fontforge < Formula s.gsub! "ln -s /usr/local/bin/fontforge", "ln -s $(bindir)/fontforge" end + # Fix install location of Python extension; see: + # http://sourceforge.net/mailarchive/message.php?msg_id=26827938 + inreplace "Makefile" do |s| + s.gsub! "python setup.py install --prefix=$(prefix) --root=$(DESTDIR)", "python setup.py install --prefix=$(prefix)" + end + # Fix hard-coded include file paths. Reported usptream: # http://sourceforge.net/mailarchive/forum.php?thread_name=C1A32103-A62D-468B-AD8A-A8E0E7126AA5%40smparkes.net&forum_name=fontforge-devel # https://trac.macports.org/ticket/33284 @@ -51,13 +70,29 @@ class Fontforge < Formula system "make install" end - def caveats; <<-EOS.undent - fontforge is an X11 application. + def which_python + "python" + `python -c 'import sys;print(sys.version[:3])'`.strip + end - To install the Mac OS X wrapper application run: + def caveats + general_caveats = <<-EOS.undent + fontforge is an X11 application. + + To install the Mac OS X wrapper application run: brew linkapps - or: + or: ln -s #{prefix}/FontForge.app /Applications EOS + + python_caveats = <<-EOS.undent + + To use the Python extension with non-homebrew Python, you need to amend your + PYTHONPATH like so: + export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH + EOS + + s = general_caveats + s += python_caveats unless ARGV.include? "--without-python" + return s end end |
