2c745f0622
Mapnik by default tries to install to the site-packages in /System when brewed against system Python. This causes a build error because that directory is not writeable. Mapnik correctly determines the versioned site-packages name without modification, but for Homebrew it needs the proper prefix. * Add the standard `which_python` function to the formula. * Add a scons argument for `PYTHON_PREFIX` * Add the standard caveat for `PYTHONPATH`. Discussed upstream: https://github.com/mapnik/mapnik/issues/1155 and tested on Lion against the system Python. Fixes Homebrew/homebrew#11389 Closes Homebrew/homebrew#11407. Signed-off-by: Jack Nagel <jacknagel@gmail.com>
45 lines
1.2 KiB
Ruby
45 lines
1.2 KiB
Ruby
require 'formula'
|
|
|
|
class Mapnik < Formula
|
|
url 'https://github.com/downloads/mapnik/mapnik/mapnik-v2.0.1.tar.bz2'
|
|
md5 'e3dd09991340e2568b99f46bac34b0a8'
|
|
homepage 'http://www.mapnik.org/'
|
|
head 'https://github.com/mapnik/mapnik.git'
|
|
|
|
depends_on 'pkg-config' => :build
|
|
depends_on 'libtiff'
|
|
depends_on 'jpeg'
|
|
depends_on 'proj'
|
|
depends_on 'icu4c'
|
|
depends_on 'boost'
|
|
depends_on 'cairomm' => :optional
|
|
|
|
def install
|
|
ENV.x11 # for freetype-config
|
|
|
|
icu = Formula.factory("icu4c")
|
|
system "python",
|
|
"scons/scons.py",
|
|
"configure",
|
|
"CC=\"#{ENV.cc}\"",
|
|
"CXX=\"#{ENV.cxx}\"",
|
|
"JOBS=#{ENV.make_jobs}",
|
|
"PREFIX=#{prefix}",
|
|
"ICU_INCLUDES=#{icu.include}",
|
|
"ICU_LIBS=#{icu.lib}",
|
|
"PYTHON_PREFIX=#{prefix}" # Install to Homebrew's site-packages
|
|
system "python",
|
|
"scons/scons.py",
|
|
"install"
|
|
end
|
|
|
|
def caveats; <<-EOS.undent
|
|
For non-homebrew Python, you need to amend your PYTHONPATH like so:
|
|
export PYTHONPATH=#{HOMEBREW_PREFIX}/lib/#{which_python}/site-packages:$PYTHONPATH
|
|
EOS
|
|
end
|
|
|
|
def which_python
|
|
"python" + `python -c 'import sys;print(sys.version[:3])'`.strip
|
|
end
|
|
end
|