Compare commits
20 commits
master
...
static-lib
Author | SHA1 | Date | |
---|---|---|---|
|
3ede8c1c26 | ||
|
de7bb84d1e | ||
|
1e21c5c3c6 | ||
|
72cd2cd583 | ||
|
050d258f7c | ||
|
69a58346ec | ||
|
47ba9c63d2 | ||
|
559c087c9a | ||
|
5381d12f0d | ||
|
629c6ac801 | ||
|
6ec1abac3a | ||
|
642c727a98 | ||
|
1242df28ee | ||
|
acf3f7c3b3 | ||
|
49edaec2cb | ||
|
085ed86f9e | ||
|
51057d2106 | ||
|
47285d1dcf | ||
|
a5b1f9f30c | ||
|
df1cdb1329 |
17 changed files with 127 additions and 37 deletions
85
HOWTO.md
Normal file
85
HOWTO.md
Normal 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'
|
||||
```
|
||||
|
|
@ -1297,7 +1297,8 @@ if not preconfigured:
|
|||
env['QUERIED_PROJ_LIB'] = None
|
||||
env['QUERIED_ICU_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
|
||||
# now strip it to ensure expected behavior
|
||||
if env['LIB_DIR_NAME'].startswith(os.path.sep):
|
||||
|
@ -1360,7 +1361,6 @@ if not preconfigured:
|
|||
env.Append(CFLAGS = env['CUSTOM_CFLAGS'])
|
||||
env.Append(LINKFLAGS = DEFAULT_CXX14_LINKFLAGS)
|
||||
env.Append(LINKFLAGS = env['CUSTOM_LDFLAGS'])
|
||||
|
||||
### platform specific bits
|
||||
|
||||
thread_suffix = 'mt'
|
||||
|
|
|
@ -36,6 +36,8 @@ demo_env = env.Clone()
|
|||
demo_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS'])
|
||||
demo_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES'])
|
||||
|
||||
demo_env['LINKFLAGS'] = '-l%s' % env['MAPNIK_NAME'] + demo_env['LINKFLAGS']
|
||||
|
||||
if env['HAS_CAIRO']:
|
||||
demo_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS'])
|
||||
demo_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
|
||||
|
@ -43,7 +45,6 @@ if env['HAS_CAIRO']:
|
|||
libraries = [env['MAPNIK_NAME']]
|
||||
libraries.extend(copy(env['LIBMAPNIK_LIBS']))
|
||||
rundemo = demo_env.Program('rundemo', source, LIBS=libraries)
|
||||
|
||||
Depends(rundemo, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))
|
||||
|
||||
# build locally if installing
|
||||
|
|
|
@ -36,7 +36,7 @@ else:
|
|||
PLUGIN_NAME = 'csv'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
plugin_env['SHLINKCOM'] = '$SHLINK -o $TARGET $SOURCES $SHLINKFLAGS $__SHLIBVERSIONFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
%(PLUGIN_NAME)s_utils.cpp
|
||||
|
@ -56,7 +56,6 @@ else:
|
|||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.insert(0,env['MAPNIK_NAME'])
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
|
|
|
@ -61,7 +61,6 @@ using mapnik::filter_in_box;
|
|||
using mapnik::filter_at_point;
|
||||
|
||||
static std::once_flag once_flag;
|
||||
|
||||
extern "C" MAPNIK_EXP void on_plugin_load()
|
||||
{
|
||||
// initialize ogr formats
|
||||
|
|
|
@ -26,6 +26,7 @@ from copy import copy
|
|||
PLUGIN_NAME = 'pgraster'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
plugin_env['SHLINKCOM'] = '$SHLINK -o $TARGET $SOURCES $SHLINKFLAGS $__SHLIBVERSIONFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
|
||||
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
|
|
|
@ -26,7 +26,7 @@ from copy import copy
|
|||
PLUGIN_NAME = 'postgis'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
plugin_env['SHLINKCOM'] = '$SHLINK -o $TARGET $SOURCES $SHLINKFLAGS $__SHLIBVERSIONFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
|
@ -54,7 +54,6 @@ if env['PLUGIN_LINKING'] == 'shared':
|
|||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.insert(0,env['MAPNIK_NAME'])
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
|
|
|
@ -50,7 +50,6 @@ if env['PLUGIN_LINKING'] == 'shared':
|
|||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.insert(0,env['MAPNIK_NAME'])
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
|
||||
TARGET = plugin_env.SharedLibrary('../shape',
|
||||
SHLIBSUFFIX='.input',
|
||||
SHLIBPREFIX='',
|
||||
|
|
|
@ -25,7 +25,7 @@ Import ('env')
|
|||
PLUGIN_NAME = 'sqlite'
|
||||
|
||||
plugin_env = plugin_base.Clone()
|
||||
|
||||
plugin_env['SHLINKCOM'] = '$SHLINK -o $TARGET $SOURCES $SHLINKFLAGS $__SHLIBVERSIONFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
|
||||
plugin_sources = Split(
|
||||
"""
|
||||
%(PLUGIN_NAME)s_datasource.cpp
|
||||
|
@ -37,6 +37,7 @@ plugin_sources = Split(
|
|||
libraries = [ 'sqlite3' ]
|
||||
|
||||
linkflags = []
|
||||
|
||||
if env['SQLITE_LINKFLAGS']:
|
||||
linkflags.append(env['SQLITE_LINKFLAGS'])
|
||||
plugin_env.Append(LINKFLAGS=linkflags)
|
||||
|
@ -45,7 +46,6 @@ if env['PLUGIN_LINKING'] == 'shared':
|
|||
libraries.append('boost_system%s' % env['BOOST_APPEND'])
|
||||
libraries.insert(0,env['MAPNIK_NAME'])
|
||||
libraries.append(env['ICU_LIB_NAME'])
|
||||
|
||||
TARGET = plugin_env.SharedLibrary('../%s' % PLUGIN_NAME,
|
||||
SHLIBPREFIX='',
|
||||
SHLIBSUFFIX='.input',
|
||||
|
|
|
@ -85,7 +85,10 @@ auto point_to_polygon_dist(const point<T>& point, const polygon<T>& 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)
|
||||
{
|
||||
for (std::size_t i = 0, j = length - 1; i < length; j = i++)
|
||||
{
|
||||
const auto& a = ring[i];
|
||||
const auto& b = ring[j];
|
||||
|
@ -96,6 +99,7 @@ auto point_to_polygon_dist(const point<T>& point, const polygon<T>& polygon)
|
|||
min_dist_sq = std::min(min_dist_sq, segment_dist_sq(point, a, b));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (inside ? 1 : -1) * std::sqrt(min_dist_sq);
|
||||
}
|
||||
|
@ -235,4 +239,3 @@ template
|
|||
bool interior(polygon<double> const& polygon, double scale_factor, point<double> & pt);
|
||||
|
||||
} }
|
||||
|
||||
|
|
|
@ -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_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()
|
||||
|
|
|
@ -44,7 +44,8 @@
|
|||
namespace mapnik
|
||||
{
|
||||
|
||||
struct _mapnik_lib_t {
|
||||
struct _mapnik_lib_t
|
||||
{
|
||||
handle dl;
|
||||
};
|
||||
|
||||
|
@ -61,25 +62,25 @@ PluginInfo::PluginInfo(std::string const& filename,
|
|||
callable_returning_string name_call = reinterpret_cast<callable_returning_string>(dlsym(module_->dl, library_name.c_str()));
|
||||
if (name_call) name_ = name_call();
|
||||
callable_returning_void init_once = reinterpret_cast<callable_returning_void>(dlsym(module_->dl, "on_plugin_load"));
|
||||
if (init_once) {
|
||||
init_once();
|
||||
}
|
||||
if (init_once) init_once();
|
||||
}
|
||||
#else
|
||||
#ifdef MAPNIK_HAS_DLCFN
|
||||
#ifdef MAPNIK_HAS_DLCFN
|
||||
if (module_) module_->dl = dlopen(filename.c_str(),RTLD_LAZY);
|
||||
if (module_ && module_->dl)
|
||||
{
|
||||
callable_returning_string name_call = reinterpret_cast<callable_returning_string>(dlsym(module_->dl, library_name.c_str()));
|
||||
if (name_call) name_ = name_call();
|
||||
callable_returning_void init_once = reinterpret_cast<callable_returning_void>(dlsym(module_->dl, "on_plugin_load"));
|
||||
if (init_once) {
|
||||
init_once();
|
||||
if (init_once)init_once();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw std::runtime_error(dlerror());
|
||||
}
|
||||
#else
|
||||
#else
|
||||
throw std::runtime_error("no support for loading dynamic objects (Mapnik not compiled with -DMAPNIK_HAS_DLCFN)");
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@ from copy import copy
|
|||
Import ('env')
|
||||
|
||||
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']:
|
||||
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('./visual/run'): os.unlink('./visual/run')
|
||||
else:
|
||||
test_env['LIBS'] = [env['MAPNIK_NAME']]
|
||||
test_env['LIBS'] = []
|
||||
test_env.AppendUnique(LIBS='mapnik-wkt')
|
||||
test_env.AppendUnique(LIBS='mapnik-json')
|
||||
test_env.AppendUnique(LIBS=copy(env['LIBMAPNIK_LIBS']))
|
||||
|
@ -29,8 +31,7 @@ else:
|
|||
test_env['LINKFLAGS'].append('-pthread')
|
||||
test_env.AppendUnique(LIBS='boost_program_options%s' % env['BOOST_APPEND'])
|
||||
test_env_local = test_env.Clone()
|
||||
|
||||
|
||||
test_env_local['LINKCOM'] = '$LINK -o $TARGET $SOURCES $LINKFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
|
||||
# unit tests
|
||||
sources = glob.glob('./unit/*/*.cpp')
|
||||
sources.extend(glob.glob('./unit/*.cpp'))
|
||||
|
|
|
@ -27,13 +27,12 @@ Import ('env')
|
|||
Import ('plugin_base')
|
||||
|
||||
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(
|
||||
"""
|
||||
mapnik-index.cpp
|
||||
process_csv_file.cpp
|
||||
process_geojson_file_x3.cpp
|
||||
../../plugins/input/csv/csv_utils.os
|
||||
"""
|
||||
)
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ source = Split(
|
|||
)
|
||||
|
||||
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'])
|
||||
|
||||
if env['HAS_CAIRO']:
|
||||
|
@ -19,7 +20,7 @@ if env['HAS_CAIRO']:
|
|||
program_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
|
||||
|
||||
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']))
|
||||
if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux':
|
||||
libraries.append('dl')
|
||||
|
|
|
@ -28,6 +28,7 @@ Import ('env')
|
|||
Import ('plugin_base')
|
||||
|
||||
program_env = plugin_base.Clone()
|
||||
program_env['LINKFLAGS'] = '-lmapnik -lmapnik-json' + program_env['LINKFLAGS']
|
||||
|
||||
source = Split(
|
||||
"""
|
||||
|
|
|
@ -41,7 +41,7 @@ if env['HAS_CAIRO']:
|
|||
program_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
|
||||
|
||||
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']))
|
||||
if env['RUNTIME_LINK'] == 'static' and env['PLATFORM'] == 'Linux':
|
||||
libraries.append('dl')
|
||||
|
|
Loading…
Reference in a new issue