mapnik/src/build.py

439 lines
14 KiB
Python
Raw Normal View History

#
2006-03-31 12:32:02 +02:00
# This file is part of Mapnik (c++ mapping toolkit)
#
# Copyright (C) 2013 Artem Pavlenko
2006-03-31 12:32:02 +02:00
#
# Mapnik is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
#
2006-03-31 12:32:02 +02:00
import os
import sys
import glob
from copy import copy
from subprocess import Popen, PIPE
2005-06-14 17:06:59 +02:00
2006-02-01 00:09:52 +01:00
Import('env')
2005-06-14 17:06:59 +02:00
lib_env = env.Clone()
def call(cmd, silent=True):
stdin, stderr = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE).communicate()
if not stderr:
return stdin.strip()
elif not silent:
print stderr
def ldconfig(*args,**kwargs):
call('ldconfig')
if env['LINKING'] == 'static':
lib_env.Append(CXXFLAGS="-fPIC")
mapnik_lib_link_flag = ''
# note: .data gets the actual list to allow a true copy
# and avoids unintended pollution of other environments
libmapnik_cxxflags = copy(lib_env['CXXFLAGS'].data)
libmapnik_defines = copy(lib_env['CPPDEFINES'])
ABI_VERSION = env['ABI_VERSION']
2005-06-14 17:06:59 +02:00
enabled_imaging_libraries = []
filesystem = 'boost_filesystem%s' % env['BOOST_APPEND']
regex = 'boost_regex%s' % env['BOOST_APPEND']
system = 'boost_system%s' % env['BOOST_APPEND']
# clear out and re-set libs for this env
# note: order matters on linux: see lorder | tsort
2014-01-23 09:42:41 +01:00
lib_env['LIBS'] = [filesystem,
Merge branch '2.3.x' of github.com:mapnik/mapnik Conflicts: .travis.yml CHANGELOG.md bindings/python/build.py include/mapnik/feature_style_processor_context.hpp include/mapnik/feature_style_processor_impl.hpp include/mapnik/json/feature_collection_grammar.hpp include/mapnik/json/feature_collection_parser.hpp include/mapnik/json/feature_generator_grammar.hpp include/mapnik/json/feature_parser.hpp include/mapnik/json/geojson_generator.hpp include/mapnik/json/geometry_generator_grammar.hpp include/mapnik/json/geometry_parser.hpp plugins/input/gdal/gdal_featureset.cpp plugins/input/geojson/geojson_datasource.cpp plugins/input/occi/occi_featureset.cpp plugins/input/osm/osm_featureset.cpp plugins/input/postgis/build.py plugins/input/postgis/connection.hpp src/agg/agg_renderer.cpp src/build.py src/cairo_context.cpp src/datasource_cache.cpp src/grid/process_line_symbolizer.cpp src/grid/process_polygon_pattern_symbolizer.cpp src/grid/process_polygon_symbolizer.cpp src/grid/process_text_symbolizer.cpp src/json/feature_grammar.cpp tests/cpp_tests/fontset_runtime_test.cpp tests/visual_tests/images/collision-600-400-1.0-agg-reference.png tests/visual_tests/images/image-filters-multi-blur-512-512-1.0-agg-reference.png tests/visual_tests/images/image-filters-multi-blur-512-512-2.0-agg-reference.png tests/visual_tests/images/image-filters-multi-blur-inflate-512-512-1.0-agg-reference.png tests/visual_tests/images/image-filters-multi-blur-inflate-512-512-2.0-agg-reference.png tests/visual_tests/images/lines-1-400-400-2.0-agg-reference.png tests/visual_tests/images/lines-1-600-600-1.0-agg-reference.png tests/visual_tests/images/lines-1-600-600-2.0-agg-reference.png tests/visual_tests/images/lines-2-200-200-1.0-agg-reference.png tests/visual_tests/images/lines-2-400-400-1.0-cairo-reference.png tests/visual_tests/images/lines-2-400-400-2.0-agg-reference.png tests/visual_tests/images/lines-2-600-600-2.0-agg-reference.png tests/visual_tests/images/lines-2-800-800-2.0-agg-reference.png tests/visual_tests/images/lines-3-400-400-2.0-agg-reference.png tests/visual_tests/images/lines-3-600-600-1.0-agg-reference.png tests/visual_tests/images/lines-3-600-600-2.0-agg-reference.png tests/visual_tests/images/lines-5-200-200-1.0-agg-reference.png tests/visual_tests/images/lines-5-200-200-2.0-agg-reference.png tests/visual_tests/images/lines-5-400-400-1.0-agg-reference.png tests/visual_tests/images/lines-5-400-400-2.0-agg-reference.png tests/visual_tests/images/lines-5-600-600-1.0-agg-reference.png tests/visual_tests/images/lines-5-600-600-2.0-agg-reference.png tests/visual_tests/images/lines-5-800-800-1.0-agg-reference.png tests/visual_tests/images/lines-5-800-800-2.0-agg-reference.png tests/visual_tests/images/lines-6-200-200-1.0-agg-reference.png tests/visual_tests/images/lines-6-200-200-2.0-agg-reference.png tests/visual_tests/images/lines-6-400-400-1.0-agg-reference.png tests/visual_tests/images/lines-6-600-600-1.0-agg-reference.png tests/visual_tests/images/lines-6-600-600-2.0-agg-reference.png tests/visual_tests/images/lines-6-800-800-1.0-agg-reference.png tests/visual_tests/images/lines-6-800-800-2.0-agg-reference.png tests/visual_tests/images/lines-shield-600-600-2.0-agg-reference.png tests/visual_tests/images/lines-shield-600-600-2.0-cairo-reference.png tests/visual_tests/images/shield-on-polygon-600-400-1.0-agg-reference.png tests/visual_tests/images/shield-on-polygon-600-400-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-1-490-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-1-495-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-1-495-100-2.0-cairo-reference.png tests/visual_tests/images/shieldsymbolizer-1-497-100-1.0-cairo-reference.png tests/visual_tests/images/shieldsymbolizer-1-497-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-1-497-100-2.0-cairo-reference.png tests/visual_tests/images/shieldsymbolizer-1-498-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-1-499-100-1.0-cairo-reference.png tests/visual_tests/images/shieldsymbolizer-1-499-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-1-499-100-2.0-cairo-reference.png tests/visual_tests/images/shieldsymbolizer-1-500-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-1-501-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-1-502-100-1.0-cairo-reference.png tests/visual_tests/images/shieldsymbolizer-1-502-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-1-505-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-1-505-100-2.0-cairo-reference.png tests/visual_tests/images/shieldsymbolizer-1-510-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-3-490-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-3-495-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-3-497-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-3-498-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-3-499-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-3-500-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-3-501-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-3-502-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-3-505-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-3-510-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-4-490-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-4-495-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-4-497-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-4-498-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-4-499-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-4-500-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-4-501-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-4-502-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-4-505-100-2.0-agg-reference.png tests/visual_tests/images/shieldsymbolizer-4-510-100-2.0-agg-reference.png tests/visual_tests/test.py
2014-04-24 23:50:55 +02:00
regex]
if env['HAS_CAIRO']:
lib_env.Append(LIBS=env['CAIRO_ALL_LIBS'])
# maybe bz2
if len(env['EXTRA_FREETYPE_LIBS']):
lib_env['LIBS'].extend(copy(env['EXTRA_FREETYPE_LIBS']))
lib_env['LIBS'].append('harfbuzz-icu')
if '-DHAVE_PNG' in env['CPPDEFINES']:
lib_env['LIBS'].append('png')
enabled_imaging_libraries.append('png_reader.cpp')
if '-DMAPNIK_USE_PROJ4' in env['CPPDEFINES']:
lib_env['LIBS'].append('proj')
if '-DHAVE_TIFF' in env['CPPDEFINES']:
lib_env['LIBS'].append('tiff')
enabled_imaging_libraries.append('tiff_reader.cpp')
if '-DHAVE_WEBP' in env['CPPDEFINES']:
lib_env['LIBS'].append('webp')
enabled_imaging_libraries.append('webp_reader.cpp')
lib_env['LIBS'].append('xml2')
if '-DBOOST_REGEX_HAS_ICU' in env['CPPDEFINES']:
lib_env['LIBS'].append('icui18n')
lib_env['LIBS'].append(system)
lib_env['LIBS'].append('harfbuzz')
if '-DHAVE_JPEG' in env['CPPDEFINES']:
2013-07-15 06:19:03 +02:00
lib_env['LIBS'].append('jpeg')
enabled_imaging_libraries.append('jpeg_reader.cpp')
2013-07-15 06:19:03 +02:00
lib_env['LIBS'].append(env['ICU_LIB_NAME'])
lib_env['LIBS'].append('freetype')
2011-11-02 23:52:31 +01:00
if env['RUNTIME_LINK'] == 'static':
if env['PLATFORM'] == 'Linux':
lib_env['LINKFLAGS'].append('-pthread')
if 'icuuc' in env['ICU_LIB_NAME']:
lib_env['LIBS'].append('icudata')
if env['RUNTIME_LINK'] != 'static':
lib_env['LIBS'].insert(0, 'agg')
lib_env['LIBS'].append('z')
if env['PLATFORM'] == 'Darwin':
mapnik_libname = env.subst(env['MAPNIK_LIB_NAME'])
if env['FULL_LIB_PATH']:
lib_path = '%s/%s' % (env['MAPNIK_LIB_BASE'],mapnik_libname)
else:
2014-01-22 09:10:11 +01:00
lib_path = '@loader_path/'+mapnik_libname
mapnik_lib_link_flag += ' -Wl,-install_name,%s' % lib_path
_d = {'version':env['MAPNIK_VERSION_STRING'].replace('-pre','')}
mapnik_lib_link_flag += ' -current_version %(version)s -compatibility_version %(version)s' % _d
else: # unix, non-macos
mapnik_libname = env.subst(env['MAPNIK_LIB_NAME'])
if env['ENABLE_SONAME']:
mapnik_libname = env.subst(env['MAPNIK_LIB_NAME']) + (".%d.%d" % (int(ABI_VERSION[0]),int(ABI_VERSION[1])))
if env['PLATFORM'] == 'SunOS':
if env['CXX'].startswith('CC'):
mapnik_lib_link_flag += ' -R. -h %s' % mapnik_libname
else:
mapnik_lib_link_flag += ' -Wl,-h,%s' % mapnik_libname
else: # Linux and others
lib_env['LIBS'].append('dl')
mapnik_lib_link_flag += ' -Wl,-rpath-link,.'
if env['ENABLE_SONAME']:
mapnik_lib_link_flag += ' -Wl,-soname,%s' % mapnik_libname
if env['FULL_LIB_PATH']:
mapnik_lib_link_flag += ' -Wl,-rpath=%s' % env['MAPNIK_LIB_BASE']
else:
mapnik_lib_link_flag += ' -Wl,-z,origin -Wl,-rpath=\$$ORIGIN'
2005-06-14 17:06:59 +02:00
source = Split(
2005-09-08 15:05:39 +02:00
"""
2014-07-26 01:15:18 +02:00
expression_grammar.cpp
fs.cpp
request.cpp
well_known_srs.cpp
params.cpp
image_filter_types.cpp
2012-11-04 13:10:05 +01:00
miniz_png.cpp
color.cpp
conversions.cpp
2012-03-19 23:42:30 +01:00
image_compositing.cpp
image_scaling.cpp
2009-12-16 21:02:06 +01:00
box2d.cpp
datasource_cache.cpp
datasource_cache_static.cpp
debug.cpp
expression_node.cpp
2009-12-16 21:02:06 +01:00
expression_string.cpp
2012-02-12 12:46:07 +01:00
expression.cpp
transform_expression.cpp
2012-01-18 15:17:39 +01:00
feature_kv_iterator.cpp
feature_style_processor.cpp
feature_type_style.cpp
font_engine_freetype.cpp
font_set.cpp
gradient.cpp
2005-06-14 17:06:59 +02:00
graphics.cpp
2014-07-26 01:15:18 +02:00
parse_path.cpp
2005-06-14 17:06:59 +02:00
image_reader.cpp
image_util.cpp
layer.cpp
map.cpp
load_map.cpp
2005-06-14 17:06:59 +02:00
memory.cpp
palette.cpp
2005-06-14 17:06:59 +02:00
plugin.cpp
rule.cpp
save_map.cpp
wkb.cpp
projection.cpp
proj_transform.cpp
scale_denominator.cpp
simplify.cpp
2014-07-26 01:15:18 +02:00
parse_transform.cpp
memory_datasource.cpp
symbolizer.cpp
symbolizer_keys.cpp
2014-07-11 12:53:06 +02:00
symbolizer_enumerations.cpp
2008-01-03 12:41:00 +01:00
unicode.cpp
raster_colorizer.cpp
mapped_memory_cache.cpp
2011-04-26 23:44:52 +02:00
marker_cache.cpp
svg/svg_parser.cpp
svg/svg_path_parser.cpp
svg/svg_points_parser.cpp
svg/svg_transform_parser.cpp
2011-09-16 16:57:40 +02:00
warp.cpp
2014-07-26 01:15:18 +02:00
css_color_grammar.cpp
text/vertex_cache.cpp
text/text_layout.cpp
text/text_line.cpp
text/itemizer.cpp
text/scrptrun.cpp
text/face.cpp
text/placement_finder.cpp
2014-07-21 12:19:26 +02:00
text/properties_util.cpp
text/renderer.cpp
text/symbolizer_helpers.cpp
text/text_properties.cpp
2013-11-08 05:09:22 +01:00
text/formatting/base.cpp
text/formatting/list.cpp
text/formatting/text.cpp
text/formatting/format.cpp
text/formatting/layout.cpp
2013-11-08 05:09:22 +01:00
text/formatting/registry.cpp
text/placements/registry.cpp
text/placements/base.cpp
text/placements/dummy.cpp
text/placements/list.cpp
text/placements/simple.cpp
group/group_layout_manager.cpp
group/group_rule.cpp
group/group_symbolizer_helper.cpp
xml_tree.cpp
2012-03-08 18:51:23 +01:00
config_error.cpp
color_factory.cpp
renderer_common.cpp
renderer_common/render_pattern.cpp
renderer_common/process_group_symbolizer.cpp
"""
2005-06-14 17:06:59 +02:00
)
if env['PLUGIN_LINKING'] == 'static':
2013-05-22 05:18:37 +02:00
hit = False
for plugin in env['REQUESTED_PLUGINS']:
details = env['PLUGINS'][plugin]
if details['lib'] in env['LIBS'] or not details['lib']:
plugin_env = SConscript('../plugins/input/%s/build.py' % plugin)
if not plugin_env:
print("Notice: no 'plugin_env' variable found for plugin: '%s'" % plugin)
else:
hit = True
DEF = '-DMAPNIK_STATIC_PLUGIN_%s' % plugin.upper()
lib_env.Append(CPPDEFINES = DEF)
if DEF not in libmapnik_defines:
libmapnik_defines.append(DEF)
if plugin_env.has_key('SOURCES') and plugin_env['SOURCES']:
source += ['../plugins/input/%s/%s' % (plugin, src) for src in plugin_env['SOURCES']]
if plugin_env.has_key('CPPDEFINES') and plugin_env['CPPDEFINES']:
lib_env.AppendUnique(CPPDEFINES=plugin_env['CPPDEFINES'])
if plugin_env.has_key('CXXFLAGS') and plugin_env['CXXFLAGS']:
lib_env.AppendUnique(CXXFLAGS=plugin_env['CXXFLAGS'])
if plugin_env.has_key('LINKFLAGS') and plugin_env['LINKFLAGS']:
lib_env.AppendUnique(LINKFLAGS=plugin_env['LINKFLAGS'])
if plugin_env.has_key('CPPPATH') and plugin_env['CPPPATH']:
lib_env.AppendUnique(CPPPATH=copy(plugin_env['CPPPATH']))
if plugin_env.has_key('LIBS') and plugin_env['LIBS']:
lib_env.AppendUnique(LIBS=plugin_env['LIBS'])
else:
print("Notice: dependencies not met for plugin '%s', not building..." % plugin)
2013-05-22 05:18:37 +02:00
if hit:
lib_env.Append(CPPDEFINES = '-DMAPNIK_STATIC_PLUGINS')
libmapnik_defines.append('-DMAPNIK_STATIC_PLUGINS')
if env['HAS_CAIRO']:
lib_env.AppendUnique(LIBPATH=env['CAIRO_LIBPATHS'])
lib_env.Append(CPPDEFINES = '-DHAVE_CAIRO')
libmapnik_defines.append('-DHAVE_CAIRO')
lib_env.AppendUnique(CPPPATH=copy(env['CAIRO_CPPPATHS']))
source.append('cairo/cairo_renderer.cpp')
source.append('cairo/cairo_context.cpp')
for cpp in enabled_imaging_libraries:
source.append(cpp)
2011-04-26 23:44:52 +02:00
# agg backend
source += Split(
"""
agg/agg_renderer.cpp
agg/process_building_symbolizer.cpp
agg/process_line_symbolizer.cpp
agg/process_line_pattern_symbolizer.cpp
2010-06-19 23:01:30 +02:00
agg/process_text_symbolizer.cpp
agg/process_point_symbolizer.cpp
agg/process_polygon_symbolizer.cpp
2010-06-20 05:56:03 +02:00
agg/process_polygon_pattern_symbolizer.cpp
agg/process_raster_symbolizer.cpp
agg/process_shield_symbolizer.cpp
agg/process_markers_symbolizer.cpp
agg/process_group_symbolizer.cpp
2012-07-31 23:11:05 +02:00
agg/process_debug_symbolizer.cpp
"""
2011-04-26 23:44:52 +02:00
)
2013-02-19 11:06:59 +01:00
# clipper
source += Split(
"""
../deps/clipper/src/clipper.cpp
""")
if env['RUNTIME_LINK'] == "static":
source += glob.glob('../deps/agg/src/' + '*.cpp')
2011-04-26 23:44:52 +02:00
# grid backend
if env['GRID_RENDERER']:
source += Split(
"""
grid/grid.cpp
grid/grid_renderer.cpp
grid/process_building_symbolizer.cpp
grid/process_line_pattern_symbolizer.cpp
grid/process_line_symbolizer.cpp
grid/process_markers_symbolizer.cpp
grid/process_point_symbolizer.cpp
grid/process_polygon_pattern_symbolizer.cpp
grid/process_polygon_symbolizer.cpp
grid/process_raster_symbolizer.cpp
grid/process_shield_symbolizer.cpp
grid/process_text_symbolizer.cpp
grid/process_group_symbolizer.cpp
""")
lib_env.Append(CPPDEFINES = '-DGRID_RENDERER')
libmapnik_defines.append('-DGRID_RENDERER')
2011-04-26 23:44:52 +02:00
# https://github.com/mapnik/mapnik/issues/1438
if env['SVG_RENDERER']: # svg backend
source += Split(
"""
svg/output/svg_renderer.cpp
svg/output/svg_generator.cpp
svg/output/svg_output_attributes.cpp
svg/output/process_symbolizers.cpp
svg/output/process_building_symbolizer.cpp
svg/output/process_line_pattern_symbolizer.cpp
svg/output/process_line_symbolizer.cpp
svg/output/process_markers_symbolizer.cpp
svg/output/process_point_symbolizer.cpp
svg/output/process_polygon_pattern_symbolizer.cpp
svg/output/process_polygon_symbolizer.cpp
svg/output/process_raster_symbolizer.cpp
svg/output/process_shield_symbolizer.cpp
svg/output/process_text_symbolizer.cpp
svg/output/process_group_symbolizer.cpp
""")
lib_env.Append(CPPDEFINES = '-DSVG_RENDERER')
libmapnik_defines.append('-DSVG_RENDERER')
2010-05-27 13:19:09 +02:00
if env['XMLPARSER'] == 'libxml2' and env['HAS_LIBXML2']:
source += Split(
"""
libxml2_loader.cpp
""")
lib_env.Append(CPPDEFINES = '-DHAVE_LIBXML2')
libmapnik_defines.append('-DHAVE_LIBXML2')
2012-03-13 09:02:53 +01:00
else:
source += Split(
"""
rapidxml_loader.cpp
"""
)
# clone the env one more time to isolate mapnik_lib_link_flag
lib_env_final = lib_env.Clone()
lib_env_final.Prepend(LINKFLAGS=mapnik_lib_link_flag)
# cache library values for other builds to use
env['LIBMAPNIK_LIBS'] = copy(lib_env['LIBS'])
env['LIBMAPNIK_LINKFLAGS'] = copy(lib_env['LINKFLAGS'])
env['LIBMAPNIK_CXXFLAGS'] = libmapnik_cxxflags
env['LIBMAPNIK_DEFINES'] = libmapnik_defines
mapnik = None
if env['PLATFORM'] == 'Darwin' or not env['ENABLE_SONAME']:
target_path = env['MAPNIK_LIB_BASE_DEST']
if 'uninstall' not in COMMAND_LINE_TARGETS:
if env['LINKING'] == 'static':
mapnik = lib_env_final.StaticLibrary(env['MAPNIK_NAME'], source)
else:
mapnik = lib_env_final.SharedLibrary(env['MAPNIK_NAME'], source)
result = env.Install(target_path, mapnik)
env.Alias(target='install', source=result)
env['create_uninstall_target'](env, os.path.join(target_path,env.subst(env['MAPNIK_LIB_NAME'])))
else:
# Symlink command, only works if both files are in same directory
def symlink(env, target, source):
trgt = str(target[0])
src = str(source[0])
if os.path.islink(trgt) or os.path.exists(trgt):
os.remove(trgt)
os.symlink(os.path.basename(src), trgt)
major, minor, micro = ABI_VERSION
soFile = "%s.%d.%d.%d" % (os.path.basename(env.subst(env['MAPNIK_LIB_NAME'])), int(major), int(minor), int(micro))
target = os.path.join(env['MAPNIK_LIB_BASE_DEST'], soFile)
if 'uninstall' not in COMMAND_LINE_TARGETS:
if env['LINKING'] == 'static':
mapnik = lib_env_final.StaticLibrary(env['MAPNIK_NAME'], source)
else:
mapnik = lib_env_final.SharedLibrary(env['MAPNIK_NAME'], source)
result = env.InstallAs(target=target, source=mapnik)
env.Alias(target='install', source=result)
if result:
env.AddPostAction(result, ldconfig)
# Install symlinks
target1 = os.path.join(env['MAPNIK_LIB_BASE_DEST'], "%s.%d.%d" % \
2012-04-23 20:33:59 +02:00
(os.path.basename(env.subst(env['MAPNIK_LIB_NAME'])),int(major), int(minor)))
target2 = os.path.join(env['MAPNIK_LIB_BASE_DEST'], os.path.basename(env.subst(env['MAPNIK_LIB_NAME'])))
if 'uninstall' not in COMMAND_LINE_TARGETS:
link1 = env.Command(target1, target, symlink)
env.Alias(target='install', source=link1)
link2 = env.Command(target2, target1, symlink)
env.Alias(target='install', source=link2)
# delete in reverse order..
env['create_uninstall_target'](env, target2)
env['create_uninstall_target'](env, target1)
env['create_uninstall_target'](env, target)
# to enable local testing
lib_major_minor = "%s.%d.%d" % (os.path.basename(env.subst(env['MAPNIK_LIB_NAME'])), int(major), int(minor))
local_lib = os.path.basename(env.subst(env['MAPNIK_LIB_NAME']))
if os.path.islink(lib_major_minor) or os.path.exists(lib_major_minor):
os.remove(lib_major_minor)
os.symlink(local_lib,lib_major_minor)
Clean(mapnik,lib_major_minor);
if not env['RUNTIME_LINK'] == 'static':
Depends(mapnik, env.subst('../deps/agg/libagg.a'))