[llvm-commits] [hlvm] r38141 - in /hlvm/trunk/build: bytecode.py configure.py hlvm.py

Reid Spencer reid at x10sys.com
Sat Jul 7 17:00:19 PDT 2007


Author: reid
Date: Sat Jul  7 19:00:19 2007
New Revision: 38141

URL: http://llvm.org/viewvc/llvm-project?rev=38141&view=rev
Log:
Two changes:
1. Fix Saem's patch to read from a file for additional path locations to 
   search during configuration. You can now use "confpath=path1:path2:path3"
   on the command line and it will get rememebered on subsequent builds. No
   need for a separate file read.
2. Implement building a bytecode file from a list of C++ sources in a single
   llvm-g++ invocation. This helps produce the runtime library as a bytecode
   module.

Added:
    hlvm/trunk/build/bytecode.py
Modified:
    hlvm/trunk/build/configure.py
    hlvm/trunk/build/hlvm.py

Added: hlvm/trunk/build/bytecode.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/build/bytecode.py?rev=38141&view=auto

==============================================================================
--- hlvm/trunk/build/bytecode.py (added)
+++ hlvm/trunk/build/bytecode.py Sat Jul  7 19:00:19 2007
@@ -0,0 +1,26 @@
+from SCons.Environment import Environment as Environment
+import re,fileinput,os
+from string import join as sjoin
+from os.path import join as pjoin
+
+def BytecodeAction(target,source,env):
+  funcName = os.path.splitext(os.path.basename(source[0].path))[0]
+  sources = ""
+  for src in source:
+    sources += " " + src.path
+  tgt = target[0].path
+  theAction = env.Action(
+    "PATH='" + env['LLVM_bin'] + "' " + env['with_llvmgxx'] + 
+      " -c -x c++ " + sources + " -o " + tgt)
+  env.Depends(target,env['with_llvmgxx'])
+  env.Execute(theAction);
+  return 0
+
+def BytecodeMessage(target,source,env):
+  return "Generating Bytecode From C++ Source"
+
+def Bytecode(env):
+  a = env.Action(BytecodeAction,BytecodeMessage)
+  b = env.Builder(action=a,suffix='bc',src_suffix='cpp')
+  env.Append(BUILDERS = {'Bytecode':b})
+  return 1

Modified: hlvm/trunk/build/configure.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/build/configure.py?rev=38141&r1=38140&r2=38141&view=diff

==============================================================================
--- hlvm/trunk/build/configure.py (original)
+++ hlvm/trunk/build/configure.py Sat Jul  7 19:00:19 2007
@@ -73,14 +73,9 @@
 }
 """
   context.env.AppendUnique(LIBS = libs)
-  paths += [
-    '/proj','/proj/install','/opt/local','/opt/','/sw','/usr/local','/usr','/'
-  ]
-  #Quick hack until I figure out how to do it the SCons way.
-  extrapaths=open('build/paths','r')
-  if not extrapaths==None:
-    for path in extrapaths:
-      paths.insert(0,path.strip())
+  if len(context.env['confpath']) > 0:
+    paths = context.env['confpath'].split(':') + paths
+  paths += [ '/opt/local','/opt/','/sw/local','/sw','/usr/local','/usr','/' ]
   # Check each path
   for p in paths:
     # Clear old settings from previous iterations
@@ -202,9 +197,8 @@
 
 def FindLLVM(conf,env):
   code = 'new llvm::Module("Name");'
-  conf.FindPackage('LLVM','llvm/Module.h',['LLVMCore','LLVMSystem'],
-     code,[env['with_llvm'],'/proj/install/llvm'],[],'',
-     ['llvm2cpp','llvm-as','llc'] )
+  conf.FindPackage('LLVM','llvm/Module.h',['LLVMCore','LLVMSystem'],code,
+    [env['with_llvm']],[],'',['llvm2cpp','llvm-as','llc'] )
 
 def FindAPR(conf,env):
   code = 'apr_initialize();'

Modified: hlvm/trunk/build/hlvm.py
URL: http://llvm.org/viewvc/llvm-project/hlvm/trunk/build/hlvm.py?rev=38141&r1=38140&r2=38141&view=diff

==============================================================================
--- hlvm/trunk/build/hlvm.py (original)
+++ hlvm/trunk/build/hlvm.py Sat Jul  7 19:00:19 2007
@@ -35,6 +35,10 @@
   from build import filterbuilders
   return filterbuilders.RNGTokenizer(env)
 
+def GetBytecode(env):
+  from build import bytecode
+  return bytecode.Bytecode(env)
+
 def Dirs(env,dirlist=[]):
   dir = env.Dir('.').path
   if (dir == env.Dir('#').path):
@@ -81,6 +85,7 @@
     BoolOption('small','Generate smaller code rather than faster',0),
   )
   opts.Add('prefix','Specify where to install HLVM','/usr/local')
+  opts.Add('confpath','Specify additional configuration dirs to search',''),
   opts.Add('with_llvm','Specify where LLVM is located','/usr/local'),
   opts.Add('with_apr','Specify where apr is located','/usr/local/apr'),
   opts.Add('with_apru','Specify where apr-utils is located','/usr/local/apr'),





More information about the llvm-commits mailing list