Compare commits

...

20 commits

Author SHA1 Message Date
Dane Springmeyer
4164675af7 try clang++5 2018-03-16 08:42:09 -07:00
Artem Pavlenko
de7bb84d1e Revert "try increasing deadline" [skip-ci]
This reverts commit 1e21c5c3c6.
2018-03-16 12:03:26 +01:00
Artem Pavlenko
1e21c5c3c6 try increasing deadline 2018-03-16 11:46:03 +01:00
Artem Pavlenko
72cd2cd583 revert re-arranging unicode_string_grammar 2018-03-15 15:56:26 +01:00
Artem Pavlenko
050d258f7c link to -lmapnik-json 2018-03-15 15:43:26 +01:00
Artem Pavlenko
69a58346ec restoring symbol duplications effort 2018-03-15 15:28:56 +01:00
Artem Pavlenko
47ba9c63d2 better naming 2018-03-15 15:09:17 +01:00
Artem Pavlenko
559c087c9a mapnik-index - add another -lmapnik 2018-03-15 11:39:46 +01:00
Artem Pavlenko
5381d12f0d restore linking to -lmapnik 2018-03-14 18:38:12 +01:00
Artem Pavlenko
629c6ac801 add -lmapnik here as well 2018-03-14 17:18:08 +01:00
Artem Pavlenko
6ec1abac3a add an extra -lmapnik to try on travis 2018-03-14 16:58:34 +01:00
Artem Pavlenko
642c727a98 check polygon ring has at least 2 vertices to avoid unsigned overflowing (e.g 0 - 1) 2018-03-14 16:57:36 +01:00
Artem Pavlenko
1242df28ee cleanup+update build scripts 2018-03-14 15:46:25 +01:00
Artem Pavlenko
acf3f7c3b3 throw runtime_error with message from dlerror on failed dlopen call [skip ci] 2018-03-13 16:39:16 +01:00
Artem Pavlenko
49edaec2cb revive on_plugin_load 2018-03-13 16:37:42 +01:00
Artem Pavlenko
085ed86f9e remove env dump [skip ci] 2018-03-13 14:53:05 +01:00
Artem Pavlenko
51057d2106 fix datasource plug-ins linking order 2018-03-13 12:56:05 +01:00
Artem Pavlenko
47285d1dcf Fix broken rules init order introduces in c737f4d56 2018-03-13 12:56:05 +01:00
Artem Pavlenko
a5b1f9f30c
howto 2018-03-09 13:11:22 +01:00
Artem Pavlenko
df1cdb1329 attempting to build sanitized binaries against statically linked libc++ (WIP) 2018-03-09 12:52:06 +01:00
26 changed files with 144 additions and 68 deletions

View file

@ -33,7 +33,7 @@ matrix:
- os: linux - os: linux
sudo: false sudo: false
compiler: ": clang" compiler: ": clang"
env: JOBS=8 CXX="ccache clang++-3.9 -Qunused-arguments" CC="clang-3.9" ENABLE_GLIBC_WORKAROUND=true TRIGGER=true env: JOBS=8 CXX="ccache clang++-5.0 -Qunused-arguments" CC="clang-5.0" ENABLE_GLIBC_WORKAROUND=true TRIGGER=true
addons: addons:
apt: apt:
sources: [ 'ubuntu-toolchain-r-test'] sources: [ 'ubuntu-toolchain-r-test']
@ -41,7 +41,7 @@ matrix:
- os: linux - os: linux
sudo: false sudo: false
compiler: ": clang-coverage" compiler: ": clang-coverage"
env: JOBS=8 COVERAGE=true CXX="ccache clang++-3.9 -Qunused-arguments" CC="clang-3.9" env: JOBS=8 COVERAGE=true CXX="ccache clang++-5.0 -Qunused-arguments" CC="clang-5.0"
addons: addons:
apt: apt:
sources: [ 'ubuntu-toolchain-r-test'] sources: [ 'ubuntu-toolchain-r-test']
@ -84,12 +84,12 @@ before_script:
- source bootstrap.sh - source bootstrap.sh
- | - |
if [[ $(uname -s) == 'Linux' ]]; then if [[ $(uname -s) == 'Linux' ]]; then
mason install clang++ 3.9.1 mason install clang++ 5.0.1
export PATH=$(mason prefix clang++ 3.9.1)/bin:${PATH} export PATH=$(mason prefix clang++ 5.0.1)/bin:${PATH}
mason install llvm-cov 3.9.1 mason install llvm-cov 5.0.1
export PATH=$(mason prefix llvm-cov 3.9.1)/bin:${PATH} export PATH=$(mason prefix llvm-cov 5.0.1)/bin:${PATH}
which llvm-cov which llvm-cov
export LLVM_COV="$(mason prefix llvm-cov 3.9.1)/bin/llvm-cov" export LLVM_COV="$(mason prefix llvm-cov 5.0.1)/bin/llvm-cov"
fi fi
- ccache --version - ccache --version
- ccache -p || true - ccache -p || true

85
HOWTO.md Normal file
View file

@ -0,0 +1,85 @@
### Initial setup
```bash
export MASON_DIR="<path-to-mason-dir>"
```
### Building gdal (non-sanitized build)
```bash
echo "Configuring..."
CC="$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/bin/clang" \
CXX="$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/bin/clang++ -std=c++14" \
CXXFLAGS="-nostdinc++ -I$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/include/c++/v1 -I/opt/mapnik_static_deps/include" LDFLAGS="-stdlib=libc++ -nostdlib++ $MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/lib/libc++.a $MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/lib/libc++abi.a $MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/lib/libunwind.a -rtlib=compiler-rt -L/opt/mapnik_static_deps/lib" ./configure --without-libtool --with-geos=no --with-curl=no --with-threads=yes --with-hide-internal-symbols=yes --with-xml2=no --with-pcraster=no --with-cfitsio=no --with-odbc=no --with-libkml=no --with-pcidsk=no --with-jasper=no --with-gif=no --with-grib=no --with-freexl=no --with-avx=no --with-sse=no --with-perl=no --with-python=no --with-java=no --with-podofo=no --with-pam --with-webp=no --with-pcre=no --with-liblzma=no --with-netcdf=no --with-poppler=no --with-sfcgal=no --with-fgdb=no --prefix=/opt/mapnik_static_deps --enable-static=yes --enable-shared=no
echo "Buiding..."
make -j4
echo "Done!"
## cd /usr/include
## sudo ln -s locale.h xlocale.h
```
### Building ICU 60.1
echo "Configuring ICU with c++14/libc++ ..."
```bash
CC="$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/bin/clang" \
CXX="$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/bin/clang++" \
LD="$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/bin/clang++" \
CXXFLAGS="-fPIC -nostdinc++ -I$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/include/c++/v1 -I/opt/mapnik_static_deps/include" \
LDFLAGS="-fPIC -stdlib=libc++ -nostdlib++ -rtlib=compiler-rt -ldl -pthread -L/opt/mapnik_static_deps/lib" \
LIBS="$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/lib/libc++.a $MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/lib/libc++abi.a $MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/lib/libunwind.a" \
FORCE_LIB=1 \
./runConfigureICU "Linux" \
--with-data-packaging=archive \
--prefix=/opt/mapnik_static_deps \
--enable-strict \
#--enable-static \
--enable-draft \
--disable-rpath \
--disable-shared \
--disable-tests \
--disable-extras \
--disable-tools \
--disable-tracing \
--disable-layout \
--disable-icuio \
--disable-samples \
#--disable-dyload
echo "Building ..."
make -j4 VERBOSE=1
echo "Done!"
```
### Building boost 1_66
```bash
echo "Building and installing Boost libraries with c++14/libc++ ..."
CC="$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/bin/clang++" \
CXX="$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/bin/clang++" \
LD="$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/bin/clang++" \
./b2 -sICU_PATH="/opt/mapnik_static_deps" include="/opt/mapnik_static_deps/include" toolset=clang cxxflags="-std=c++14 -nostdinc++ -I$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/include/c++/v1" linkflags="-stdlib=libc++ -nostdlib++ $MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/lib/libc++.a $MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/lib/libc++abi.a $MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/lib/libunwind.a -rtlib=compiler-rt -L/opt/mapnik_static_deps/lib -pthread -ldl" --prefix=/opt/boost_1_66_sanitized --with-iostreams --with-filesystem --with-regex --with-python --with-thread --with-program_options --with-system install
echo "Done!"
```
### Building Mapnik
Sample config.py
```python
CXX = '$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/bin/clang++'
CC = '$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/bin/clang'
CUSTOM_CXXFLAGS = ' -fsanitize=memory -nostdinc++ -I$MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/include/c++/v1'
CUSTOM_LDFLAGS = '-fsanitize=memory -stdlib=libc++ -nostdlib++ $MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/msan/lib/libc++.a $MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/msan/lib/libc++abi.a $MASON_DIR/mason_packages/linux-x86_64/llvm/7.0.0/lib/libunwind.a -rtlib=compiler-rt -ldl -pthread'
INPUT_PLUGINS = 'gdal,geojson,ogr,raster,shape,sqlite'
PREFIX = '/opt/mapnik-sanitized'
BOOST_INCLUDES = '/opt/boost_1_66_sanitized/include'
BOOST_LIBS = '/opt/boost_1_66_sanitized/lib'
ICU_INCLUDES = '/opt/mapnik_static_deps/include'
ICU_LIBS = '/opt/mapnik_static_deps/lib'
SVG_RENDERER = True
CAIRO_INCLUDES = '/opt/mapnik_static_deps/include'
CAIRO_LIBS = '/opt/mapnik_static_deps/lib'
```

View file

@ -1297,7 +1297,8 @@ if not preconfigured:
env['QUERIED_PROJ_LIB'] = None env['QUERIED_PROJ_LIB'] = None
env['QUERIED_ICU_DATA'] = None env['QUERIED_ICU_DATA'] = None
env['QUERIED_GDAL_DATA'] = None env['QUERIED_GDAL_DATA'] = None
#'LINKCOM': '$LINK -o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
env['LINKCOM'] = '$LINK -o $TARGET $SOURCES $LINKFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
# previously a leading / was expected for LIB_DIR_NAME # previously a leading / was expected for LIB_DIR_NAME
# now strip it to ensure expected behavior # now strip it to ensure expected behavior
if env['LIB_DIR_NAME'].startswith(os.path.sep): if env['LIB_DIR_NAME'].startswith(os.path.sep):
@ -1360,7 +1361,6 @@ if not preconfigured:
env.Append(CFLAGS = env['CUSTOM_CFLAGS']) env.Append(CFLAGS = env['CUSTOM_CFLAGS'])
env.Append(LINKFLAGS = DEFAULT_CXX14_LINKFLAGS) env.Append(LINKFLAGS = DEFAULT_CXX14_LINKFLAGS)
env.Append(LINKFLAGS = env['CUSTOM_LDFLAGS']) env.Append(LINKFLAGS = env['CUSTOM_LDFLAGS'])
### platform specific bits ### platform specific bits
thread_suffix = 'mt' thread_suffix = 'mt'

View file

@ -11,7 +11,7 @@ todo
- shrink icu data - shrink icu data
' '
MASON_VERSION="e4c1746" MASON_VERSION="40ca8d2"
function setup_mason() { function setup_mason() {
if [[ ! -d ./.mason ]]; then if [[ ! -d ./.mason ]]; then

View file

@ -36,6 +36,8 @@ demo_env = env.Clone()
demo_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS']) demo_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS'])
demo_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES']) demo_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES'])
demo_env['LINKFLAGS'] = '-l%s' % env['MAPNIK_NAME'] + demo_env['LINKFLAGS']
if env['HAS_CAIRO']: if env['HAS_CAIRO']:
demo_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS']) demo_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS'])
demo_env.Append(CPPDEFINES = '-DHAVE_CAIRO') demo_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
@ -43,7 +45,6 @@ if env['HAS_CAIRO']:
libraries = [env['MAPNIK_NAME']] libraries = [env['MAPNIK_NAME']]
libraries.extend(copy(env['LIBMAPNIK_LIBS'])) libraries.extend(copy(env['LIBMAPNIK_LIBS']))
rundemo = demo_env.Program('rundemo', source, LIBS=libraries) rundemo = demo_env.Program('rundemo', source, LIBS=libraries)
Depends(rundemo, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME'])) Depends(rundemo, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
# build locally if installing # build locally if installing

View file

@ -24,7 +24,7 @@
#define MAPNIK_EXPRESSIONS_GRAMMAR_X3_DEF_HPP #define MAPNIK_EXPRESSIONS_GRAMMAR_X3_DEF_HPP
#include <mapnik/expression_grammar_x3.hpp> #include <mapnik/expression_grammar_x3.hpp>
#include <mapnik/json/unicode_string_grammar_x3.hpp> #include <mapnik/json/unicode_string_grammar_x3_def.hpp>
#include <mapnik/expression_node.hpp> #include <mapnik/expression_node.hpp>
#include <mapnik/function_call.hpp> #include <mapnik/function_call.hpp>
#include <mapnik/unicode.hpp> #include <mapnik/unicode.hpp>
@ -67,7 +67,7 @@ namespace mapnik { namespace grammar {
x3::uint_parser<char, 16, 2, 2> const hex2 {}; x3::uint_parser<char, 16, 2, 2> const hex2 {};
namespace { namespace {
auto const& escaped_unicode = json::escaped_unicode_grammar(); auto const& escaped_unicode = json::grammar::escaped_unicode;
} }
auto append = [](auto const& ctx) auto append = [](auto const& ctx)

View file

@ -74,7 +74,7 @@ namespace { auto const& json_string = mapnik::json::unicode_string_grammar(); }
// exported rules // exported rules
// start // start
generic_json_grammar_type const value MAPNIK_INIT_PRIORITY(103) ("JSON Value"); generic_json_grammar_type const value MAPNIK_INIT_PRIORITY(102) ("JSON Value");
generic_json_key_value_type const key_value("JSON Object element"); generic_json_key_value_type const key_value("JSON Object element");
// rules // rules
x3::rule<class json_object_tag, json_object> const object("JSON Object"); x3::rule<class json_object_tag, json_object> const object("JSON Object");

View file

@ -43,7 +43,7 @@ auto assign_helper = [](auto const& ctx)
} // anonymous ns } // anonymous ns
// start rule // start rule
positions_grammar_type const positions MAPNIK_INIT_PRIORITY(104) ("Positions"); positions_grammar_type const positions MAPNIK_INIT_PRIORITY(103) ("Positions");
// rules // rules
x3::rule<class point_class, point> const point("Position"); x3::rule<class point_class, point> const point("Position");
x3::rule<class ring_class, ring> const ring("Ring"); x3::rule<class ring_class, ring> const ring("Ring");

View file

@ -306,7 +306,7 @@ struct topojson_geometry_type_ : x3::symbols<int>
} topojson_geometry_type; } topojson_geometry_type;
// start rule // start rule
topojson_grammar_type const topology MAPNIK_INIT_PRIORITY(105) ("Topology"); topojson_grammar_type const topology MAPNIK_INIT_PRIORITY(104) ("Topology");
// rules // rules
x3::rule<class transform_tag, mapnik::topojson::transform> const transform = "Transform"; x3::rule<class transform_tag, mapnik::topojson::transform> const transform = "Transform";
x3::rule<class bbox_tag, mapnik::topojson::bounding_box> const bbox = "Bounding Box"; x3::rule<class bbox_tag, mapnik::topojson::bounding_box> const bbox = "Bounding Box";

View file

@ -33,15 +33,11 @@ namespace mapnik { namespace json { namespace grammar {
namespace x3 = boost::spirit::x3; namespace x3 = boost::spirit::x3;
using unicode_string_grammar_type = x3::rule<class unicode_string_tag, std::string>; using unicode_string_grammar_type = x3::rule<class unicode_string_tag, std::string>;
using escaped_unicode_type = x3::rule<class escaped_unicode_tag, std::string>;
BOOST_SPIRIT_DECLARE(unicode_string_grammar_type); BOOST_SPIRIT_DECLARE(unicode_string_grammar_type);
BOOST_SPIRIT_DECLARE(escaped_unicode_type);
} }
grammar::unicode_string_grammar_type const& unicode_string_grammar(); grammar::unicode_string_grammar_type const& unicode_string_grammar();
grammar::escaped_unicode_type const& escaped_unicode_grammar();
}} }}

View file

@ -110,11 +110,11 @@ x3::uint_parser<std::uint16_t, 16, 4, 4> const hex4 {};
x3::uint_parser<uchar, 16, 8, 8> const hex8 {}; x3::uint_parser<uchar, 16, 8, 8> const hex8 {};
// start rule // start rule
unicode_string_grammar_type const unicode_string MAPNIK_INIT_PRIORITY(102) ("Unicode String"); unicode_string_grammar_type const unicode_string MAPNIK_INIT_PRIORITY(101) ("Unicode String");
// rules // rules
x3::rule<class double_quoted_tag, std::string> const double_quoted("Double-quoted string"); x3::rule<class double_quoted_tag, std::string> const double_quoted("Double-quoted string");
x3::rule<class escaped_tag, std::string> const escaped("Escaped Character"); x3::rule<class escaped_tag, std::string> const escaped("Escaped Character");
escaped_unicode_type const escaped_unicode MAPNIK_INIT_PRIORITY(101) ("Escaped Unicode code point(s)"); x3::rule<class escaped_unicode_tag, std::string> const escaped_unicode("Escaped Unicode code point(s)");
x3::rule<class utf16_string_tag, std::vector<std::uint16_t>> const utf16_string("UTF16 encoded string"); x3::rule<class utf16_string_tag, std::vector<std::uint16_t>> const utf16_string("UTF16 encoded string");
auto unicode_string_def = double_quoted auto unicode_string_def = double_quoted

View file

@ -36,7 +36,7 @@ else:
PLUGIN_NAME = 'csv' PLUGIN_NAME = 'csv'
plugin_env = plugin_base.Clone() plugin_env = plugin_base.Clone()
plugin_env['SHLINKCOM'] = '$SHLINK -o $TARGET $SOURCES $SHLINKFLAGS $__SHLIBVERSIONFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
plugin_sources = Split( plugin_sources = Split(
""" """
%(PLUGIN_NAME)s_utils.cpp %(PLUGIN_NAME)s_utils.cpp
@ -56,7 +56,6 @@ else:
libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append('boost_system%s' % env['BOOST_APPEND'])
libraries.insert(0,env['MAPNIK_NAME']) libraries.insert(0,env['MAPNIK_NAME'])
libraries.append(env['ICU_LIB_NAME']) libraries.append(env['ICU_LIB_NAME'])
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
SHLIBPREFIX='', SHLIBPREFIX='',
SHLIBSUFFIX='.input', SHLIBSUFFIX='.input',

View file

@ -60,7 +60,6 @@ using mapnik::filter_in_box;
using mapnik::filter_at_point; using mapnik::filter_at_point;
static std::once_flag once_flag; static std::once_flag once_flag;
extern "C" MAPNIK_EXP void on_plugin_load() extern "C" MAPNIK_EXP void on_plugin_load()
{ {
// initialize ogr formats // initialize ogr formats

View file

@ -26,6 +26,7 @@ from copy import copy
PLUGIN_NAME = 'pgraster' PLUGIN_NAME = 'pgraster'
plugin_env = plugin_base.Clone() plugin_env = plugin_base.Clone()
plugin_env['SHLINKCOM'] = '$SHLINK -o $TARGET $SOURCES $SHLINKFLAGS $__SHLIBVERSIONFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
plugin_sources = Split( plugin_sources = Split(
""" """

View file

@ -26,7 +26,7 @@ from copy import copy
PLUGIN_NAME = 'postgis' PLUGIN_NAME = 'postgis'
plugin_env = plugin_base.Clone() plugin_env = plugin_base.Clone()
plugin_env['SHLINKCOM'] = '$SHLINK -o $TARGET $SOURCES $SHLINKFLAGS $__SHLIBVERSIONFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
plugin_sources = Split( plugin_sources = Split(
""" """
%(PLUGIN_NAME)s_datasource.cpp %(PLUGIN_NAME)s_datasource.cpp
@ -54,7 +54,6 @@ if env['PLUGIN_LINKING'] == 'shared':
libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append('boost_system%s' % env['BOOST_APPEND'])
libraries.insert(0,env['MAPNIK_NAME']) libraries.insert(0,env['MAPNIK_NAME'])
libraries.append(env['ICU_LIB_NAME']) libraries.append(env['ICU_LIB_NAME'])
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
SHLIBPREFIX='', SHLIBPREFIX='',
SHLIBSUFFIX='.input', SHLIBSUFFIX='.input',

View file

@ -50,7 +50,6 @@ if env['PLUGIN_LINKING'] == 'shared':
libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append('boost_system%s' % env['BOOST_APPEND'])
libraries.insert(0,env['MAPNIK_NAME']) libraries.insert(0,env['MAPNIK_NAME'])
libraries.append(env['ICU_LIB_NAME']) libraries.append(env['ICU_LIB_NAME'])
TARGET = plugin_env.SharedLibrary('../shape', TARGET = plugin_env.SharedLibrary('../shape',
SHLIBSUFFIX='.input', SHLIBSUFFIX='.input',
SHLIBPREFIX='', SHLIBPREFIX='',

View file

@ -25,7 +25,7 @@ Import ('env')
PLUGIN_NAME = 'sqlite' PLUGIN_NAME = 'sqlite'
plugin_env = plugin_base.Clone() plugin_env = plugin_base.Clone()
plugin_env['SHLINKCOM'] = '$SHLINK -o $TARGET $SOURCES $SHLINKFLAGS $__SHLIBVERSIONFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
plugin_sources = Split( plugin_sources = Split(
""" """
%(PLUGIN_NAME)s_datasource.cpp %(PLUGIN_NAME)s_datasource.cpp
@ -37,6 +37,7 @@ plugin_sources = Split(
libraries = [ 'sqlite3' ] libraries = [ 'sqlite3' ]
linkflags = [] linkflags = []
if env['SQLITE_LINKFLAGS']: if env['SQLITE_LINKFLAGS']:
linkflags.append(env['SQLITE_LINKFLAGS']) linkflags.append(env['SQLITE_LINKFLAGS'])
plugin_env.Append(LINKFLAGS=linkflags) plugin_env.Append(LINKFLAGS=linkflags)
@ -45,7 +46,6 @@ if env['PLUGIN_LINKING'] == 'shared':
libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append('boost_system%s' % env['BOOST_APPEND'])
libraries.insert(0,env['MAPNIK_NAME']) libraries.insert(0,env['MAPNIK_NAME'])
libraries.append(env['ICU_LIB_NAME']) libraries.append(env['ICU_LIB_NAME'])
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME, TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
SHLIBPREFIX='', SHLIBPREFIX='',
SHLIBSUFFIX='.input', SHLIBSUFFIX='.input',

View file

@ -22,19 +22,9 @@
#include <mapnik/expression_grammar_x3_def.hpp> #include <mapnik/expression_grammar_x3_def.hpp>
#include <mapnik/expression_grammar_x3_config.hpp> #include <mapnik/expression_grammar_x3_config.hpp>
#include <mapnik/json/unicode_string_grammar_x3_def.hpp>
namespace mapnik { namespace json { namespace grammar {
BOOST_SPIRIT_INSTANTIATE(unicode_string_grammar_type, mapnik::grammar::iterator_type, mapnik::grammar::context_type);
}
grammar::escaped_unicode_type const& escaped_unicode_grammar()
{
return grammar::escaped_unicode;
}
}}
namespace mapnik { namespace grammar { namespace mapnik { namespace grammar {
BOOST_SPIRIT_INSTANTIATE(expression_grammar_type, iterator_type, context_type); BOOST_SPIRIT_INSTANTIATE(expression_grammar_type, iterator_type, context_type);
}} }}

View file

@ -85,15 +85,19 @@ auto point_to_polygon_dist(const point<T>& point, const polygon<T>& polygon)
for (const auto& ring : polygon) for (const auto& ring : polygon)
{ {
for (std::size_t i = 0, len = ring.size(), j = len - 1; i < len; j = i++) std::size_t length = ring.size();
if (length > 1)
{ {
const auto& a = ring[i]; for (std::size_t i = 0, j = length - 1; i < length; j = i++)
const auto& b = ring[j]; {
const auto& a = ring[i];
const auto& b = ring[j];
if ((a.y > point.y) != (b.y > point.y) && if ((a.y > point.y) != (b.y > point.y) &&
(point.x < (b.x - a.x) * (point.y - a.y) / (b.y - a.y) + a.x)) inside = !inside; (point.x < (b.x - a.x) * (point.y - a.y) / (b.y - a.y) + a.x)) inside = !inside;
min_dist_sq = std::min(min_dist_sq, segment_dist_sq(point, a, b)); min_dist_sq = std::min(min_dist_sq, segment_dist_sq(point, a, b));
}
} }
} }
@ -235,4 +239,3 @@ template
bool interior(polygon<double> const& polygon, double scale_factor, point<double> & pt); bool interior(polygon<double> const& polygon, double scale_factor, point<double> & pt);
} } } }

View file

@ -42,6 +42,7 @@ BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extr
BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type); BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type);
BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_context_type_f); BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_context_type_f);
BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type_f); BOOST_SPIRIT_INSTANTIATE_UNUSED(unicode_string_grammar_type, iterator_type, extract_bounding_boxes_reverse_context_type_f);
} }
grammar::unicode_string_grammar_type const& unicode_string_grammar() grammar::unicode_string_grammar_type const& unicode_string_grammar()

View file

@ -44,7 +44,8 @@
namespace mapnik namespace mapnik
{ {
struct _mapnik_lib_t { struct _mapnik_lib_t
{
handle dl; handle dl;
}; };
@ -59,27 +60,27 @@ PluginInfo::PluginInfo(std::string const& filename,
if (module_ && module_->dl) if (module_ && module_->dl)
{ {
callable_returning_string name_call = reinterpret_cast<callable_returning_string>(dlsym(module_->dl, library_name.c_str())); callable_returning_string name_call = reinterpret_cast<callable_returning_string>(dlsym(module_->dl, library_name.c_str()));
if (name_call) name_ = name_call(); if (name_call) name_ = name_call();
callable_returning_void init_once = reinterpret_cast<callable_returning_void>(dlsym(module_->dl, "on_plugin_load")); callable_returning_void init_once = reinterpret_cast<callable_returning_void>(dlsym(module_->dl, "on_plugin_load"));
if (init_once) { if (init_once) init_once();
init_once();
}
} }
#else #else
#ifdef MAPNIK_HAS_DLCFN #ifdef MAPNIK_HAS_DLCFN
if (module_) module_->dl = dlopen(filename.c_str(),RTLD_LAZY); if (module_) module_->dl = dlopen(filename.c_str(),RTLD_LAZY);
if (module_ && module_->dl) if (module_ && module_->dl)
{ {
callable_returning_string name_call = reinterpret_cast<callable_returning_string>(dlsym(module_->dl, library_name.c_str())); callable_returning_string name_call = reinterpret_cast<callable_returning_string>(dlsym(module_->dl, library_name.c_str()));
if (name_call) name_ = name_call(); if (name_call) name_ = name_call();
callable_returning_void init_once = reinterpret_cast<callable_returning_void>(dlsym(module_->dl, "on_plugin_load")); callable_returning_void init_once = reinterpret_cast<callable_returning_void>(dlsym(module_->dl, "on_plugin_load"));
if (init_once) { if (init_once)init_once();
init_once();
}
} }
#else else
{
throw std::runtime_error(dlerror());
}
#else
throw std::runtime_error("no support for loading dynamic objects (Mapnik not compiled with -DMAPNIK_HAS_DLCFN)"); throw std::runtime_error("no support for loading dynamic objects (Mapnik not compiled with -DMAPNIK_HAS_DLCFN)");
#endif #endif
#endif #endif
} }

View file

@ -5,6 +5,8 @@ from copy import copy
Import ('env') Import ('env')
test_env = env.Clone() test_env = env.Clone()
test_env['LINKCOM'] = '$LINK -o $TARGET $SOURCES $LINKFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
test_env['LINKFLAGS'] = '-l%s' % env['MAPNIK_NAME'] + test_env['LINKFLAGS']
if not env['CPP_TESTS']: if not env['CPP_TESTS']:
for cpp_test_bin in glob.glob('./*/*-bin'): for cpp_test_bin in glob.glob('./*/*-bin'):
@ -12,7 +14,7 @@ if not env['CPP_TESTS']:
if os.path.exists('./unit/run'): os.unlink('./unit/run') if os.path.exists('./unit/run'): os.unlink('./unit/run')
if os.path.exists('./visual/run'): os.unlink('./visual/run') if os.path.exists('./visual/run'): os.unlink('./visual/run')
else: else:
test_env['LIBS'] = [env['MAPNIK_NAME']] test_env['LIBS'] = []
test_env.AppendUnique(LIBS='mapnik-wkt') test_env.AppendUnique(LIBS='mapnik-wkt')
test_env.AppendUnique(LIBS='mapnik-json') test_env.AppendUnique(LIBS='mapnik-json')
test_env.AppendUnique(LIBS=copy(env['LIBMAPNIK_LIBS'])) test_env.AppendUnique(LIBS=copy(env['LIBMAPNIK_LIBS']))
@ -29,8 +31,7 @@ else:
test_env['LINKFLAGS'].append('-pthread') test_env['LINKFLAGS'].append('-pthread')
test_env.AppendUnique(LIBS='boost_program_options%s' % env['BOOST_APPEND']) test_env.AppendUnique(LIBS='boost_program_options%s' % env['BOOST_APPEND'])
test_env_local = test_env.Clone() test_env_local = test_env.Clone()
test_env_local['LINKCOM'] = '$LINK -o $TARGET $SOURCES $LINKFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
# unit tests # unit tests
sources = glob.glob('./unit/*/*.cpp') sources = glob.glob('./unit/*/*.cpp')
sources.extend(glob.glob('./unit/*.cpp')) sources.extend(glob.glob('./unit/*.cpp'))

View file

@ -27,13 +27,12 @@ Import ('env')
Import ('plugin_base') Import ('plugin_base')
program_env = plugin_base.Clone() program_env = plugin_base.Clone()
program_env['LINKFLAGS'] = '-l%s plugins/input/csv/csv_utils.os' % plugin_base['MAPNIK_NAME'] + program_env['LINKFLAGS']
source = Split( source = Split(
""" """
mapnik-index.cpp mapnik-index.cpp
process_csv_file.cpp process_csv_file.cpp
process_geojson_file_x3.cpp process_geojson_file_x3.cpp
../../plugins/input/csv/csv_utils.os
""" """
) )

View file

@ -12,6 +12,7 @@ source = Split(
) )
program_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS']) program_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS'])
program_env['LINKFLAGS'] = '-l%s' % program_env['MAPNIK_NAME'] + program_env['LINKFLAGS']
program_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES']) program_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES'])
if env['HAS_CAIRO']: if env['HAS_CAIRO']:
@ -19,7 +20,7 @@ if env['HAS_CAIRO']:
program_env.Append(CPPDEFINES = '-DHAVE_CAIRO') program_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND'] boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND']
libraries = [env['MAPNIK_NAME'],boost_program_options] libraries = [env['MAPNIK_NAME'], boost_program_options]
libraries.extend(copy(env['LIBMAPNIK_LIBS'])) libraries.extend(copy(env['LIBMAPNIK_LIBS']))
if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux': if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux':
libraries.append('dl') libraries.append('dl')

View file

@ -28,6 +28,7 @@ Import ('env')
Import ('plugin_base') Import ('plugin_base')
program_env = plugin_base.Clone() program_env = plugin_base.Clone()
program_env['LINKFLAGS'] = '-lmapnik -lmapnik-json' + program_env['LINKFLAGS']
source = Split( source = Split(
""" """

View file

@ -41,7 +41,7 @@ if env['HAS_CAIRO']:
program_env.Append(CPPDEFINES = '-DHAVE_CAIRO') program_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND'] boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND']
libraries = [env['MAPNIK_NAME'],boost_program_options] libraries = [env['MAPNIK_NAME'], boost_program_options]
libraries.extend(copy(env['LIBMAPNIK_LIBS'])) libraries.extend(copy(env['LIBMAPNIK_LIBS']))
if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux': if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux':
libraries.append('dl') libraries.append('dl')