From 27cc2f0dc581087826573f7215bea077cc57f73a Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Sat, 2 Apr 2011 03:11:42 +0000 Subject: [PATCH] catch errors in build time pkg-config parsing - closes #738 --- SConstruct | 2 +- src/SConscript | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/SConstruct b/SConstruct index 215f774d8..ad56a9cea 100644 --- a/SConstruct +++ b/SConstruct @@ -281,7 +281,7 @@ opts.AddVariables( ('CC', 'The C compiler used for configure checks of C libs (defaults to gcc).', 'gcc'), ('CUSTOM_CXXFLAGS', 'Custom C++ flags, e.g. -I if you have headers in a nonstandard directory ', ''), ('CUSTOM_LDFLAGS', 'Custom linker flags, e.g. -L if you have libraries in a nonstandard directory ', ''), - EnumVariable('OPTIMIZATION','Set g++ optimization level','2', ['0','1','2','3','4']), + EnumVariable('OPTIMIZATION','Set g++ optimization level','2', ['0','1','2','3','4','s']), # Note: setting DEBUG=True will override any custom OPTIMIZATION level BoolVariable('DEBUG', 'Compile a debug version of Mapnik', 'False'), BoolVariable('XML_DEBUG', 'Compile a XML verbose debug version of mapnik', 'False'), diff --git a/src/SConscript b/src/SConscript index 4c83a6603..813d9b777 100644 --- a/src/SConscript +++ b/src/SConscript @@ -21,6 +21,7 @@ import os +import sys import glob from subprocess import Popen, PIPE @@ -185,16 +186,20 @@ if True : # agg backend if env['HAS_CAIRO']: # attach libs to library linking environment - lib_env.ParseConfig('pkg-config --libs cairomm-1.0') - env2 = lib_env.Clone() - env2.Append(CXXFLAGS = '-DHAVE_CAIRO') - # attach cflags to specific compile environment - env2.ParseConfig('pkg-config --cflags cairomm-1.0') - fixup = ['cairo_renderer.cpp','graphics.cpp','image_util.cpp'] - for cpp in fixup: - if cpp in source: - source.remove(cpp) - source.insert(0,env2.SharedObject(cpp)) + try: + lib_env.ParseConfig('pkg-config --libs cairomm-1.0') + env2 = lib_env.Clone() + env2.Append(CXXFLAGS = '-DHAVE_CAIRO') + # attach cflags to specific compile environment + env2.ParseConfig('pkg-config --cflags cairomm-1.0') + fixup = ['cairo_renderer.cpp','graphics.cpp','image_util.cpp'] + for cpp in fixup: + if cpp in source: + source.remove(cpp) + source.insert(0,env2.SharedObject(cpp)) + except OSError, e: + print '\nFailed to detect cairo/cairomm configuration, please re-run "python scons/scons.py configure"' + sys.exit(1) if env['XMLPARSER'] == 'tinyxml': source += Split(