2010-11-09 22:05:44 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Mapnik < Formula
|
2012-04-09 23:59:49 +00:00
|
|
|
url 'https://github.com/downloads/mapnik/mapnik/mapnik-v2.0.1.tar.bz2'
|
|
|
|
md5 'e3dd09991340e2568b99f46bac34b0a8'
|
2010-11-09 22:05:44 +00:00
|
|
|
homepage 'http://www.mapnik.org/'
|
2011-10-18 20:48:00 +00:00
|
|
|
head 'https://github.com/mapnik/mapnik.git'
|
2010-11-09 22:05:44 +00:00
|
|
|
|
|
|
|
depends_on 'pkg-config' => :build
|
|
|
|
depends_on 'libtiff'
|
|
|
|
depends_on 'jpeg'
|
|
|
|
depends_on 'proj'
|
|
|
|
depends_on 'icu4c'
|
|
|
|
depends_on 'boost'
|
|
|
|
depends_on 'cairomm' => :optional
|
2012-06-07 01:35:12 +00:00
|
|
|
depends_on :x11
|
2010-11-09 22:05:44 +00:00
|
|
|
|
2012-05-03 22:43:36 +00:00
|
|
|
# Reported upstream: https://github.com/mapnik/mapnik/issues/1171
|
2012-06-09 04:32:17 +00:00
|
|
|
# Fix is in head. Remove at 2.0.2.
|
2012-05-03 22:43:36 +00:00
|
|
|
def patches
|
2012-06-09 04:32:17 +00:00
|
|
|
DATA unless ARGV.build_head?
|
2012-05-03 22:43:36 +00:00
|
|
|
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
|
2012-05-03 22:43:36 +00:00
|
|
|
|
|
|
|
__END__
|
|
|
|
--- a/bindings/python/build.py
|
|
|
|
+++ b/bindings/python/build.py
|
|
|
|
@@ -143,10 +143,7 @@ paths += "__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]\n"
|
|
|
|
if not os.path.exists('mapnik'):
|
|
|
|
os.mkdir('mapnik')
|
|
|
|
|
|
|
|
-if hasattr(os.path,'relpath'): # python 2.6 and above
|
|
|
|
- file('mapnik/paths.py','w').write(paths % (os.path.relpath(env['MAPNIK_LIB_DIR'],target_path)))
|
|
|
|
-else:
|
|
|
|
- file('mapnik/paths.py','w').write(paths % (env['MAPNIK_LIB_DIR']))
|
|
|
|
+file('mapnik/paths.py','w').write(paths % (env['MAPNIK_LIB_DIR']))
|
|
|
|
|
|
|
|
# force open perms temporarily so that `sudo scons install`
|
|
|
|
# does not later break simple non-install non-sudo rebuild
|