Skip to content

Instantly share code, notes, and snippets.

@easel
Created October 3, 2010 04:06
Show Gist options
  • Select an option

  • Save easel/608251 to your computer and use it in GitHub Desktop.

Select an option

Save easel/608251 to your computer and use it in GitHub Desktop.
diff --git a/SConstruct b/SConstruct
index 1fd1e0f..3b58821 100644
--- a/SConstruct
+++ b/SConstruct
@@ -5,6 +5,11 @@ def build_sources(env, sources):
return [ env.SharedObject(s) for s in sources ]
# def
+v8cgi_bin = [];
+v8cgi_inc = [];
+v8cgi_lib = [];
+v8cgi_data = [];
+
def build_mysql(env):
e = env.Clone()
if env["os"] == "windows":
@@ -26,7 +31,7 @@ def build_mysql(env):
e.Append(
CPPPATH = env["mysql_path"],
)
- e.SharedLibrary(
+ v8cgi_lib[len(v8cgi_lib):] = e.SharedLibrary(
target = "lib/mysql",
source = ["src/gc", "src/lib/mysql/mysql.cc"],
SHLIBPREFIX=""
@@ -44,7 +49,7 @@ def build_pgsql(env):
LIBS = ["pthreadGCE2"],
)
# if
- e.SharedLibrary(
+ v8cgi_lib[len(v8cgi_lib):] = e.SharedLibrary(
target = "lib/pgsql",
source = ["src/gc", "src/lib/pgsql/pgsql.cc"],
SHLIBPREFIX=""
@@ -56,7 +61,7 @@ def build_sqlite(env):
e.Append(
LIBS = ["sqlite3"]
)
- e.SharedLibrary(
+ v8cgi_lib[len(v8cgi_lib):] = e.SharedLibrary(
target = "lib/sqlite",
source = ["src/gc", "src/lib/sqlite/sqlite.cc"],
SHLIBPREFIX=""
@@ -69,7 +74,7 @@ def build_gd(env):
e.Append(
LIBS = [libname]
)
- e.SharedLibrary(
+ v8cgi_lib[len(v8cgi_lib):] = e.SharedLibrary(
target = "lib/gd",
source = ["src/common", "src/lib/gd/gd.cc"],
SHLIBPREFIX=""
@@ -99,12 +104,12 @@ def build_binary(env):
LIBS = ["iconv"]
)
# if
- e.SharedLibrary(
+ v8cgi_lib[len(v8cgi_lib):] = e.SharedLibrary(
target = "lib/binary-b",
source = ["src/lib/binary-b/binary-b.cc", "src/lib/binary-b/bytestring.cc", "src/lib/binary-b/bytearray.cc", "src/lib/binary-b/bytestorage.cc"],
SHLIBPREFIX=""
)
- e.SharedLibrary(
+ v8cgi_lib[len(v8cgi_lib):] = e.SharedLibrary(
target = "lib/binary-f",
source = ["src/lib/binary-f/binary-f.cc", "src/lib/binary-f/bytestorage.cc"],
SHLIBPREFIX=""
@@ -117,7 +122,7 @@ def build_xdom(env):
CPPPATH = env["xercesc_path"],
LIBS = "xerces-c"
)
- e.SharedLibrary(
+ v8cgi_lib[len(v8cgi_lib):] = e.SharedLibrary(
target = "lib/xdom",
source = ["src/gc.cc", "src/lib/xdom/xdom.cc"],
SHLIBPREFIX=""
@@ -129,7 +134,7 @@ def build_gl(env):
e.Append(
LIBS = ["glut", "GLU", "GL", "GLEW"]
)
- e.SharedLibrary(
+ v8cgi_lib[len(v8cgi_lib):] = e.SharedLibrary(
target = "lib/GL",
source = ["src/gc.cc", "src/lib/GL/GL.cc", "src/lib/GL/glbindings/glbind.cpp", "src/lib/GL/glesbindings/glesbind.cpp", "src/lib/GL/glubindings/glubind.cpp", "src/lib/GL/glutbindings/glutbind.cpp"],
SHLIBPREFIX=""
@@ -153,7 +158,7 @@ def build_module(env, sources):
)
# if
- e.SharedLibrary(
+ v8cgi_lib[len(v8cgi_lib):] = e.SharedLibrary(
target = "mod_v8cgi",
source = [sources, "src/mod_v8cgi.cc"],
SHLIBPREFIX=""
@@ -168,7 +173,7 @@ def build_cgi(env, sources):
CPPDEFINES = ["FASTCGI"]
)
# if
- env.Program(
+ v8cgi_bin[len(v8cgi_bin):] = env.Program(
source = [sources, "src/v8cgi.cc"],
target = "v8cgi"
)
@@ -235,6 +240,9 @@ vars.Add(BoolVariable("debug", "Debugging support", 0))
vars.Add(BoolVariable("verbose", "Verbose debugging messages", 0))
vars.Add(BoolVariable("reuse_context", "Reuse context for multiple requests", 0))
+# prefix
+vars.Add(PathVariable('PREFIX', 'Directory to install under', '/usr/local', PathVariable.PathIsDir))
+
# optional library paths
vars.Add(("mysql_path", "MySQL header path", mysql_include))
vars.Add(("pgsql_path", "PostgreSQL header path", pgsql_include))
@@ -264,6 +272,15 @@ if conf.CheckCHeader("sys/mman.h", include_quotes = "<>"):
if conf.CheckFunc("sleep"):
env.Append(CPPDEFINES = ["HAVE_SLEEP"])
+
+# Here are our installation paths:
+idir_prefix = '$PREFIX'
+idir_lib = '$PREFIX/lib'
+idir_bin = '$PREFIX/bin'
+idir_inc = '$PREFIX/include'
+idir_data = '$PREFIX/share'
+Export('env idir_prefix idir_lib idir_bin idir_inc idir_data')
+
# default built-in values
env.Append(
LIBS = ["v8"],
@@ -356,3 +373,11 @@ if env["xdom"] == 1: build_xdom(env)
if env["gl"] == 1: build_gl(env)
if env["module"] == 1: build_module(env, sources)
if env["cgi"] == 1: build_cgi(env, sources)
+
+env.Install(idir_bin, v8cgi_bin)
+env.Install(idir_lib, v8cgi_lib)
+env.Install(idir_inc, v8cgi_inc)
+env.Install(idir_data, v8cgi_data)
+print (idir_bin)
+
+env.Alias('install', [idir_bin, idir_inc, idir_data, idir_lib])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment