From 21238bb152541591edac630cc14166aabd6d949d Mon Sep 17 00:00:00 2001
From: jdh8d <jdh8d@git.zephyr-software.com>
Date: Thu, 4 Jun 2015 22:15:43 +0000
Subject: [PATCH] Updates to build with -std=c++1x

Former-commit-id: fdf95593a96612edf5fe393c4d116f39503816d4
---
 SConscript            | 20 ++++++++++++--------
 SConstruct            | 22 +++++++++++++---------
 beaengine/SConscript  |  4 ++++
 xform/constant_hash.h |  2 +-
 4 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/SConscript b/SConscript
index a515844f5..87df81f46 100644
--- a/SConscript
+++ b/SConscript
@@ -5,24 +5,28 @@ import tarfile
 Import('env')
 
 if env.GetOption('clean'):
-    if os.path.exists("third_party/ELFIO"):
-    	shutil.rmtree("third_party/ELFIO")
-    if os.path.exists("include/elfio"):
-    	shutil.rmtree("include/elfio")
+    if os.path.exists(os.environ['SECURITY_TRANSFORMS_HOME']+"/third_party/ELFIO"):
+	print 'Removing third_party/ELFIO'
+    	shutil.rmtree(os.environ['SECURITY_TRANSFORMS_HOME']+"/third_party/ELFIO")
+    if os.path.exists(os.environ['SECURITY_TRANSFORMS_HOME']+"/include/elfio"):
+	print 'Removing include/elfio'
+    	shutil.rmtree(os.environ['SECURITY_TRANSFORMS_HOME']+"/include/elfio")
 else:
-    ELFIO_DIR="third_party/ELFIO/"
+    ELFIO_DIR=os.environ['SECURITY_TRANSFORMS_HOME']+"/third_party/ELFIO/"
     if not os.path.exists(ELFIO_DIR):
         os.makedirs(ELFIO_DIR)     # make directory 
-        tgz=tarfile.open("third_party/elfio-2.2.tar.gz", "r:gz")
+        tgz=tarfile.open(os.environ['SECURITY_TRANSFORMS_HOME']+"/third_party/elfio-2.2.tar.gz", "r:gz")
 	print 'Extracting elfio tarball'
 	tgz.list(verbose=False)
         tgz.extractall(ELFIO_DIR)
-    	shutil.copytree(ELFIO_DIR+"elfio-2.2/elfio", "include/elfio")
-	shutil.copy("third_party/elfio.hpp", "include/elfio/elfio.hpp")
+    	shutil.copytree(ELFIO_DIR+"elfio-2.2/elfio", os.environ['SECURITY_TRANSFORMS_HOME']+"/include/elfio")
+	shutil.copy(os.environ['SECURITY_TRANSFORMS_HOME']+"/third_party/elfio.hpp", os.environ['SECURITY_TRANSFORMS_HOME']+"/include/elfio/elfio.hpp")
     else:
         assert os.path.isdir(ELFIO_DIR)
 
 
+print 'env='
+print env.Dump()
 libbea=SConscript("beaengine/SConscript", variant_dir='scons_build/beaengine')
 libMEDSannotation=SConscript("libMEDSannotation/SConscript", variant_dir='scons_build/libMEDSannotation')
 libxform=SConscript("xform/SConscript", variant_dir='scons_build/libxform')
diff --git a/SConstruct b/SConstruct
index 75d708e91..7fc65b6fd 100644
--- a/SConstruct
+++ b/SConstruct
@@ -5,9 +5,9 @@ import sys
 env=Environment()
 
 # default build options
-env.Replace(CFLAGS="-fPIC")
-env.Replace(CCFLAGS="-fPIC")
-env.Replace(LDFLAGS="-fPIC")
+env.Replace(CFLAGS="-fPIC -w ")
+env.Replace(CXXFLAGS="-fPIC -w ")
+env.Replace(LINKFLAGS="-fPIC -w ")
 
 # parse arguments
 env.Replace(SECURITY_TRANSFORMS_HOME=os.environ['SECURITY_TRANSFORMS_HOME'])
@@ -18,11 +18,13 @@ env.Replace(debug=ARGUMENTS.get("debug",0))
 if int(env['debug']) == 1:
         print "Setting debug mode"
         env.Append(CFLAGS=" -g")
-        env.Append(CCFLAGS=" -g")
+        env.Append(CXXFLAGS=" -g")
+        env.Append(LINKFLAGS=" -g")
 else:
         print "Setting release mode"
         env.Append(CFLAGS=" -O3")
-        env.Append(CCFLAGS=" -O3")
+        env.Append(CXXFLAGS=" -O3")
+        env.Append(LINKFLAGS=" -O3")
 
 # set 32/64 bit build properly
 print  "env[64bit]="+str(env['do_64bit_build'])
@@ -31,13 +33,15 @@ if env['do_64bit_build'] is None:
 elif int(env['do_64bit_build']) == 1:
 	print 'Using 64-bit compilation size.'
         env.Append(CFLAGS=" -m64")
-        env.Append(CCFLAGS=" -m64")
-        env.Append(LDFLAGS=" -m64")
+        env.Append(CXXFLAGS=" -m64")
+        env.Append(LINKFLAGS=" -m64")
+        env.Append(SHLINKFLAGS=" -m64")
 else:
 	print 'Using 32-bit compilation size.'
         env.Append(CFLAGS=" -m32")
-        env.Append(CCFLAGS=" -m32")
-        env.Append(LDFLAGS=" -m32")
+        env.Append(CXXFLAGS=" -m32")
+        env.Append(LINKFLAGS=" -m32")
+        env.Append(SHLINKFLAGS=" -m32")
 
 
 Export('env')
diff --git a/beaengine/SConscript b/beaengine/SConscript
index bc9912977..a8d8b9647 100644
--- a/beaengine/SConscript
+++ b/beaengine/SConscript
@@ -12,6 +12,10 @@ cpppath='''
 	./include/
 	./beaengineSources/Includes/
 	'''
+
+#print 'myenv[cflags]='+str(myenv['CFLAGS'])
+#print 'myenv=\n'
+#print myenv.Dump()
 myenv=myenv.Clone(CPPPATH=Split(cpppath))
 lib=myenv.Library("BeaEngine_s_d", Split(files))
 
diff --git a/xform/constant_hash.h b/xform/constant_hash.h
index 562726e19..b439b9f86 100644
--- a/xform/constant_hash.h
+++ b/xform/constant_hash.h
@@ -33,7 +33,7 @@ typedef enum constant_hash_field constant_hash_field_t;
 extern Hashtable *constants_hash;
 struct constant_hash_key
 {
-        int pc;
+        app_iaddr_t pc;
         int the_const;
 	constant_hash_field_t field;
 };
-- 
GitLab