Merge branch 'devel_anabatic' of ssh://bop.soc.lip6.fr/users/largo2/git/coriolis into devel_anabatic

This commit is contained in:
EricLaoGitHub 2017-04-18 11:59:29 +02:00
commit 3d919ef7b0
3 changed files with 115 additions and 89 deletions

View File

@ -23,59 +23,61 @@
OUTPUT_VARIABLE LD_MESSAGE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(REGEX REPLACE "GNU ld version ([^ ]+) .*" "\\1" BINUTILS_VERSION ${LD_MESSAGE} )
message("-- Using system specific BFD library: " ${BINUTILS_VERSION})
if(RETURN_CODE EQUAL 0)
string(REGEX REPLACE "GNU ld version ([^ ]+) .*" "\\1" BINUTILS_VERSION ${LD_MESSAGE} )
message("-- Using system specific BFD library: " ${BINUTILS_VERSION})
find_path(LIBBFD_INCLUDE_DIRS NAMES bfd.h
dis-asm.h
PATHS /usr/include
/usr/local/include
/opt/local/include
/opt/include
ENV CPATH)
find_path(LIBBFD_INCLUDE_DIRS NAMES bfd.h
dis-asm.h
PATHS /usr/include
/usr/local/include
/opt/local/include
/opt/include
ENV CPATH)
# Ugly, yes ugly...
find_library(LIBBFD_BFD_LIBRARY NAMES bfd-${BINUTILS_VERSION}
PATHS /usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/usr/include
/opt/local/lib
/opt/usr/lib64
ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH)
#find_library (LIBBFD_IBERTY_LIBRARY NAMES iberty
# PATHS /usr/lib
# /usr/lib64
# /usr/local/lib
# /usr/local/lib64
# /usr/include
# /opt/local/lib
# /opt/usr/lib64
# ENV LIBRARY_PATH
# ENV LD_LIBRARY_PATH)
#find_library (LIBBFD_OPCODES_LIBRARY NAMES opcodes
# PATHS /usr/lib
# /usr/lib64
# /usr/local/lib
# /usr/local/lib64
# /usr/include
# /opt/local/lib
# /opt/usr/lib64
# ENV LIBRARY_PATH
# ENV LD_LIBRARY_PATH)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBBFD DEFAULT_MSG
LIBBFD_BFD_LIBRARY
# LIBBFD_IBERTY_LIBRARY
# LIBBFD_OPCODES_LIBRARY
LIBBFD_INCLUDE_DIRS)
# Ugly, yes ugly...
find_library(LIBBFD_BFD_LIBRARY NAMES bfd-${BINUTILS_VERSION} bfd
PATHS /usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64
/usr/include
/opt/local/lib
/opt/usr/lib64
ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH)
#find_library (LIBBFD_IBERTY_LIBRARY NAMES iberty
# PATHS /usr/lib
# /usr/lib64
# /usr/local/lib
# /usr/local/lib64
# /usr/include
# /opt/local/lib
# /opt/usr/lib64
# ENV LIBRARY_PATH
# ENV LD_LIBRARY_PATH)
#find_library (LIBBFD_OPCODES_LIBRARY NAMES opcodes
# PATHS /usr/lib
# /usr/lib64
# /usr/local/lib
# /usr/local/lib64
# /usr/include
# /opt/local/lib
# /opt/usr/lib64
# ENV LIBRARY_PATH
# ENV LD_LIBRARY_PATH)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBBFD DEFAULT_MSG
LIBBFD_BFD_LIBRARY
# LIBBFD_IBERTY_LIBRARY
# LIBBFD_OPCODES_LIBRARY
LIBBFD_INCLUDE_DIRS)
endif()
if(LIBBFD_FOUND)
add_definitions(-DHAVE_LIBBFD)
endif()

View File

@ -9,26 +9,35 @@ import subprocess
import optparse
coriolisPattern = re.compile ( r".*coriolis.*" )
reCoriolisPattern = re.compile( r".*coriolis.*" )
reReleaseSharedPattern = re.compile( r".*Release\.Shared.*" )
reReleaseStaticPattern = re.compile( r".*Release\.Static.*" )
reDebugSharedPattern = re.compile( r".*Debug\.Shared.*" )
reDebugStaticPattern = re.compile( r".*Debug\.Static.*" )
def stripPath ( pathName ):
pathEnv = os.getenv ( pathName )
def scrubPath ( pathName ):
pathEnv = os.getenv( pathName )
if not pathEnv: return ""
pathList = string.split ( pathEnv, ':' )
strippedList = []
pathList = string.split( pathEnv, ':' )
scrubbedList = []
for pathElement in pathList:
if not coriolisPattern.match(pathElement):
strippedList += [ pathElement ]
if reCoriolisPattern .match(pathElement) \
or reReleaseSharedPattern.match(pathElement) \
or reReleaseStaticPattern.match(pathElement) \
or reDebugSharedPattern .match(pathElement) \
or reDebugStaticPattern .match(pathElement):
continue
scrubbedList += [ pathElement ]
if len(strippedList) == 0: return ""
if len(scrubbedList) == 0: return ""
strippedEnv = strippedList[0]
for pathElement in strippedList[1:]:
strippedEnv += ":" + pathElement
scrubbedEnv = scrubbedList[0]
for pathElement in scrubbedList[1:]:
scrubbedEnv += ":" + pathElement
return strippedEnv
return scrubbedEnv
def guessOs ():
@ -131,25 +140,31 @@ def guessOs ():
return (osType,libDir,useDevtoolset2)
def guessCsh ():
cshBins = [ '/usr/bin/tcsh'
, '/bin/tcsh'
, '/usr/pkg/bin/tcsh'
, '/usr/bin/csh'
, '/bin/csh'
, '/usr/pkg/bin/csh'
]
for cshBin in cshBins:
if os.path.isfile(cshBin): return cshBin
return None
def guessShell ():
if os.environ.has_key('SHELL'): return os.environ['SHELL']
# This environement variable cannot be trusted as it is set once when
# the user logs in. If aftewards it changes it that variable is *not*
# affected :-(.
#if os.environ.has_key('SHELL'): return os.environ['SHELL']
# If SHELL is not set, it is likely we are under C-Shell variant.
# Look for standard places where the binaries are expecteds.
return guessCsh()
psCommand = subprocess.Popen ( ['ps', '-p', str(os.getppid()) ], stdout=subprocess.PIPE )
shell = psCommand.stdout.readlines()[1][:-1].split()[-1]
whichCommand = subprocess.Popen ( ['which', shell ], stdout=subprocess.PIPE )
shellPath = whichCommand.stdout.readlines()[0][:-1]
isBourneShell = True
cshBins = [ '/usr/bin/tcsh'
, '/bin/tcsh'
, '/usr/pkg/bin/tcsh'
, '/usr/local/bin/tcsh'
, '/usr/bin/csh'
, '/bin/csh'
, '/usr/pkg/bin/csh'
, '/usr/local/bin/csh'
]
if shellPath in cshBins: isBourneShell = False
#print 'GUESSED SHELL: "%s"' % shellPath
return shellPath, isBourneShell
@ -159,13 +174,12 @@ if __name__ == "__main__":
buildType = "Release"
linkType = "Shared"
rootDir = None
shellBin = guessShell()
shellBin, isBourneShell = guessShell()
parser = optparse.OptionParser ()
# Build relateds.
parser.add_option ( "--query-inst-root", action="store_true" , dest="queryInstRoot" )
parser.add_option ( "--query-isys-root", action="store_true" , dest="queryISysRoot" )
parser.add_option ( "--csh" , action="store_true" , dest="csh" )
parser.add_option ( "--release" , action="store_true" , dest="release" )
parser.add_option ( "--debug" , action="store_true" , dest="debug" )
parser.add_option ( "--devel" , action="store_true" , dest="devel" )
@ -176,7 +190,6 @@ if __name__ == "__main__":
parser.add_option ( "--root" , action="store" , type="string", dest="rootDir" )
( options, args ) = parser.parse_args ()
if options.csh: shellBin = guessCsh()
if options.release: buildType = "Release"
if options.debug: buildType = "Debug"
if options.devel: buildType = "Debug"
@ -184,13 +197,16 @@ if __name__ == "__main__":
if options.shared: linkType = "Shared"
if options.rootDir: rootDir = options.rootDir
scriptPath = os.path.abspath(os.path.dirname(sys.argv[0]))
if 'Debug.' in scriptPath: buildType = 'Debug'
if not shellBin:
print 'echo "[ERROR] coriolisEnv.py was not able to guess/find the current shell interpeter."'
sys.exit( 1 )
strippedPath = stripPath ( "PATH" )
strippedLibraryPath = stripPath ( "LD_LIBRARY_PATH" )
strippedPythonPath = stripPath ( "PYTHONPATH" )
strippedPath = scrubPath( "PATH" )
strippedLibraryPath = scrubPath( "LD_LIBRARY_PATH" )
strippedPythonPath = scrubPath( "PYTHONPATH" )
shellScriptSh = \
'echo "%(MESSAGE)s";' \
@ -246,6 +262,10 @@ if __name__ == "__main__":
strippedPath = "%s/bin:%s" % ( coriolisTop, strippedPath )
strippedLibraryPath = "%s:%s" % ( absLibDir , strippedLibraryPath )
if not os.path.exists(coriolisTop):
print 'echo "[ERROR] coriolisEnv.py, top directory <%s> do not exists."' % coriolisTop
sys.exit( 1 )
if not options.nopython:
pyVersion = sys.version_info
version = "%d.%d" % (pyVersion[0],pyVersion[1])
@ -281,11 +301,13 @@ if __name__ == "__main__":
shellScriptSh += "hash -r;"
shellScriptCsh += "rehash;"
if options.csh: shellScript = shellScriptCsh
else: shellScript = shellScriptSh
if isBourneShell: shellScript = shellScriptSh
else: shellScript = shellScriptCsh
if useDevtoolset2:
shellScript += ' scl enable devtoolset-2 %(SHELL)s'
shellScript += \
' echo "Launching a devtoolset-2 subshell though scl (CTRL+D to exit).";' \
' scl enable devtoolset-2 %(SHELL)s'
evalScript = shellScript % { "PATH" : strippedPath
, "LD_LIBRARY_PATH" : strippedLibraryPath

View File

@ -82,6 +82,8 @@
#if (defined __linux__ || defined __FreeBSD__ || defined __APPLE__)
#include <execinfo.h>
#ifdef HAVE_LIBBFD
#define PACKAGE "Hurricane"
#define PACKAGE_VERSION "no_version"
#include <bfd.h>
#endif
#endif