diff manage.py @ 35:3e66613d1d4d

Added information about getting my SpiderMonkey mirror, and also added an option for linking statically to SpiderMonkey's runtime instead of dynamically.
author Atul Varma <varmaa@toolness.com>
date Thu, 02 Jul 2009 15:20:02 -0700
parents d0a3f358072a
children d4efcbb06964
line wrap: on
line diff
--- a/manage.py	Tue Jun 30 22:47:31 2009 -0700
+++ b/manage.py	Thu Jul 02 15:20:02 2009 -0700
@@ -31,7 +31,8 @@
 from paver.easy import *
 
 @task
-@cmdopts([("objdir=", "o", "The root of your Mozilla objdir")])
+@cmdopts([("objdir=", "o", "The root of your Mozilla objdir"),
+          ("static", "s", "Build against static libraries")])
 def build(options):
     """Build the pymonkey Python C extension."""
 
@@ -46,22 +47,26 @@
 
     print "Building extension."
 
-    result = subprocess.call(
-        ["g++",
-         "-framework", "Python",
-         "-I%s" % incdir,
-         "-L%s" % libdir,
-         "-Wall",
-         "-lmozjs",
-         "-o", "pymonkey.so",
-         "-dynamiclib",
-         "pymonkey.c",
-         "utils.c",
-         "object.c",
-         "undefined.c",
-         "context.c",
-         "runtime.c"]
-        )
+    args = ["g++",
+            "-framework", "Python",
+            "-I%s" % incdir,
+            "-L%s" % libdir,
+            "-Wall",
+            "-o", "pymonkey.so",
+            "-dynamiclib",
+            "pymonkey.c",
+            "utils.c",
+            "object.c",
+            "undefined.c",
+            "context.c",
+            "runtime.c"]
+
+    if options.get("static"):
+        args.append(os.path.join(objdir, "libjs_static.a"))
+    else:
+        args.append("-lmozjs")
+
+    result = subprocess.call(args)
 
     if result:
         sys.exit(result)
@@ -70,7 +75,13 @@
 
     new_env = {}
     new_env.update(os.environ)
-    new_env['DYLD_LIBRARY_PATH'] = libdir
+    if not options.get("static"):
+        print("NOTE: Because you're linking dynamically to the "
+              "SpiderMonkey shared library, you'll need to make sure "
+              "that it's on your library load path. You may need to "
+              "add %s to your library load path to do this." %
+              libdir)
+        new_env['DYLD_LIBRARY_PATH'] = libdir
 
     result = subprocess.call(
         [sys.executable,