2010-11-09 22:05:44 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Mapnik < Formula
|
|
|
|
homepage 'http://www.mapnik.org/'
|
2012-08-23 23:29:23 +00:00
|
|
|
url 'https://github.com/downloads/mapnik/mapnik/mapnik-v2.1.0.tar.bz2'
|
|
|
|
sha1 'b1c6a138e65a5e20f0f312a559e2ae7185adf5b6'
|
|
|
|
|
2011-10-18 20:48:00 +00:00
|
|
|
head 'https://github.com/mapnik/mapnik.git'
|
2010-11-09 22:05:44 +00:00
|
|
|
|
2012-09-02 08:06:09 +00:00
|
|
|
option 'with-cairo', 'Build with Cairo'
|
|
|
|
|
2012-10-19 05:39:30 +00:00
|
|
|
depends_on :libtool => :build
|
2012-09-02 08:06:09 +00:00
|
|
|
depends_on :freetype
|
|
|
|
depends_on :libpng
|
2010-11-09 22:05:44 +00:00
|
|
|
depends_on 'libtiff'
|
|
|
|
depends_on 'proj'
|
|
|
|
depends_on 'icu4c'
|
2012-09-02 08:06:09 +00:00
|
|
|
depends_on 'jpeg'
|
2010-11-09 22:05:44 +00:00
|
|
|
depends_on 'boost'
|
2012-09-02 08:06:09 +00:00
|
|
|
|
|
|
|
if build.include? 'with-cairo'
|
|
|
|
depends_on 'pkg-config' => :build
|
|
|
|
depends_on 'cairo' => :optional
|
|
|
|
depends_on 'cairomm' => :optional
|
|
|
|
end
|
2010-11-09 22:05:44 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
icu = Formula.factory("icu4c")
|
2012-04-10 18:04:32 +00:00
|
|
|
# mapnik compiles can take ~1.5 GB per job for some .cpp files
|
|
|
|
# so lets be cautious by limiting to CPUS/2
|
|
|
|
jobs = ENV.make_jobs
|
|
|
|
if jobs > 2
|
|
|
|
jobs = Integer(jobs/2)
|
|
|
|
end
|
|
|
|
|
2011-10-18 20:48:00 +00:00
|
|
|
system "python",
|
|
|
|
"scons/scons.py",
|
|
|
|
"configure",
|
|
|
|
"CC=\"#{ENV.cc}\"",
|
|
|
|
"CXX=\"#{ENV.cxx}\"",
|
2012-04-10 18:04:32 +00:00
|
|
|
"JOBS=#{jobs}",
|
2011-10-18 20:48:00 +00:00
|
|
|
"PREFIX=#{prefix}",
|
|
|
|
"ICU_INCLUDES=#{icu.include}",
|
2012-04-03 03:24:54 +00:00
|
|
|
"ICU_LIBS=#{icu.lib}",
|
|
|
|
"PYTHON_PREFIX=#{prefix}" # Install to Homebrew's site-packages
|
2011-10-18 20:48:00 +00:00
|
|
|
system "python",
|
|
|
|
"scons/scons.py",
|
|
|
|
"install"
|
2010-11-09 22:05:44 +00:00
|
|
|
end
|
2012-04-03 03:24:54 +00:00
|
|
|
|
|
|
|
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
|
2010-11-09 22:05:44 +00:00
|
|
|
end
|