Ejemplo n.º 1
0
def compile(srcDir, args = []):  
  cmd = env.sedonacExe + " " + srcDir
  for arg in args:
    cmd += " " + arg         
  status = os.system(cmd)
  if status:
    raise env.BuildError("FATAL: compilekit " + srcDir)   
Ejemplo n.º 2
0
def mingw32(exeFile, srcFiles, includes, libs, defs):
    # standard includes
    cmd = "i686-w64-mingw32-gcc"
    for include in includes:
        cmd += " -I\"" + include + "\""

    # defines (dict)
    for d, v in defs.items():
        cmd += " -D" + d
        if v:
            cmd += "=" + v

    # src
    for src in srcFiles:
        cmd += " " + src

    # libs
    for lib in libs:
        if lib.endswith('.lib'):
            lib = lib[:-4]
        cmd += " -l" + lib

    # remaining options
    cmd += " -O2"
    cmd += " -o " + exeFile

    # compile away
    status = os.system(cmd)
    if status:
        raise env.BuildError("FATAL: compilewin " + exeFile)

    print("  Success [" + exeFile + "]")
Ejemplo n.º 3
0
def gcc(exeFile, srcFiles, includes, libs, defs):
    # standard includes
    cmd = "gcc"
    for include in includes:
        cmd += " -I\"" + include + "\""

    # defines (tuples)
    for d in defs:
        cmd += " -D" + d[0] + "=" + d[1]

    cmd += " -DPLAT_BUILD_VERSION=" + '\\"' + env.buildVersion() + '\\"'

    # libs
    for lib in libs:
        cmd += " -L\"" + lib + "\""

    # src
    for src in srcFiles:
        cmd += " " + src

    # remaining options
    cmd += " -O2"
    cmd += " -o " + exeFile

    # compile away
    print cmd
    status = os.system(cmd)
    if status:
        raise env.BuildError("FATAL: compileunix " + exeFile)

    print "  Success [" + exeFile + "]"
Ejemplo n.º 4
0
def compile(exeFile, srcFiles, includes, libs, defs, opts=[]):
    print "Compile [" + os.path.basename(exeFile) + "]"

    # get environment variables
    vcInstallDir = os.environ.get("VCINSTALLDIR")
    if not vcInstallDir or not os.path.exists(vcInstallDir):
        raise Exception(
            "FATAL: Visual Studio environment not setup [VCINSTALLDIR]")

    # get the PlatformSDK directory
    #  1) first check the win_sdk environment
    #  2) assume it is installed under vc7
    winSdk = os.environ.get("win_sdk")
    if not winSdk:
        winSdk = os.path.join(vcInstallDir, "vc7", "PlatformSDK")
    if not os.path.exists(winSdk):
        raise Exception("FATAL: Cannot find PlatformSDK: " + winSdk)

    # make sure exe output directory exists
    if not os.path.exists(os.path.dirname(exeFile)):
        os.makedirs(os.path.dirname(exeFile))

    # standard includes
    cmd = "cl"
    cmd += " /I\"" + os.path.join(winSdk, "Include") + "\""
    for include in includes:
        cmd += " /I\"" + include + "\""

    # defines (dict)
    for d, v in defs.items():
        cmd += " /D" + d
        if v: cmd += "=" + v

    # libs
    for lib in libs:
        cmd += " \"" + os.path.join(winSdk, "Lib", lib) + "\""

    # libs
    for src in srcFiles:
        cmd += " " + src

    # remaining options
    cmd += " /nologo"
    cmd += " /Fe" + exeFile
    # Add any other options supplied by caller
    for o in opts:
        cmd += " " + o

    # compile away
    status = os.system(cmd)

    # cleanup
    os.system("del *.obj")
    os.system("del *.tlh")

    if status:
        raise env.BuildError("FATAL: compilewin " + exeFile)

    print "  Success [" + exeFile + "]"
Ejemplo n.º 5
0
def gcc(exeFile, srcFiles, includes, libs, defs):
  # standard includes
  compile_prefix=os.environ.get("SVM_CROSS_COMPILE")
  cmd = "gcc"
  if compile_prefix is not None:
    cmd = compile_prefix + cmd

  if (platform.machine() == 'x86_64') and (compile_prefix is None):
    cmd += " -m32"  # always compile in 32bit mode

  sysroot = os.environ.get("SVM_SYSROOT")
  for include in includes:
    if sysroot is not None and include.startswith("/"):
      include = sysroot + os.sep + include
    cmd += " -I" + include

  # defines (tuples)
  for d in defs:
    if not isinstance(d, tuple):
      d = (d, )
    cmd += " -D" + d[0]
    if len(d)>1 and d[1] is not None:
      cmd += "=" + d[1]

  cmd += " -DPLAT_BUILD_VERSION=" + '\\"' + env.buildVersion() + '\\"'

  # add user CFLAGS
  cflags = os.environ.get("SVM_CFLAGS")
  if cflags is not None:
    cmd += " " + cflags

  # src
  for src in srcFiles:
    cmd += " " + src

  # libs
  for lib in libs:
    cmd += " -l" + lib

  # add user LDFLAGS
  ldflags = os.environ.get("SVM_LDFLAGS")
  if ldflags is not None:
    cmd += " " + ldflags

  # remaining options
  cmd += " -O2"
  cmd += " -o " + exeFile

  # compile away
  print(cmd)
  status = os.system(cmd)
  if status:
    raise env.BuildError("FATAL: compileunix " + exeFile)

  print("  Success [" + exeFile + "]")
Ejemplo n.º 6
0
def compile(srcDir, depends, packages, jarFile, func=None):
    print "Compile [" + os.path.basename(jarFile) + "]"
    # init jarTemp dir
    temp = os.path.join(env.build, "tempJar")
    fileutil.rmdir(temp, [], 0)
    fileutil.mkdir(temp)

    # compile using jikes.exe
    print "  Javac [" + srcDir + "]"
    cmd = env.jikes
    # cmd += " +E +Pno-shadow"
    cmd += " -d " + temp
    cmd += " -classpath " + env.jreRt + env.cpSep + srcDir
    for depend in depends:
        cmd += env.cpSep + depend
    for package in packages:
        cmd += " " + os.path.join(srcDir, package.replace(".", os.path.sep),
                                  "*.java")
    status = os.system(cmd)
    if status:
        raise env.BuildError("FATAL: makejar " + jarFile)

    # if we have a function call it
    if (func != None):
        func(temp)
        func(srcDir)

    # jar up using jar.exe
    cmd = env.jar + " cf " + jarFile + " -C " + temp + " ."
    status = os.system(cmd)
    if status:
        raise env.BuildError("FATAL: makejar " + jarFile)

    # cleanup
    fileutil.rmdir(temp, [], 0)

    # success
    print "  Jar [" + jarFile + "]"
Ejemplo n.º 7
0
def compile(cdefs=defs):
    try:
        if xml.dom.minidom.parse(
                platFile).documentElement.nodeName != "sedonaPlatform":
            raise env.BuildError("" + platFile +
                                 " is not a sedonaPlatform XML file")

        fileutil.rmdir(stageDir)
        compilekit.compile(platFile + " -outDir " + stageDir)
        getattr(compilewin, compiler)(exeFile, srcFiles, includes, libs, cdefs)

    except env.BuildError:
        print("**")
        print("** FAILED [" + exeFile + "]")
        print("**")
        sys.exit(1)
Ejemplo n.º 8
0
def gcc(exeFile, srcFiles, includes, libs, defs):
    # standard includes

    # Native compilation
    #  cmd = "gcc"

    # Cross compilation
    cmd = "arm-linux-gnueabihf-gcc"

    for include in includes:
        cmd += " -I\"" + include + "\""

    # defines (tuples)
    for d in defs:
        cmd += " -D" + d[0] + "=" + d[1]


#Need to add pthread library to build
    cmd += " -pthread"
    #Need to add "clock" to resovle the "clock_gettime" API
    cmd += "  -lrt -lm"

    #  cmd += " -DPRINT_ENABLED=1"

    cmd += " -DPLAT_BUILD_VERSION=" + '\\"' + env.buildVersion() + '\\"'

    # libs
    for lib in libs:
        cmd += " -L\"" + lib + "\""

    # src
    for src in srcFiles:
        cmd += " " + src

    # remaining options
    cmd += " -O2"
    cmd += " -o " + exeFile

    # compile away
    print cmd
    status = os.system(cmd)
    if status:
        raise env.BuildError("FATAL: compileunix " + exeFile)

    print "  Success [" + exeFile + "]"
Ejemplo n.º 9
0
def compile():
  global platFile, stageDir
  try:
    # init all variables
    if xml.dom.minidom.parse(platFile).documentElement.nodeName != "sedonaPlatform":
      raise env.BuildError("" + platFile + " is not a sedonaPlatform XML file")

    stageDir = os.path.join(env.temp, re.sub("\.xml$", "", os.path.split(platFile)[1]))
    srcFiles = [ os.path.join(stageDir, "*.c") ]
    fileutil.rmdir(stageDir)
    compilekit.compile(platFile + " -outDir " + stageDir)
    getattr(compileunix, compiler)(env.svmExe, srcFiles, includes, libs, defs)
    os.chmod(env.svmExe, 0O755)

  except env.BuildError as err:
    print("**")
    print("** " + str(err))
    print("** FAILED [" + env.svmExe + "]")
    print("**")
Ejemplo n.º 10
0
  # Figure out which tests to run
  run_sc = options.test.count('sedonac') > 0 or options.test.count('all') > 0 
  run_sv = options.test.count('svm') > 0     or options.test.count('all') > 0 

  # Specifying 'none' overrides any other selections
  if options.test.count('none') > 0:
    run_sc = False
    run_sv = False

  if not run_sc: print('  Skipping sedonac tests')
  if not run_sv: print('  Skipping svm tests')

  # Make sedona.jar  
  status = makesedona.compile()
  if status:
    raise env.BuildError("FATAL: makesedona failed")   
  
  # Make sedonac.jar  
  status = makesedonac.compile()
  if status:
    raise env.BuildError("FATAL: makesedonac failed")   

  # Make sedonacert.jar  
  status = makesedonacert.compile()
  if status:
    raise env.BuildError("FATAL: makesedonacert failed")   
  
  # Make all kits
  compilekit.compile(env.kits)

  # Make additional external kits
Ejemplo n.º 11
0
  # Figure out which tests to run
  run_sc = options.test.count('sedonac') > 0 or options.test.count('all') > 0 
  run_sv = options.test.count('svm') > 0     or options.test.count('all') > 0 

  # Specifying 'none' overrides any other selections
  if options.test.count('none') > 0:
    run_sc = False
    run_sv = False

  if not run_sc: print '  Skipping sedonac tests'
  if not run_sv: print '  Skipping svm tests'


  # Make sure OS is Windows
  if os.name != "nt":
    raise env.BuildError("FATAL: makedev.py can only run on windows.")
     
  # Make sedona.jar  
  status = makesedona.compile()
  if status:
    raise env.BuildError("FATAL: makesedona failed")   
  
  # Make sedonac.jar  
  status = makesedonac.compile()
  if status:
    raise env.BuildError("FATAL: makesedonac failed")   

  # Make sedonacert.jar  
  status = makesedonacert.compile()
  if status:
    raise env.BuildError("FATAL: makesedonacert failed")   
Ejemplo n.º 12
0
# Creation:  7 Dec 07
#

import os
import env
import fileutil
import makesedona
import makesedonac
import makesedonacert
import makewinvm
import compilekit

# Main
if __name__ == '__main__':
    if os.name != "nt":
        raise env.BuildError("FATAL: makedev.py can only run on windows.")

    # make sedona.jar
    makesedona.compile()

    # make sedonac.jar
    makesedonac.compile()

    # make sedonacert.jar
    makesedonacert.compile()

    # make all kits
    compilekit.compile(env.src)

    # make windows svm
    makewinvm.compile()