diff --git a/build/premake/extern_libs.lua b/build/premake/extern_libs.lua index 1fb9b28129..6e05701021 100644 --- a/build/premake/extern_libs.lua +++ b/build/premake/extern_libs.lua @@ -68,6 +68,7 @@ end -- which is unfortunately totally incompatible with our -- library installation rules. -- * depends: a table of external libraries that this library depends on +-- * defines: a table of symbols to define extern_lib_defs = { boost = { unix_names = { "boost_signals-mt", "boost_filesystem-mt", "boost_system-mt" }, @@ -175,10 +176,25 @@ extern_lib_defs = { end end }, - spidermonkey = { + spidermonkey = + options["with-spidermonkey-tip"] and + { + add_func = function() + tinsert(package.config["Debug" ].includepaths, libraries_dir.."spidermonkey-tip/include/debug") + tinsert(package.config["Testing"].includepaths, libraries_dir.."spidermonkey-tip/include/debug") + tinsert(package.config["Release"].includepaths, libraries_dir.."spidermonkey-tip/include/release") + tinsert(package.libpaths, libraries_dir.."spidermonkey-tip/lib") + tinsert(package.config["Debug" ].links, "mozjs-debug") + tinsert(package.config["Testing"].links, "mozjs-release") + tinsert(package.config["Release"].links, "mozjs-release") + end, + } + or -- SpiderMonkey 1.6 + { win_names = { "js32" }, unix_names = { "js" }, - depends = { "nspr" } + depends = { "nspr" }, + defines = { "JS_THREADSAFE" }, }, valgrind = { }, @@ -274,7 +290,11 @@ local function add_extern_lib(extern_lib, def) if OS ~= "windows" then suffix = "" end - + + if def.defines then + tinsert(package.defines, def.defines) + end + -- OS X "Frameworks" need to be added in a special way to the link -- i.e. by linkoptions += "-framework ..." if OS == "macosx" and def.osx_frameworks then diff --git a/build/premake/premake.lua b/build/premake/premake.lua index ec2ededd4a..4dae1a0e1a 100755 --- a/build/premake/premake.lua +++ b/build/premake/premake.lua @@ -7,6 +7,7 @@ addoption("outpath", "Location for generated project files") addoption("without-tests", "Disable generation of test projects") addoption("without-pch", "Disable generation and usage of precompiled headers") addoption("with-valgrind", "Enable using valgrind for debugging functionality") +addoption("with-spidermonkey-tip", "Use SpiderMonkey from mozilla-central tip instead of the 1.6 release") use_dcdt = false -- disable it since it's a non-Free library @@ -121,6 +122,8 @@ function package_set_build_flags() -- PremakeWiki says with-symbols and optimize are automatically set for -- Debug and Release builds, respectively. doesn't happen though, so do it manually. + package.config["Debug"].defines = { "DEBUG" } + package.config["Testing"].buildflags = { "no-runtime-checks" } package.config["Testing"].defines = { "TESTING" } @@ -208,6 +211,11 @@ function package_set_build_flags() end end + -- To use our local SpiderMonkey library, it needs to be part of the runtime dynamic linker + -- path. So try to add the cwd (assuming it'll be binaries/system/) with -rpath + -- (TODO: is this a sane way to do it?) + tinsert(package.linkoptions, {"-Wl,-rpath=."}) + tinsert(package.buildoptions, { -- Hide symbols in dynamic shared objects by default, for efficiency and for equivalence with -- Windows - they should be exported explicitly with __attribute__ ((visibility ("default"))) @@ -851,6 +859,9 @@ end function setup_atlas_frontend_package (package_name) package_create(package_name, "winexe") + package_add_extern_libs({ + "spidermonkey", + }) local source_root = "../../../source/tools/atlas/AtlasFrontends/" package.files = { diff --git a/source/scripting/SpiderMonkey.h b/source/scripting/SpiderMonkey.h index 8b5cc16b6c..f3563dc482 100644 --- a/source/scripting/SpiderMonkey.h +++ b/source/scripting/SpiderMonkey.h @@ -43,8 +43,6 @@ # define XP_UNIX #endif -#define JS_THREADSAFE - #include #ifndef NDEBUG