[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14409] trunk/blender/extern/x264/ SConscript: == X264 ==

Peter Schlaile peter at schlaile.de
Sun Apr 13 18:07:12 CEST 2008


Revision: 14409
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14409
Author:   schlaile
Date:     2008-04-13 18:06:09 +0200 (Sun, 13 Apr 2008)

Log Message:
-----------
== X264 ==

forgot SConscript, shame on me...

Added Paths:
-----------
    trunk/blender/extern/x264/SConscript

Added: trunk/blender/extern/x264/SConscript
===================================================================
--- trunk/blender/extern/x264/SConscript	                        (rev 0)
+++ trunk/blender/extern/x264/SConscript	2008-04-13 16:06:09 UTC (rev 14409)
@@ -0,0 +1,124 @@
+#!/usr/bin/python
+
+Import('env')
+
+root = "extern/x264"
+
+import sys
+import os
+import re
+import shutil
+
+from sets import Set
+
+x264_env = env.Copy();
+x264_env.Replace(CCFLAGS = '')
+x264_env.Replace(BF_DEBUG_FLAGS = '')
+
+makevardef = re.compile('^([a-zA-Z0-9_-]+)[ \t]*(\+?)=(.*)')
+makevarsubst = re.compile('\$\(([^\)]+)\)')
+makeifeq = re.compile('if(n?)eq \(([^,]*),([^\)]*)\)')
+
+def makeparseblock(fp, variables):
+    pendingline = ''
+    while 1:
+        line = fp.readline()
+        if pendingline:
+            line = pendingline + line
+            pendingline = ''
+        if not line:
+            return
+        if line.endswith('\\\n'):
+            pendingline = line[:-2]
+            continue 
+
+        i = line.find('#')
+        if i >= 0:
+            line = line[:i]
+
+        iter = makevarsubst.finditer(line[:])
+        for obj in iter:
+            (name) = obj.group(1)
+            s = ""
+            if name in variables:
+                s = variables[name]
+            line = line.replace('$(' + name + ')', s)
+
+        matchobj = makevardef.match(line)
+        if matchobj:
+            (name, op, value) = matchobj.group(1, 2, 3)
+
+            value = value.rstrip()
+
+            if op == '+' and name in variables:
+                 variables[name] += value
+            else:
+                 variables[name] = value
+            continue
+        matchobj = makeifeq.match(line)
+        if matchobj:
+            (op, name1, name2) = matchobj.group(1, 2, 3)
+            if (op == '' and name1 == name2) or (op == 'n' and name1 != name2):
+                makeparseblock(fp, variables)
+            else:
+                tempvars = {}
+                makeparseblock(fp, tempvars)
+            continue
+        line = line.strip()
+        if line == 'endif':
+            return
+                
+def getmakevars(filenames):
+    variables = { }
+    for filename in filenames:
+       fp = open(filename)
+       print "Processing makefile: " + filename
+       try:
+             makeparseblock(fp, variables)
+       finally:
+             fp.close()
+
+    return variables
+
+print "Configuring libx264..."
+
+if not os.path.isfile(root + "/config.mak"):
+    os.chdir(root);
+    os.system("sh -c './configure'")
+    os.chdir("../..");
+else:
+    print "(skipped, config.mak already exists)"
+    
+vars = getmakevars([root + '/config.mak', root + '/Makefile'])
+srcs = ""
+if "SRCS" in vars:
+    srcs += vars['SRCS']
+
+asm_srcs = ""
+if "ASMSRC" in vars:
+    asm_srcs += vars["ASMSRC"]
+
+srcs += " "
+srcs += asm_srcs
+  
+sources = list(Set(srcs.split()))
+
+defs = ""
+cflags = ""
+    
+if "CFLAGS" in vars:
+    cflags += " " + vars["CFLAGS"]
+
+asflags = ""
+
+for a in vars['ASFLAGS'].split():
+    asflags += " " + a.replace('-I', '-I' + root + '/')
+
+x264_env['AS'] = vars['AS']
+x264_env['ASFLAGS'] = asflags
+x264_env.BlenderLib (libname="extern_x264", sources=sources,
+                     includes=["."],
+                     defines=Split(defs),
+                     libtype=['core', 'intern', 'player'],
+                     priority = [10, 10, 300],
+                     compileflags = Split(cflags))





More information about the Bf-blender-cvs mailing list