From e0db6b9a474f0e0d89433229e45e6999d0bf0f61 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sat, 18 Mar 2017 19:40:18 -0700 Subject: [PATCH] consistently use pkg-config in both postgis plugin and pgsql2sqlite + use GDAL_CONFIG var in plugins --- plugins/input/gdal/build.py | 2 +- plugins/input/ogr/build.py | 2 +- utils/pgsql2sqlite/build.py | 25 +++++++++++++++---------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/plugins/input/gdal/build.py b/plugins/input/gdal/build.py index 0db10c208..4dc631dde 100644 --- a/plugins/input/gdal/build.py +++ b/plugins/input/gdal/build.py @@ -38,7 +38,7 @@ plugin_env['LIBS'] = [] plugin_env.Append(LIBS=env['PLUGINS']['gdal']['lib']) if env['RUNTIME_LINK'] == 'static': - cmd = 'gdal-config --dep-libs' + cmd = '%s --dep-libs' % plugin_env['GDAL_CONFIG'] plugin_env.ParseConfig(cmd) # Link Library to Dependencies diff --git a/plugins/input/ogr/build.py b/plugins/input/ogr/build.py index 143289d69..1681d0b4d 100644 --- a/plugins/input/ogr/build.py +++ b/plugins/input/ogr/build.py @@ -42,7 +42,7 @@ plugin_env['LIBS'] = [] plugin_env.Append(LIBS=env['PLUGINS']['ogr']['lib']) if env['RUNTIME_LINK'] == 'static': - cmd = 'gdal-config --dep-libs' + cmd = '%s --dep-libs' % plugin_env['GDAL_CONFIG'] plugin_env.ParseConfig(cmd) # Link Library to Dependencies diff --git a/utils/pgsql2sqlite/build.py b/utils/pgsql2sqlite/build.py index 45d90035b..3dac9003a 100644 --- a/utils/pgsql2sqlite/build.py +++ b/utils/pgsql2sqlite/build.py @@ -39,6 +39,20 @@ source = Split( program_env['CXXFLAGS'] = copy(env['LIBMAPNIK_CXXFLAGS']) program_env['LINKFLAGS'] = copy(env['LIBMAPNIK_LINKFLAGS']) 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']: program_env.PrependUnique(CPPPATH=env['CAIRO_CPPPATHS']) @@ -46,9 +60,8 @@ if env['HAS_CAIRO']: program_env.PrependUnique(CPPPATH=['#plugins/input/postgis']) -libraries = [] 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'): 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']: 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) Depends(pgsql2sqlite, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME']))