From 048841ef070bacd9ddd518a76871a4370a619fae Mon Sep 17 00:00:00 2001 From: Jean-Paul Chaput Date: Wed, 25 Aug 2010 11:57:11 +0000 Subject: [PATCH] * ./vlsisapd/src/bootstrap: - New: coriolisEnv.py, little helper script to setup the environment. - New: Icon & desktop entry for Linux (doesn't work yet). - Bug: In FindLEFDEF, uses LIB_SUFFIX to find libraries on 64 bits systems. --- bootstrap/cmake_modules/FindLEFDEF.cmake | 2 +- bootstrap/coriolisEnv.py | 124 +++++++++++++++++++++++ bootstrap/shadock.png | Bin 0 -> 582 bytes bootstrap/unicorn.desktop | 12 +++ 4 files changed, 137 insertions(+), 1 deletion(-) create mode 100755 bootstrap/coriolisEnv.py create mode 100644 bootstrap/shadock.png create mode 100644 bootstrap/unicorn.desktop diff --git a/bootstrap/cmake_modules/FindLEFDEF.cmake b/bootstrap/cmake_modules/FindLEFDEF.cmake index e4aee2e9..99508085 100644 --- a/bootstrap/cmake_modules/FindLEFDEF.cmake +++ b/bootstrap/cmake_modules/FindLEFDEF.cmake @@ -86,7 +86,7 @@ if ( UNIX ) find_path ( LEFDEF_LIBRARY_DIR NAMES "libdef.a" "libdef_Debug.a" PATHS ${LEFDEF_LIBRARY_SEARCH_PATH} - PATH_SUFFIXES "lib" + PATH_SUFFIXES "lib${LIB_SUFFIX}" DOC "The ${LEFDEF_LIBRARY_DIR_DESCRIPTION}" ) if ( LEFDEF_INCLUDE_DIR AND LEFDEF_LIBRARY_DIR ) diff --git a/bootstrap/coriolisEnv.py b/bootstrap/coriolisEnv.py new file mode 100755 index 00000000..f77ddfbb --- /dev/null +++ b/bootstrap/coriolisEnv.py @@ -0,0 +1,124 @@ +#!/usr/bin/env python + + +import re +import os +import sys +import string +import subprocess + + +coriolisPattern = re.compile ( r".*coriolis.*" ) + + +def stripPath ( pathName ): + pathEnv = os.getenv ( pathName ) + if not pathEnv: return "" + + pathList = string.split ( pathEnv, ':' ) + strippedList = [] + for pathElement in pathList: + if not coriolisPattern.match(pathElement): + strippedList += [ pathElement ] + + if len(strippedList) == 0: return "" + + strippedEnv = strippedList[0] + for pathElement in strippedList[1:]: + strippedEnv += ":" + pathElement + + return strippedEnv + + +def guessOs (): + osSLSoC5x_64 = re.compile (".*Linux.*el5.*x86_64.*") + osSLSoC5x = re.compile (".*Linux.*(el5|2.6.23.13.*SoC).*") + osLinux_64 = re.compile (".*Linux.*x86_64.*") + osLinux = re.compile (".*Linux.*") + osDarwin = re.compile (".*Darwin.*") + + uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE ) + lines = uname.stdout.readlines() + + if osSLSoC5x_64.match(lines[0]): osType = "Linux.SLSoC5x_64" + elif osSLSoC5x .match(lines[0]): osType = "Linux.SLSoC5x" + elif osLinux_64 .match(lines[0]): osType = "Linux.x86_64" + elif osLinux .match(lines[0]): osType = "Linux.i386" + elif osDarwin .match(lines[0]): osType = "Darwin" + else: + uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE ) + osType = uname.stdout.readlines()[0][:-1] + + #print "[WARNING] Unrecognized OS: \"%s\"." % lines[0][:-1] + #print " (using: \"%s\")" % osType + + return osType + + + + +if __name__ == "__main__": + + osDir = guessOs() + buildType = "Debug" + linkType = "Shared" + coriolisVersion = None + + for argument in sys.argv: + if argument == "--v1": coriolisVersion=1 + elif argument == "--v2": coriolisVersion=2 + elif argument == "--debug": buildType="Debug" + elif argument == "--devel": buildType="Debug" + elif argument == "--release": buildType="Release" + elif argument == "--shared": linkType="Shared" + elif argument == "--static": linkType="Static" + + strippedPath = stripPath ( "PATH" ) + strippedLibraryPath = stripPath ( "LD_LIBRARY_PATH" ) + strippedPythonPath = stripPath ( "PYTHONPATH" ) + + if coriolisVersion == 1: + + hurricaneTop = "%s/coriolis-1.x/coriolis/%s/install" % ( os.getenv("HOME"), osDir ) + buildDir = None + shellScript = \ +""" +echo "Switching to Coriolis 1.x"; +PATH=%(PATH)s; +LD_LIBRARY_PATH=%(LD_LIBRARY_PATH)s; +PYTHONPATH=%(PYTHONPATH)s; +HURRICANE_TOP=%(HURRICANE_TOP)s; +CORIOLIS_TOP=%(HURRICANE_TOP)s; +export PATH LD_LIBRARY_PATH PYTHONPATH HURRICANE_TOP CORIOLIS_TOP; +hash -r; +if [ -f "%(HURRICANE_TOP)s/share/etc/coriolis.sh" ]; then + . "%(HURRICANE_TOP)s/share/etc/coriolis.sh" +fi + """ + + elif coriolisVersion == 2: + + buildDir = buildType + "." + linkType + hurricaneTop = "%s/coriolis-2.x/%s/%s/install" % ( os.getenv("HOME"), osDir, buildDir ) + strippedPath = "%s/bin:%s" % ( hurricaneTop, strippedPath ) + strippedLibraryPath = "%s/lib:%s" % ( hurricaneTop, strippedLibraryPath ) + + shellScript = \ +""" +echo "Switching to Coriolis 2.x (%(buildDir)s)"; +PATH=%(PATH)s; +LD_LIBRARY_PATH=%(LD_LIBRARY_PATH)s; +PYTHONPATH=%(PYTHONPATH)s; +HURRICANE_TOP=%(HURRICANE_TOP)s; +CORIOLIS_TOP=%(HURRICANE_TOP)s; +export PATH LD_LIBRARY_PATH PYTHONPATH HURRICANE_TOP CORIOLIS_TOP; +hash -r +""" + + if coriolisVersion: + print shellScript % { "PATH" : strippedPath + , "LD_LIBRARY_PATH" : strippedLibraryPath + , "PYTHONPATH" : strippedPythonPath + , "HURRICANE_TOP" : hurricaneTop + , "buildDir" : buildDir + } diff --git a/bootstrap/shadock.png b/bootstrap/shadock.png new file mode 100644 index 0000000000000000000000000000000000000000..c21cc39fd728ad034a2a23d437270f5d15163743 GIT binary patch literal 582 zcmV-M0=fN(P)8x|NpXHtd40YEXyWwrhBv{kXImS>g{&vl2Z5C0qlCdbqMgS z+3|hindSH#(0;uW@MM6)99w{XLD-<&i3|cMchG|Jrqu$=-LC^zJ}_5m-|MSp96g{{ zYUdMT{i6POfaw8HQ0fj7jfMpW8%CS=YPg*Rc9W$ znpT0^sz7B|GnLRxjP_&~n0f;0ak3?B$uwazD;rR@)Y!P98{n;PSYLws{jHt#JL@NV z-4k4rQHNfpu)wQ(WPJUMV z9Y^q8vL6T!PNiy4AG?~s{9I9k#P(|g|66e$@Cxm|nIH-1FrGT#Ss<%HUAi