diff --git a/README.md b/README.md index bdcc1a0a6..cab7992f1 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,8 @@ After this is done simply follow the directions as per a source build. ### Building from Source +For detailed MacOS with Homebrew instructions, see section below + Assuming that you built your own mapnik from source, and you have run `make install`. Set any compiler or linking environment variables as necessary so that your installation of mapnik is found. Next simply run one of the two methods: ``` @@ -53,6 +55,46 @@ If you need Pycairo, make sure that PYCAIRO is set to true in your environment o PYCAIRO=true python setup.py develop ``` +### Building on MacOS Catalina with Homebrew: use mapnik/master and python-mapnik-master + +On MacOS Catalina with Homebrew, the homebrew's mapnik version (3.0) conflicts with the boost version (>1.73). + +Its much easier to compile mapnik 4.0 from `mapnik/master`, and compile `python-mapnik` against that. + +#### First: setup homebrew packages + +``` +# note: boost needs to be >= 1.73, make sure boost@1.73 is linked too +brew install boost boost-python3 sqlite gdal cairo python@3.8 +brew upgrade boost boost-python3 sqlite gdal cairo python@3.8 +brew link boost + +# We're build a custom mapnik 4, uninstall the stale 3.x version in homebrew: +brew uninstall mapnik +``` + +#### Second: build `mapnik/master` + +Setting the `PYTHON=python2` env var is important, an older fork of SConstruct is embedded in mapnik source, which will not work with `python` if its linked to `python3` as on some MacOS systems. Passing a path to sqlite3 will select the homebrew version instead of the MacOS system version (which doesn't include support for sqlite extensions and will break the mapnik compile). + +``` +brew install boost +git clone https://github.com/mapnik/mapnik ; cd mapnik +git submodule update --init +PYTHON=python2 ./configure. SQLITE_INCLUDES=/usr/local/opt/sqlite3/include +make +make install +``` + +#### Finally: build `python-mapnik/master` + +Homebrew includes the python version in the libboost_python38.dylib name, which is not autodetected, and must be explicitly referenced: + +``` +git clone https://github.com/mapnik/python-mapnik ; cd python-mapnik +BOOST_PYTHON=boost_python38 python3 setup.py install +``` + ### Building against Mapnik 3.0.x The `master` branch is no longer compatible with `3.0.x` series of Mapnik. To build against Mapnik 3.0.x, use [`v3.0.x`](https://github.com/mapnik/python-mapnik/tree/v3.0.x) branch.