]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Fix mod_mongo build when no CFLAGS/CXXFLAGS are set in environment
authorTravis Cross <tc@traviscross.com>
Thu, 3 Jan 2013 17:38:28 +0000 (17:38 +0000)
committerTravis Cross <tc@traviscross.com>
Thu, 3 Jan 2013 17:38:28 +0000 (17:38 +0000)
os.environ['CFLAGS'] raises a KeyError if no CFLAGS variable is set in
the environment.  So instead we use os.environ.get('CFLAGS','') which
will return the empty string in the event no CFLAGS variable is set.

The previous problematic pattern originated from the suggested code
here for importing the build environment in SCons:

  http://www.scons.org/wiki/FrequentlyAskedQuestions#Why_doesn.27t_SCons_find_my_compiler.2BAC8-linker.2BAC8-etc..3F_I_can_execute_it_just_fine_from_the_command_line.

FS-4746 --resolve

src/mod/applications/mod_mongo/Makefile

index cdab0466be4140494fa02d3855403e9adf7f9a5f..9ce16b1171e84284fb7ac43a56358476704e3876 100644 (file)
@@ -25,8 +25,8 @@ $(MONGO_CXX_DRIVER_SRC):
 
 $(LIBMONGOCLIENT_A): $(MONGO_CXX_DRIVER_SRC)
        (cd $(MONGO_CXX_DRIVER_SRC) && \
-               sed -i SConstruct -e "s/Environment()/Environment(ENV = {'PATH' : os.environ['PATH'],'CFLAGS' : os.environ['CFLAGS'],'CXXFLAGS' : os.environ['CXXFLAGS']})/" && \
-               echo "env.Append(PATH=os.environ['PATH'])" >> SConstruct && \
+               sed -i SConstruct -e "s|Environment()|Environment(ENV = {'PATH' : os.environ.get('PATH','/bin:/usr/bin'),'CFLAGS' : os.environ.get('CFLAGS',''),'CXXFLAGS' : os.environ.get('CXXFLAGS','')})|" && \
+               echo "env.Append(PATH=os.environ.get('PATH','/bin:/usr/bin'))" >> SConstruct && \
                scons)
        $(TOUCH_TARGET)