consistently use pkg-config in both postgis plugin and pgsql2sqlite + use GDAL_CONFIG var in plugins

This commit is contained in:
Dane Springmeyer 2017-03-18 19:40:18 -07:00
parent 1be4696d52
commit 641d7b647f
3 changed files with 17 additions and 12 deletions

View file

@ -38,7 +38,7 @@ plugin_env['LIBS'] = []
plugin_env.Append(LIBS=env['PLUGINS']['gdal']['lib']) plugin_env.Append(LIBS=env['PLUGINS']['gdal']['lib'])
if env['RUNTIME_LINK'] == 'static': if env['RUNTIME_LINK'] == 'static':
cmd = 'gdal-config --dep-libs' cmd = '%s --dep-libs' % plugin_env['GDAL_CONFIG']
plugin_env.ParseConfig(cmd) plugin_env.ParseConfig(cmd)
# Link Library to Dependencies # Link Library to Dependencies

View file

@ -42,7 +42,7 @@ plugin_env['LIBS'] = []
plugin_env.Append(LIBS=env['PLUGINS']['ogr']['lib']) plugin_env.Append(LIBS=env['PLUGINS']['ogr']['lib'])
if env['RUNTIME_LINK'] == 'static': if env['RUNTIME_LINK'] == 'static':
cmd = 'gdal-config --dep-libs' cmd = '%s --dep-libs' % plugin_env['GDAL_CONFIG']
plugin_env.ParseConfig(cmd) plugin_env.ParseConfig(cmd)
# Link Library to Dependencies # Link Library to Dependencies

View file

@ -39,6 +39,20 @@ source = Split(
program_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS']) program_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS'])
program_env['LINKFLAGS'] = copy(env['LIBMAPNIK_LINKFLAGS']) program_env['LINKFLAGS'] = copy(env['LIBMAPNIK_LINKFLAGS'])
program_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES']) program_env.Append(CPPDEFINES = env['LIBMAPNIK_DEFINES'])
program_env['LIBS'] = []
if env['RUNTIME_LINK'] == 'static':
# pkg-config is more reliable than pg_config across platforms
cmd = 'pkg-config libpq --libs --static'
try:
program_env.ParseConfig(cmd)
except OSError, e:
program_env.Append(LIBS='pq')
else:
program_env.Append(LIBS='pq')
# Link Library to Dependencies
libraries = copy(program_env['LIBS'])
if env['HAS_CAIRO']: if env['HAS_CAIRO']:
program_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS']) program_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS'])
@ -46,9 +60,8 @@ if env['HAS_CAIRO']:
program_env.PrependUnique(CPPPATH=['#plugins/input/postgis']) program_env.PrependUnique(CPPPATH=['#plugins/input/postgis'])
libraries = []
boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND'] boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND']
libraries.extend([boost_program_options,'sqlite3','pq',env['MAPNIK_NAME'],'icuuc']) libraries.extend([boost_program_options,'sqlite3',env['MAPNIK_NAME'],'icuuc'])
if env.get('BOOST_LIB_VERSION_FROM_HEADER'): if env.get('BOOST_LIB_VERSION_FROM_HEADER'):
boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1]) boost_version_from_header = int(env['BOOST_LIB_VERSION_FROM_HEADER'].split('_')[1])
@ -59,14 +72,6 @@ if env.get('BOOST_LIB_VERSION_FROM_HEADER'):
if env['SQLITE_LINKFLAGS']: if env['SQLITE_LINKFLAGS']:
program_env.Append(LINKFLAGS=env['SQLITE_LINKFLAGS']) program_env.Append(LINKFLAGS=env['SQLITE_LINKFLAGS'])
if env['RUNTIME_LINK'] == 'static':
if env['PLATFORM'] == 'Darwin':
libraries.extend(['ldap', 'pam', 'ssl', 'crypto', 'krb5'])
else:
# TODO - parse back into libraries variable
program_env.ParseConfig('pg_config --libs')
libraries.append('dl')
pgsql2sqlite = program_env.Program('pgsql2sqlite', source, LIBS=libraries) pgsql2sqlite = program_env.Program('pgsql2sqlite', source, LIBS=libraries)
Depends(pgsql2sqlite, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME'])) Depends(pgsql2sqlite, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))