From adef5b5b6a26582d6c51c64a2194a6457fd94892 Mon Sep 17 00:00:00 2001
From: jdh8d <jdh8d@git.zephyr-software.com>
Date: Tue, 1 Sep 2015 23:51:21 +0000
Subject: [PATCH] changes to build scripts to support solaris, the main problem
 being that pebliss won't compile nicely on solaris.  deprecating
 pebliss/windows support on solaris host.

Former-commit-id: 267b84f37e32a42cded916540287475743600868
---
 SConscript                  | 12 ++++++++----
 SConstruct                  | 11 +++++++----
 libEXEIO/include/exeio_pe.h |  8 +++++---
 libEXEIO/src/exeio_src.cpp  | 12 +++++++++---
 4 files changed, 29 insertions(+), 14 deletions(-)

diff --git a/SConscript b/SConscript
index fcb438d65..4c3b86e71 100644
--- a/SConscript
+++ b/SConscript
@@ -58,17 +58,21 @@ else:
 
 
 
-# setup libraries needed for linking
-env['BASE_IRDB_LIBS']="IRDB-core", "pqxx", "pq", "BeaEngine_s_d", "EXEIO", "pebliss"
+env['BASE_IRDB_LIBS']="IRDB-core", "pqxx", "pq", "BeaEngine_s_d", "EXEIO"
+
+if sysname != "SunOS":
+	libPEBLISS=SConscript("pebliss/trunk/pe_lib/SConscript", variant_dir='scons_build/libPEBLISS')
+	# setup libraries needed for linking
+	env['BASE_IRDB_LIBS']="IRDB-core", "pqxx", "pq", "BeaEngine_s_d", "EXEIO", "pebliss"
 
 # pebliss requires iconv, which needs to be explicit on cygwin.
 if "CYGWIN" in sysname:
 	# add tuple of 1 item!
 	env['BASE_IRDB_LIBS']=env['BASE_IRDB_LIBS']+("iconv",)
 
-
 Export('env')
-libPEBLISS=SConscript("pebliss/trunk/pe_lib/SConscript", variant_dir='scons_build/libPEBLISS')
+
+
 libEXEIO=SConscript("libEXEIO/SConscript", variant_dir='scons_build/libEXEIO')
 libbea=SConscript("beaengine/SConscript", variant_dir='scons_build/beaengine')
 libMEDSannotation=SConscript("libMEDSannotation/SConscript", variant_dir='scons_build/libMEDSannotation')
diff --git a/SConstruct b/SConstruct
index 01a1765f7..3aed6cd6b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -2,8 +2,12 @@ import os
 import sys
 
 
+
+(sysname, nodename, release, version, machine)=os.uname()
+
 env=Environment()
 
+
 # default build options
 env.Replace(CFLAGS="-fPIC -w ")
 env.Replace(CXXFLAGS="-fPIC -w ")
@@ -60,11 +64,10 @@ else:
 
 
 # add extra flag for solaris.
-(sysname, nodename, release, version, machine)=os.uname()
 if sysname == "SunOS":
-        env.Append(LINKFLAGS=" -L/opt/csw/lib ")
-        env.Append(CFLAGS=" -I/opt/csw/include ")
-        env.Append(CXXFLAGS=" -I/opt/csw/include ")
+        env.Append(LINKFLAGS=" -L/opt/csw/lib -DSOLARIS  ")
+        env.Append(CFLAGS=" -I/opt/csw/include -DSOLARIS ")
+        env.Append(CXXFLAGS=" -I/opt/csw/include -DSOLARIS  ")
 
 
 Export('env')
diff --git a/libEXEIO/include/exeio_pe.h b/libEXEIO/include/exeio_pe.h
index cc496d6ec..d67967df0 100644
--- a/libEXEIO/include/exeio_pe.h
+++ b/libEXEIO/include/exeio_pe.h
@@ -1,6 +1,7 @@
 #ifndef EXEIO_PE_H
 #define EXEIO_PE_H
 
+#ifndef SOLARIS
 #include <iostream>
 #include <vector>
 #include <assert.h>
@@ -17,7 +18,8 @@ namespace EXEIO
 	class exeio_pe_section_t : public exeio_section_t
 	{
 		public:
-			exeio_pe_section_t(const pe_bliss::section *the_s, const pe_bliss::pe_base *the_b) : s(the_s),b(the_b) { assert(s); assert(b);}
+			exeio_pe_section_t(const pe_bliss::section *the_s, const pe_bliss::pe_base *the_b) 
+				: s(the_s),b(the_b) { assert(s); assert(b);}
 
 			bool isLoadable() const { return s->readable(); }
 			bool isExecutable() const { return s->executable(); }
@@ -144,5 +146,5 @@ namespace EXEIO
 	
 
 }
-
-#endif
+#endif // solaris
+#endif // exeio_pe_h
diff --git a/libEXEIO/src/exeio_src.cpp b/libEXEIO/src/exeio_src.cpp
index c5a2f5bde..605c59edf 100644
--- a/libEXEIO/src/exeio_src.cpp
+++ b/libEXEIO/src/exeio_src.cpp
@@ -8,8 +8,10 @@
 
 
 using namespace EXEIO;
-using namespace pe_bliss;
 using namespace std;
+#ifndef SOLARIS
+using namespace pe_bliss;
+#endif
 
 void exeio::load(char* filename)
 {
@@ -34,10 +36,14 @@ void exeio::load(char* filename)
 	{
 		backend=new exeio_elf_backend_t;
 	}
-	// we assume it's ELF or PE.
-	// we assume it's ELF or PE.
 	else
+#ifndef SOLARIS
+		// we assume it's PE.
 		backend=new exeio_pe_backend_t;
+#else
+		// don't build win support on solaris.
+		assert(0);
+#endif
 
 	backend->load(this, filename);
 
-- 
GitLab