summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
Diffstat (limited to 'native_client_sdk')
-rw-r--r--native_client_sdk/src/DEPS121
-rw-r--r--native_client_sdk/src/build_tools/build.scons7
-rw-r--r--native_client_sdk/src/build_tools/build_utils.py13
-rwxr-xr-xnative_client_sdk/src/build_tools/buildbot_run.py20
-rwxr-xr-xnative_client_sdk/src/build_tools/generate_installers.py33
-rwxr-xr-xnative_client_sdk/src/build_tools/generate_windows_installer.py26
-rw-r--r--native_client_sdk/src/build_tools/install_nsis.py13
-rwxr-xr-xnative_client_sdk/src/build_tools/install_third_party.py6
-rw-r--r--native_client_sdk/src/build_tools/installer_contents.py53
-rwxr-xr-xnative_client_sdk/src/build_tools/sdk_tools/set_nacl_env.py4
-rwxr-xr-xnative_client_sdk/src/build_tools/tests/build_utils_test.py2
-rwxr-xr-xnative_client_sdk/src/build_tools/tests/installer_contents_test.py2
-rwxr-xr-xnative_client_sdk/src/build_tools/tests/set_nacl_env_test.py6
-rw-r--r--native_client_sdk/src/codereview.settings9
-rwxr-xr-xnative_client_sdk/src/examples/scons22
-rwxr-xr-xnative_client_sdk/src/examples/scons.bat17
-rwxr-xr-xnative_client_sdk/src/libraries/scons21
-rwxr-xr-xnative_client_sdk/src/libraries/scons.bat17
-rw-r--r--native_client_sdk/src/main.scons1
-rwxr-xr-xnative_client_sdk/src/project_templates/scons33
-rwxr-xr-xnative_client_sdk/src/project_templates/scons.bat35
-rwxr-xr-xnative_client_sdk/src/scons11
-rwxr-xr-xnative_client_sdk/src/scons.bat10
23 files changed, 246 insertions, 236 deletions
diff --git a/native_client_sdk/src/DEPS b/native_client_sdk/src/DEPS
index efe627b..f495abd 100644
--- a/native_client_sdk/src/DEPS
+++ b/native_client_sdk/src/DEPS
@@ -1,124 +1,3 @@
vars = {
"chrome_milestone": "17",
- "chrome_rev": "109032",
- "chromium_trunk": "http://src.chromium.org/svn/trunk",
- # Get PPAPI directly from Chrome, not via the NaCl repo.
- "gmock_trunk": "http://googlemock.googlecode.com/svn/trunk/",
- "gmock_version": "382",
- "gtest_trunk": "http://googletest.googlecode.com/svn/trunk/",
- "gtest_version": "570",
- "native_client_trunk": "http://src.chromium.org/native_client/trunk",
- "native_client_version": "7141",
- # Note: The following version should exactly match the toolchain version in
- # the native_client DEPS file at version native_client_version
- # TODO(mball) find some clever way to extract this from NaCl DEPS
- "pnacl_toolchain_version": "7107",
- "x86_toolchain_version": "7098",
- # ARM is not supported, this number can stay pinned at 6645.
- "arm_trusted_toolchain_version": "6645",
- "pymox": "http://pymox.googlecode.com/svn/trunk",
- "pymox_version": "61",
}
-# When we have ARM and PNaCl support, we'll need to add toolchain support
-# for those too.
-
-deps = {
- "nacl_deps":
- File(Var("native_client_trunk") + "/src/native_client/DEPS@" +
- Var("native_client_version")),
- # Please keep these in alphabetical order, by path
- "src/site_scons":
- Var("native_client_trunk") + "/src/native_client/site_scons@" +
- Var("native_client_version"),
- "src/third_party/gmock":
- Var("gmock_trunk") + "@" + Var("gmock_version"),
- "src/third_party/gtest":
- Var("gtest_trunk") + "@" + Var("gtest_version"),
- "src/third_party/native_client/base":
- Var("chromium_trunk") + "/src/base@" + Var("chrome_rev"),
- "src/third_party/native_client/build":
- Var("chromium_trunk") + "/src/build@" + Var("chrome_rev"),
- "src/third_party/native_client/gpu":
- Var("chromium_trunk") + "/src/gpu@" + Var("chrome_rev"),
- "src/third_party/native_client/native_client":
- Var("native_client_trunk") + "/src/native_client/@" +
- Var("native_client_version"),
- "src/third_party/native_client/ppapi":
- Var("chromium_trunk") + "/src/ppapi@" + Var("chrome_rev"),
- "src/third_party/pymox":
- Var("pymox") + "@" + Var("pymox_version"),
- "src/third_party/scons-2.0.1":
- Var("native_client_trunk") + "/src/third_party/scons-2.0.1@" +
- Var("native_client_version"),
- "src/third_party/native_client/third_party/pylib":
- Var("native_client_trunk") + "/src/third_party/pylib@" +
- Var("native_client_version"),
- "src/third_party/native_client/third_party/scons-2.0.1":
- Var("native_client_trunk") + "/src/third_party/scons-2.0.1@" +
- Var("native_client_version"),
- "src/third_party/native_client/third_party/simplejson":
- (Var("chromium_trunk") + "/tools/build/third_party/simplejson@" +
- Var("chrome_rev")),
- "src/third_party/native_client/tools/valgrind":
- Var("chromium_trunk") + "/src/tools/valgrind@" + Var("chrome_rev"),
-}
-
-deps_os = {
- # Please keep these in alphabetical order, by path
- "win": {
- "src/experimental/visual_studio_plugin/third_party/native_client/"
- "src/shared/gio":
- Var("native_client_trunk") + "/src/native_client/src/shared/gio@"
- + Var("native_client_version"),
- "src/experimental/visual_studio_plugin/third_party/native_client/"
- "src/shared/platform":
- Var("native_client_trunk") + "/src/native_client/src/shared/platform@"
- + Var("native_client_version"),
- "src/experimental/visual_studio_plugin/third_party/native_client/"
- "src/trusted/debug_stub":
- Var("native_client_trunk") + "/src/native_client/src/trusted/debug_stub@"
- + Var("native_client_version"),
- "src/experimental/visual_studio_plugin/third_party/native_client/"
- "src/trusted/service_runtime/include":
- Var("native_client_trunk")
- + "/src/native_client/src/trusted/service_runtime/include@"
- + Var("native_client_version"),
- "src/experimental/visual_studio_plugin/third_party/native_client/"
- "src/include":
- Var("native_client_trunk") + "/src/native_client/src/include@"
- + Var("native_client_version"),
- "src/experimental/visual_studio_plugin/third_party/native_client/"
- "src/trusted/port":
- Var("native_client_trunk") + "/src/native_client/src/trusted/port@"
- + Var("native_client_version"),
- "src/experimental/visual_studio_plugin/third_party/native_client/"
- "src/trusted/gdb_rsp":
- Var("native_client_trunk") + "/src/native_client/src/trusted/gdb_rsp@"
- + Var("native_client_version"),
- "src/third_party/native_client/third_party/mingw-w64/mingw/bin":
- From("nacl_deps", "third_party/mingw-w64/mingw/bin"),
- },
-}
-
-hooks = [
- {
- "pattern": ".",
- "action": [
- "python",
- "src/third_party/native_client/native_client/build/"
- "download_toolchains.py",
- "--x86-version", Var("x86_toolchain_version"),
- "--pnacl-version", Var("pnacl_toolchain_version"),
- "--arm-trusted-version", Var("arm_trusted_toolchain_version"),
- "--toolchain-dir", "src/toolchain",
- "--save-downloads-dir", "src/build_tools/toolchain_archives",
- ]
- },
- {
- "pattern": ".",
- "action": [
- "python",
- "src/build_tools/install_third_party.py", "--all-toolchains",
- ]
- }
-]
diff --git a/native_client_sdk/src/build_tools/build.scons b/native_client_sdk/src/build_tools/build.scons
index 16d86f1..d0d2185 100644
--- a/native_client_sdk/src/build_tools/build.scons
+++ b/native_client_sdk/src/build_tools/build.scons
@@ -132,10 +132,7 @@ if env['IS_WINDOWS']:
import gyp_extract
-ppapi_base = os.path.join(env['ROOT_DIR'],
- 'third_party',
- 'native_client',
- 'ppapi')
+ppapi_base = os.path.join(env['SRC_DIR'], 'ppapi')
# Load ppapi_cpp.gypi
ppapi_cpp_gypi = gyp_extract.LoadGypFile(os.path.join(ppapi_base,
@@ -256,7 +253,7 @@ def build_nacl_tools(env, target, source):
'--jobs',
env['JOB_COUNT'],
'--nacl_dir',
- os.path.join(env['ROOT_DIR'], 'third_party', 'native_client'),
+ env['SRC_DIR'],
]
if env.GetOption('clean'):
make_nacl_tools_args.extend(['--clean'])
diff --git a/native_client_sdk/src/build_tools/build_utils.py b/native_client_sdk/src/build_tools/build_utils.py
index 28cd095..60bdc80 100644
--- a/native_client_sdk/src/build_tools/build_utils.py
+++ b/native_client_sdk/src/build_tools/build_utils.py
@@ -110,7 +110,12 @@ def NormalizeToolchain(toolchain=TOOLCHAIN_AUTODETECT,
variant=nacl_utils.DEFAULT_TOOLCHAIN_VARIANT):
if toolchain == TOOLCHAIN_AUTODETECT:
if base_dir is None:
- base_dir = os.getenv('NACL_SDK_ROOT', '')
+ script_path = os.path.abspath(__file__)
+ script_dir = os.path.dirname(script_path)
+ sdk_src_dir = os.path.dirname(script_dir)
+ sdk_dir = os.path.dirname(sdk_src_dir)
+ src_dir = os.path.dirname(sdk_dir)
+ base_dir = os.path.join(src_dir, 'native_client')
normalized_toolchain = nacl_utils.ToolchainPath(base_dir=base_dir,
arch=arch,
variant=variant)
@@ -235,11 +240,7 @@ class BotAnnotator:
self._stream.flush()
def BuildStep(self, name):
- self.Print("BUILD_STEP %s" % name)
- # mball: Disabling buildbot annotations because it's more confusing than
- # useful when running multiple jobs simultaneously. To re-enable
- # annotations, using the following line instead of the previous:
- # self.Print("@@@BUILD_STEP %s@@@" % name)
+ self.Print("@@@BUILD_STEP %s@@@" % name)
def BuildStepFailure(self):
'''Signal a failure in the current build step to the annotator'''
diff --git a/native_client_sdk/src/build_tools/buildbot_run.py b/native_client_sdk/src/build_tools/buildbot_run.py
index ddaf723..a1fb494 100755
--- a/native_client_sdk/src/build_tools/buildbot_run.py
+++ b/native_client_sdk/src/build_tools/buildbot_run.py
@@ -10,8 +10,11 @@ import subprocess
import sys
# Add scons to the python path (as nacl_utils.py requires it).
-PARENT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
-sys.path.append(os.path.join(PARENT_DIR, 'third_party/scons-2.0.1/engine'))
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR)
+SDK_DIR = os.path.dirname(SDK_SRC_DIR)
+SRC_DIR = os.path.dirname(SDK_DIR)
+sys.path.append(os.path.join(SRC_DIR, 'third_party/scons-2.0.1/engine'))
import build_utils
@@ -34,10 +37,11 @@ def Archive(revision, chrome_milestone):
dst = 'naclsdk_linux.tgz'
bucket_path = 'nativeclient-mirror/nacl/nacl_sdk/pepper_%s_%s/%s' % (
chrome_milestone, revision, dst)
+ full_src = os.path.join(SDK_DIR, src)
full_dst = 'gs://%s' % bucket_path
subprocess.check_call(
'/b/build/scripts/slave/gsutil cp -a public-read %s %s' % (
- src, full_dst), shell=True)
+ full_src, full_dst), shell=True)
url = 'https://commondatastorage.googleapis.com/%s' % bucket_path
print '@@@STEP_LINK@download@%s@@@' % url
sys.stdout.flush()
@@ -58,11 +62,19 @@ def main(argv):
sys.stdout.flush()
subprocess.check_call(' '.join(parameters), shell=True, cwd=parent_dir)
+ print '@@@BUILD_STEP install third party@@@'
+ sys.stdout.flush()
+ subprocess.check_call(' '.join([
+ sys.executable,
+ 'build_tools/install_third_party.py',
+ '--all-toolchains',
+ ]), shell=True, cwd=parent_dir)
+
print '@@@BUILD_STEP generate sdk@@@'
sys.stdout.flush()
Run(params + ['-c'])
- Run(params + ['bot'])
+ Run(params + ['bot', '-j1'])
# Archive on non-trybots.
if '-sdk' in os.environ.get('BUILDBOT_BUILDERNAME', ''):
diff --git a/native_client_sdk/src/build_tools/generate_installers.py b/native_client_sdk/src/build_tools/generate_installers.py
index b83f491..9160a1d 100755
--- a/native_client_sdk/src/build_tools/generate_installers.py
+++ b/native_client_sdk/src/build_tools/generate_installers.py
@@ -83,19 +83,28 @@ def main(argv):
else:
all_contents += installer_contents.LINUX_ONLY_CONTENTS
- all_contents_string = string.join(
+ total_contents = (
installer_contents.GetFilesFromPathList(all_contents) +
- installer_contents.GetDirectoriesFromPathList(all_contents),
- ' ')
- tar_cf = subprocess.Popen('tar cf - %s' % all_contents_string,
- bufsize=-1,
- cwd=tar_src_dir, env=env, shell=True,
- stdout=subprocess.PIPE)
- tar_xf = subprocess.Popen('tar xfv -',
- cwd=installer_dir, env=env, shell=True,
- stdin=tar_cf.stdout)
- assert tar_xf.wait() == 0
- assert tar_cf.poll() == 0
+ installer_contents.GetDirectoriesFromPathList(all_contents)
+ )
+ for item in total_contents:
+ itemf = installer_contents.FilterPathLayout(item)
+ src = itemf[0]
+ src_dir = os.path.join(tar_src_dir, itemf[1])
+ dst_dir = os.path.join(installer_dir, itemf[2])
+ print 'Tarring "%s" in "%s" then untarring in "%s"' % (
+ src, src_dir, dst_dir)
+ if not os.path.exists(dst_dir):
+ os.makedirs(dst_dir)
+ tar_cf = subprocess.Popen('tar cf - %s' % src,
+ bufsize=-1,
+ cwd=src_dir, env=env, shell=True,
+ stdout=subprocess.PIPE)
+ tar_xf = subprocess.Popen('tar xfv -',
+ cwd=dst_dir, env=env, shell=True,
+ stdin=tar_cf.stdout)
+ assert tar_xf.wait() == 0
+ assert tar_cf.poll() == 0
# This loop prunes the result of os.walk() at each excluded dir, so that it
# doesn't descend into the excluded dir.
diff --git a/native_client_sdk/src/build_tools/generate_windows_installer.py b/native_client_sdk/src/build_tools/generate_windows_installer.py
index a87b19e..cf6db7d 100755
--- a/native_client_sdk/src/build_tools/generate_windows_installer.py
+++ b/native_client_sdk/src/build_tools/generate_windows_installer.py
@@ -38,7 +38,7 @@ def main(argv):
# Create a temporary directory using the version string, then move the
# contents of src to that directory, clean the directory of unwanted
# stuff and finally create an installer.
- temp_dir = os.path.join(script_dir, 'installers_temp')
+ temp_dir = '/naclsdk_temp'
installer_dir = os.path.join(temp_dir, version_dir)
bot.Print('generate_windows_installer chose installer directory: %s' %
(installer_dir))
@@ -53,12 +53,15 @@ def main(argv):
env['NACL_TARGET_PLATFORM'] = '.' # Use the repo's toolchain.
# Build the experimental projects.
- bot.BuildStep('build experimental')
- bot.Print('generate_windows_installer is building the experimental projects.')
- experimental_path = os.path.join(home_dir, 'src', 'experimental')
- scons_path = os.path.join(experimental_path, 'scons.bat')
- scons_cmd = scons_path + ' --nacl-platform="."'
- subprocess.check_call(scons_cmd, cwd=experimental_path, env=env)
+ # DISABLED FOR NOW.
+ if False:
+ bot.BuildStep('build experimental')
+ bot.Print('generate_windows_installer is '
+ 'building the experimental projects.')
+ experimental_path = os.path.join(home_dir, 'src', 'experimental')
+ scons_path = os.path.join(experimental_path, 'scons.bat')
+ scons_cmd = scons_path + ' --nacl-platform="."'
+ subprocess.check_call(scons_cmd, cwd=experimental_path, env=env)
# On windows we use copytree to copy the SDK into the build location
# because there is no native tar and using cygwin's version has proven
@@ -74,7 +77,11 @@ def main(argv):
installer_contents.WINDOWS_ONLY_CONTENTS
for copy_source_dir in installer_contents.GetDirectoriesFromPathList(
all_contents):
- copy_target_dir = os.path.join(installer_dir, copy_source_dir)
+ itemf = installer_contents.FilterPathLayout(copy_source_dir)
+ dst_dir = os.path.join(installer_dir, itemf[2])
+ if not os.path.exists(dst_dir):
+ os.makedirs(dst_dir)
+ copy_target_dir = os.path.join(dst_dir, itemf[0])
bot.Print("Copying %s to %s" % (copy_source_dir, copy_target_dir))
shutil.copytree(copy_source_dir,
copy_target_dir,
@@ -82,7 +89,8 @@ def main(argv):
ignore=shutil.ignore_patterns(*IGNORE_PATTERN))
for copy_source_file in installer_contents.GetFilesFromPathList(
all_contents):
- copy_target_file = os.path.join(installer_dir, copy_source_file)
+ itemf = installer_contents.FilterPathLayout(copy_source_file)
+ copy_target_file = os.path.join(installer_dir, itemf[2], itemf[0])
bot.Print("Copying %s to %s" % (copy_source_file, copy_target_file))
if not os.path.exists(os.path.dirname(copy_target_file)):
os.makedirs(os.path.dirname(copy_target_file))
diff --git a/native_client_sdk/src/build_tools/install_nsis.py b/native_client_sdk/src/build_tools/install_nsis.py
index 99f3bea..793d5c5 100644
--- a/native_client_sdk/src/build_tools/install_nsis.py
+++ b/native_client_sdk/src/build_tools/install_nsis.py
@@ -10,18 +10,25 @@ import subprocess
import zipfile
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR)
+SRC_DIR = os.path.dirname(os.path.dirname(SDK_SRC_DIR))
+THIRD_PARTY_DIR = os.path.join(SRC_DIR, 'third_party')
+BIN_DIR = os.path.join(THIRD_PARTY_DIR, 'nacl_sdk_binaries')
+
# The name of the archive that contains the AccessControl extensions.
-ACCESS_CONTROL_ZIP = 'AccessControl.zip'
+ACCESS_CONTROL_ZIP = os.path.join(BIN_DIR, 'AccessControl.zip')
# The AccessControl plugin. The installer check for this before installing.
ACCESS_CONTROL_DLL = 'AccessControl.dll'
# The name of the MkLnk extension DLL. This is checked into the SDK repo.
-MKLINK_DLL = os.path.join('MkLink', 'Release Unicode', 'MkLink.dll')
+MKLINK_DLL = os.path.join(SCRIPT_DIR,
+ 'MkLink', 'Release Unicode', 'MkLink.dll')
# The NSIS compiler. The installer checks for this before installing.
NSIS_COMPILER = 'makensis.exe'
# The default directory name for the NSIS installation.
NSIS_DIR = 'NSIS'
# The name of the NSIS installer. This file is checked into the SDK repo.
-NSIS_INSTALLER = 'nsis-2.46-Unicode-setup.exe'
+NSIS_INSTALLER = os.path.join(BIN_DIR, 'nsis-2.46-Unicode-setup.exe')
def MakeDirsIgnoreExist(dir_path, mode=0755):
'''Recursively make a directory path.
diff --git a/native_client_sdk/src/build_tools/install_third_party.py b/native_client_sdk/src/build_tools/install_third_party.py
index 431a684..6510f4b6 100755
--- a/native_client_sdk/src/build_tools/install_third_party.py
+++ b/native_client_sdk/src/build_tools/install_third_party.py
@@ -19,8 +19,10 @@ from optparse import OptionParser
# Append to PYTHONPATH in this very non-compliant way so that this script can be
# run from a DEPS hook, where the normal path rules don't apply.
-SCRIPT_DIR = os.path.abspath(os.path.dirname(__file__))
-THIRD_PARTY_DIR = os.path.join(os.path.dirname(SCRIPT_DIR), 'third_party')
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR)
+SRC_DIR = os.path.dirname(os.path.dirname(SDK_SRC_DIR))
+THIRD_PARTY_DIR = os.path.join(SRC_DIR, 'third_party')
SCONS_DIR = os.path.join(THIRD_PARTY_DIR, 'scons-2.0.1', 'engine')
sys.path.append(SCRIPT_DIR)
sys.path.append(SCONS_DIR)
diff --git a/native_client_sdk/src/build_tools/installer_contents.py b/native_client_sdk/src/build_tools/installer_contents.py
index f9e5549..8304ce8 100644
--- a/native_client_sdk/src/build_tools/installer_contents.py
+++ b/native_client_sdk/src/build_tools/installer_contents.py
@@ -51,29 +51,30 @@ INSTALLER_CONTENTS = [
'project_templates/init_project.py',
'project_templates/scons',
'project_templates/vs/',
- 'third_party/scons-2.0.1/',
+ '../../third_party/scons-2.0.1/',
]
-INSTALLER_CONTENTS.append('%s/' % nacl_utils.ToolchainPath(base_dir='',
- variant='newlib'))
-INSTALLER_CONTENTS.append('%s/' % nacl_utils.ToolchainPath(base_dir='',
- variant='glibc'))
+INSTALLER_CONTENTS.append('%s/' % nacl_utils.ToolchainPath(
+ base_dir='../../native_client', variant='newlib'))
+INSTALLER_CONTENTS.append('%s/' % nacl_utils.ToolchainPath(
+ base_dir='../../native_client', variant='glibc'))
LINUX_ONLY_CONTENTS = [
- 'third_party/ppapi/',
+ '../../ppapi/',
]
MAC_ONLY_CONTENTS = [
- 'third_party/ppapi/',
+ '../../ppapi/',
]
WINDOWS_ONLY_CONTENTS = [
'examples/httpd.cmd',
'examples/scons.bat',
'project_templates/scons.bat',
- 'debugger/nacl-gdb_server/x64/Release/',
- 'debugger/nacl-gdb_server/Release/',
- 'debugger/nacl-bpad/x64/Release/'
+# Dropping debugger.
+# 'debugger/nacl-gdb_server/x64/Release/',
+# 'debugger/nacl-gdb_server/Release/',
+# 'debugger/nacl-bpad/x64/Release/'
]
# These files are user-readable documentation files, and as such get some
@@ -178,3 +179,35 @@ def GetFilesFromPathList(path_list):
'''
return ConvertToOSPaths(
[dir for dir in path_list if not dir.endswith('/')])
+
+
+def FilterPathLayout(path):
+ '''Given a path, decide how it should be copied.
+
+ The SDK was originally layed out homogeneously with the generated
+ installer. Inside the chromium tree, this is not longer desireable.
+ This function compenstates.
+
+ Args:
+ path: A path to install.
+
+ Returns:
+ A list of [src path to tar, cwd when taring src, dst to untar in].
+ '''
+ # Toolchain moved up to top of tree.
+ nacl_dir = '../../native_client/'.replace('/', os.sep)
+ top_dir = '../../'.replace('/', os.sep)
+ ppapi_dir = '../../ppapi/'.replace('/', os.sep)
+
+ # Use toolchain from nacl_dir.
+ if path.startswith(nacl_dir):
+ return [os.path.join('.', path[len(nacl_dir):]), nacl_dir, '.']
+ # Use ppapi directly, but put in third_party.
+ if path.startswith(ppapi_dir):
+ return [os.path.join('.', path[len(ppapi_dir):]), ppapi_dir,
+ 'third_party/ppapi']
+ # Third party is used from top of tree (for scons).
+ if path.startswith(top_dir):
+ return [os.path.join('.', path[len(top_dir):]), top_dir, '.']
+ # Normal case.
+ return [path, '.', '.']
diff --git a/native_client_sdk/src/build_tools/sdk_tools/set_nacl_env.py b/native_client_sdk/src/build_tools/sdk_tools/set_nacl_env.py
index 1cc3581..f2a65a8 100755
--- a/native_client_sdk/src/build_tools/sdk_tools/set_nacl_env.py
+++ b/native_client_sdk/src/build_tools/sdk_tools/set_nacl_env.py
@@ -137,7 +137,9 @@ def GetNaclSdkRoot():
if 'NACL_SDK_ROOT' in os.environ:
return os.environ['NACL_SDK_ROOT']
else:
- return os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+ SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
+ SRC_DIR = os.path.dirname(os.path.dirname(os.path.dirname(SCRIPT_DIR)))
+ return os.path.join(SRC_DIR, 'native_client')
def GetToolchainPath(options):
diff --git a/native_client_sdk/src/build_tools/tests/build_utils_test.py b/native_client_sdk/src/build_tools/tests/build_utils_test.py
index 67f0092..8f7ddb4 100755
--- a/native_client_sdk/src/build_tools/tests/build_utils_test.py
+++ b/native_client_sdk/src/build_tools/tests/build_utils_test.py
@@ -45,7 +45,7 @@ class TestBuildUtils(unittest.TestCase):
stdout_mock = self.mock_factory.CreateMock(sys.stdout)
stdout_mock.write("My Bot Message\n")
stdout_mock.flush()
- stdout_mock.write("BUILD_STEP MyBuildStep\n")
+ stdout_mock.write("@@@BUILD_STEP MyBuildStep@@@\n")
stdout_mock.flush()
self.mock_factory.ReplayAll()
bot = build_utils.BotAnnotator(stdout_mock)
diff --git a/native_client_sdk/src/build_tools/tests/installer_contents_test.py b/native_client_sdk/src/build_tools/tests/installer_contents_test.py
index de07dd2..b1f903e 100755
--- a/native_client_sdk/src/build_tools/tests/installer_contents_test.py
+++ b/native_client_sdk/src/build_tools/tests/installer_contents_test.py
@@ -45,7 +45,7 @@ class TestInstallerContents(unittest.TestCase):
self.assertEqual(output[2], '')
self.assertEqual(output[3], os.path.join('abs', 'path'))
- def testGetToolchainManifest(self):
+ def DISABLEDtestGetToolchainManifest(self):
self.assertRaises(KeyError,
installer_contents.GetToolchainManifest,
'notatoolchain')
diff --git a/native_client_sdk/src/build_tools/tests/set_nacl_env_test.py b/native_client_sdk/src/build_tools/tests/set_nacl_env_test.py
index 143a584..f1ad4e7 100755
--- a/native_client_sdk/src/build_tools/tests/set_nacl_env_test.py
+++ b/native_client_sdk/src/build_tools/tests/set_nacl_env_test.py
@@ -18,6 +18,8 @@ from build_tools.sdk_tools import set_nacl_env
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
SDK_ROOT_DIR = os.path.dirname(os.path.dirname(SCRIPT_DIR))
+SRC_DIR = os.path.dirname(os.path.dirname(SDK_ROOT_DIR))
+NACL_DIR = os.path.join(SRC_DIR, 'native_client')
class FakeOptions(object):
@@ -31,14 +33,14 @@ class TestSetNaclEnv(unittest.TestCase):
self._options = FakeOptions()
self._options.host = 'mac'
self._options.lib_variant = 'newlib'
- self._options.sdk_root = SDK_ROOT_DIR
+ self._options.sdk_root = NACL_DIR
self._options.sdk_platform = 'pepper_17'
self._options.build_type = 'debug'
self._options.no_ppapi = False
self._options.merge = False
self._env = {}
- self._env['NACL_SDK_ROOT'] = SDK_ROOT_DIR
+ self._env['NACL_SDK_ROOT'] = NACL_DIR
self._temp_dir = tempfile.mkdtemp(prefix='tmp_set_nacl_env_test')
diff --git a/native_client_sdk/src/codereview.settings b/native_client_sdk/src/codereview.settings
deleted file mode 100644
index 2f625f4..0000000
--- a/native_client_sdk/src/codereview.settings
+++ /dev/null
@@ -1,9 +0,0 @@
-# This file is used by gcl to get repository specific information.
-CODE_REVIEW_SERVER: codereview.chromium.org
-CC_LIST: native-client-reviews@googlegroups.com
-VIEW_VC: http://code.google.com/p/nativeclient-sdk/source/detail?r=
-STATUS: http://naclsdk-status.appspot.com/status
-TRY_ON_UPLOAD: True
-TRYSERVER_PROJECT: naclsdkm
-TRYSERVER_SVN_URL: svn://svn.chromium.org/chrome-try/try-nacl
-DEPTH: 0
diff --git a/native_client_sdk/src/examples/scons b/native_client_sdk/src/examples/scons
index 7742fd7..d4daf81 100755
--- a/native_client_sdk/src/examples/scons
+++ b/native_client_sdk/src/examples/scons
@@ -4,9 +4,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
readonly SCRIPT_DIR="$(dirname "$0")"
readonly SCRIPT_DIR_ABS="$(cd "${SCRIPT_DIR}" ; pwd -P)"
+readonly SRC_DIR="$(dirname $(dirname $(dirname ${SCRIPT_DIR_ABS})))"
# NACL_SDK_ROOT must be set.
if [ x"${NACL_SDK_ROOT}"x == "xx" ] ; then
@@ -25,15 +25,23 @@ if [ x"${NACL_TARGET_PLATFORM}"x == "xx" ] ; then
fi
readonly NACL_PLATFORM_DIR="${NACL_SDK_ROOT}/${NACL_TARGET_PLATFORM}"
-readonly BASE_SCRIPT="${NACL_PLATFORM_DIR}/third_party/scons-2.0.1/script/scons"
-export SCONS_LIB_DIR="${NACL_PLATFORM_DIR}/third_party/scons-2.0.1/engine"
-export PYTHONPATH="${NACL_PLATFORM_DIR}/third_party/scons-2.0.1/engine"
+SCONS_DIR="${NACL_PLATFORM_DIR}/third_party/scons-2.0.1"
+
+if [ ! -f ${SCONS_DIR}/script/scons ]; then
+ SCONS_DIR="${SRC_DIR}/third_party/scons-2.0.1"
+fi
+
+BASE_SCRIPT="${SCONS_DIR}/script/scons"
+
+export SCONS_LIB_DIR="${SCONS_DIR}/engine"
+export PYTHONPATH="${SCONS_LIB_DIR}"
+export PYTHONPATH="${PYTHONPATH}:${NACL_PLATFORM_DIR}/build_tools"
+
# We have to do this because scons overrides PYTHONPATH and does not preserve
# what is provided by the OS. The custom variable name won't be overwritten.
-export PYMOX="${NACL_PLATFORM_DIR}/third_party/pymox"
+export PYMOX="${NACL_PLATFORM_DIR}/third_party/pymox/src"
"${BASE_SCRIPT}" --file=build.scons \
- --site-dir="${NACL_PLATFORM_DIR}/build_tools/nacl_sdk_scons" \
+ --site-dir="${SCRIPT_DIR_ABS}/../build_tools/nacl_sdk_scons" \
$*
-
diff --git a/native_client_sdk/src/examples/scons.bat b/native_client_sdk/src/examples/scons.bat
index 2a67758..d3c6c06 100755
--- a/native_client_sdk/src/examples/scons.bat
+++ b/native_client_sdk/src/examples/scons.bat
@@ -27,17 +27,24 @@ if not defined NACL_TARGET_PLATFORM (
set NACL_PLATFORM_DIR=%NACL_SDK_ROOT%\%NACL_TARGET_PLATFORM%
-set SCONS_LIB_DIR=%NACL_PLATFORM_DIR%\third_party\scons-2.0.1\engine
-set PYTHONPATH=%NACL_PLATFORM_DIR%\third_party\scons-2.0.1\engine
+set SCONS_DIR=%NACL_PLATFORM_DIR%\third_party\scons-2.0.1
+if exist %SCONS_DIR% goto gotscons
+set SCONS_DIR=%~dp0..\..\..\third_party\scons-2.0.1
+:gotscons
+
+set SCONS_LIB_DIR=%SCONS_DIR%\engine
+set PYTHONPATH=%SCONS_LIB_DIR%;%NACL_PLATFORM_DIR%\build_tools
:: We have to do this because scons overrides PYTHONPATH and does not preserve
:: what is provided by the OS. The custom variable name won't be overwritten.
-set PYMOX=%NACL_PLATFORM_DIR%\third_party\pymox
+set PYMOX=%NACL_PLATFORM_DIR%\third_party\pymox\src
+
+set BASE_SCRIPT=%SCONS_DIR%\script\scons
:: Run the included copy of scons.
-python -O -OO "%NACL_PLATFORM_DIR%\third_party\scons-2.0.1\script\scons" ^
+python -O -OO %BASE_SCRIPT% ^
--warn no-visual-c-missing ^
--file=build.scons ^
---site-dir="%NACL_PLATFORM_DIR%\build_tools\nacl_sdk_scons" %*
+--site-dir="%~dp0..\build_tools\nacl_sdk_scons" %*
:end
diff --git a/native_client_sdk/src/libraries/scons b/native_client_sdk/src/libraries/scons
index 053e32d..d4daf81 100755
--- a/native_client_sdk/src/libraries/scons
+++ b/native_client_sdk/src/libraries/scons
@@ -6,6 +6,7 @@
readonly SCRIPT_DIR="$(dirname "$0")"
readonly SCRIPT_DIR_ABS="$(cd "${SCRIPT_DIR}" ; pwd -P)"
+readonly SRC_DIR="$(dirname $(dirname $(dirname ${SCRIPT_DIR_ABS})))"
# NACL_SDK_ROOT must be set.
if [ x"${NACL_SDK_ROOT}"x == "xx" ] ; then
@@ -24,15 +25,23 @@ if [ x"${NACL_TARGET_PLATFORM}"x == "xx" ] ; then
fi
readonly NACL_PLATFORM_DIR="${NACL_SDK_ROOT}/${NACL_TARGET_PLATFORM}"
-readonly BASE_SCRIPT="${NACL_PLATFORM_DIR}/third_party/scons-2.0.1/script/scons"
-export SCONS_LIB_DIR="${NACL_PLATFORM_DIR}/third_party/scons-2.0.1/engine"
-export PYTHONPATH="${NACL_PLATFORM_DIR}/third_party/scons-2.0.1/engine:${NACL_PLATFORM_DIR}/build_tools"
+SCONS_DIR="${NACL_PLATFORM_DIR}/third_party/scons-2.0.1"
+
+if [ ! -f ${SCONS_DIR}/script/scons ]; then
+ SCONS_DIR="${SRC_DIR}/third_party/scons-2.0.1"
+fi
+
+BASE_SCRIPT="${SCONS_DIR}/script/scons"
+
+export SCONS_LIB_DIR="${SCONS_DIR}/engine"
+export PYTHONPATH="${SCONS_LIB_DIR}"
+export PYTHONPATH="${PYTHONPATH}:${NACL_PLATFORM_DIR}/build_tools"
+
# We have to do this because scons overrides PYTHONPATH and does not preserve
# what is provided by the OS. The custom variable name won't be overwritten.
-export PYMOX="${NACL_PLATFORM_DIR}/third_party/pymox"
+export PYMOX="${NACL_PLATFORM_DIR}/third_party/pymox/src"
"${BASE_SCRIPT}" --file=build.scons \
- --site-dir="${NACL_PLATFORM_DIR}/build_tools/nacl_sdk_scons" \
+ --site-dir="${SCRIPT_DIR_ABS}/../build_tools/nacl_sdk_scons" \
$*
-
diff --git a/native_client_sdk/src/libraries/scons.bat b/native_client_sdk/src/libraries/scons.bat
index 889a757..d3c6c06 100755
--- a/native_client_sdk/src/libraries/scons.bat
+++ b/native_client_sdk/src/libraries/scons.bat
@@ -27,17 +27,24 @@ if not defined NACL_TARGET_PLATFORM (
set NACL_PLATFORM_DIR=%NACL_SDK_ROOT%\%NACL_TARGET_PLATFORM%
-set SCONS_LIB_DIR=%NACL_PLATFORM_DIR%\third_party\scons-2.0.1\engine
-set PYTHONPATH=%NACL_PLATFORM_DIR%\third_party\scons-2.0.1\engine;%NACL_PLATFORM_DIR%\build_tools
+set SCONS_DIR=%NACL_PLATFORM_DIR%\third_party\scons-2.0.1
+if exist %SCONS_DIR% goto gotscons
+set SCONS_DIR=%~dp0..\..\..\third_party\scons-2.0.1
+:gotscons
+
+set SCONS_LIB_DIR=%SCONS_DIR%\engine
+set PYTHONPATH=%SCONS_LIB_DIR%;%NACL_PLATFORM_DIR%\build_tools
:: We have to do this because scons overrides PYTHONPATH and does not preserve
:: what is provided by the OS. The custom variable name won't be overwritten.
-set PYMOX=%NACL_PLATFORM_DIR%\third_party\pymox
+set PYMOX=%NACL_PLATFORM_DIR%\third_party\pymox\src
+
+set BASE_SCRIPT=%SCONS_DIR%\script\scons
:: Run the included copy of scons.
-python -O -OO "%NACL_PLATFORM_DIR%\third_party\scons-2.0.1\script\scons" ^
+python -O -OO %BASE_SCRIPT% ^
--warn no-visual-c-missing ^
--file=build.scons ^
---site-dir="%NACL_PLATFORM_DIR%\build_tools\nacl_sdk_scons" %*
+--site-dir="%~dp0..\build_tools\nacl_sdk_scons" %*
:end
diff --git a/native_client_sdk/src/main.scons b/native_client_sdk/src/main.scons
index c83e448..d9eac4e 100644
--- a/native_client_sdk/src/main.scons
+++ b/native_client_sdk/src/main.scons
@@ -101,6 +101,7 @@ base_env = Environment(
build_utils.NormalizeToolchain(arch='x86', variant='glibc'),
},
ROOT_DIR = os.path.abspath(os.getcwd()),
+ SRC_DIR = os.path.dirname(os.path.dirname(os.path.abspath(os.getcwd()))),
IS_WINDOWS = sys.platform in ['cygwin', 'win32'],
IS_LINUX = sys.platform == 'linux2',
IS_MAC = sys.platform == 'darwin',
diff --git a/native_client_sdk/src/project_templates/scons b/native_client_sdk/src/project_templates/scons
index 2b7e0d3..d4daf81 100755
--- a/native_client_sdk/src/project_templates/scons
+++ b/native_client_sdk/src/project_templates/scons
@@ -4,29 +4,44 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-
readonly SCRIPT_DIR="$(dirname "$0")"
readonly SCRIPT_DIR_ABS="$(cd "${SCRIPT_DIR}" ; pwd -P)"
+readonly SRC_DIR="$(dirname $(dirname $(dirname ${SCRIPT_DIR_ABS})))"
+
+# NACL_SDK_ROOT must be set.
+if [ x"${NACL_SDK_ROOT}"x == "xx" ] ; then
+ echo "Error: NACL_SDK_ROOT is not set."
+ exit 1;
+fi
-export NACL_SDK_ROOT=<NACL_SDK_ROOT>
# NACL_TARGET_PLATFORM is really the name of a folder with the base dir -
# usually NACL_SDK_ROOT - within which the toolchain for the target platform
# are found.
# Replace the platform with the name of your target platform. For example, to
# build applications that target the pepper_17 API, set
# NACL_TARGET_PLATFORM="pepper_17"
-export NACL_TARGET_PLATFORM="<NACL_PLATFORM>"
+if [ x"${NACL_TARGET_PLATFORM}"x == "xx" ] ; then
+ export NACL_TARGET_PLATFORM="pepper_17"
+fi
readonly NACL_PLATFORM_DIR="${NACL_SDK_ROOT}/${NACL_TARGET_PLATFORM}"
-readonly BASE_SCRIPT="${NACL_PLATFORM_DIR}/third_party/scons-2.0.1/script/scons"
-export SCONS_LIB_DIR="${NACL_PLATFORM_DIR}/third_party/scons-2.0.1/engine"
-export PYTHONPATH="${NACL_PLATFORM_DIR}/third_party/scons-2.0.1/engine"
+SCONS_DIR="${NACL_PLATFORM_DIR}/third_party/scons-2.0.1"
+
+if [ ! -f ${SCONS_DIR}/script/scons ]; then
+ SCONS_DIR="${SRC_DIR}/third_party/scons-2.0.1"
+fi
+
+BASE_SCRIPT="${SCONS_DIR}/script/scons"
+
+export SCONS_LIB_DIR="${SCONS_DIR}/engine"
+export PYTHONPATH="${SCONS_LIB_DIR}"
+export PYTHONPATH="${PYTHONPATH}:${NACL_PLATFORM_DIR}/build_tools"
+
# We have to do this because scons overrides PYTHONPATH and does not preserve
# what is provided by the OS. The custom variable name won't be overwritten.
-export PYMOX="${NACL_PLATFORM_DIR}/third_party/pymox"
+export PYMOX="${NACL_PLATFORM_DIR}/third_party/pymox/src"
"${BASE_SCRIPT}" --file=build.scons \
- --site-dir="${NACL_PLATFORM_DIR}/build_tools/nacl_sdk_scons" \
+ --site-dir="${SCRIPT_DIR_ABS}/../build_tools/nacl_sdk_scons" \
$*
-
diff --git a/native_client_sdk/src/project_templates/scons.bat b/native_client_sdk/src/project_templates/scons.bat
index f487e28..d3c6c06 100755
--- a/native_client_sdk/src/project_templates/scons.bat
+++ b/native_client_sdk/src/project_templates/scons.bat
@@ -6,26 +6,45 @@
setlocal
-set NACL_SDK_ROOT=<NACL_SDK_ROOT>
+:: NACL_SDK_ROOT must be set.
+if not defined NACL_SDK_ROOT (
+ echo Error: NACL_SDK_ROOT is not set.
+ echo Please set NACL_SDK_ROOT to the full path of the Native Client SDK.
+ echo For example:
+ echo set NACL_SDK_ROOT=D:\nacl_sdk
+ goto end
+)
+
:: NACL_TARGET_PLATFORM is really the name of a folder with the base dir -
:: usually NACL_SDK_ROOT - within which the toolchain for the target platform
:: are found.
:: Replace the platform with the name of your target platform. For example, to
:: build applications that target the pepper_17 API, set
:: NACL_TARGET_PLATFORM=pepper_17
-set NACL_TARGET_PLATFORM=<NACL_PLATFORM>
+if not defined NACL_TARGET_PLATFORM (
+ set NACL_TARGET_PLATFORM=pepper_17
+)
set NACL_PLATFORM_DIR=%NACL_SDK_ROOT%\%NACL_TARGET_PLATFORM%
-:: Set the PYTHONPATH and SCONS_LIB_DIR so we can import SCons modules
-set SCONS_LIB_DIR=%NACL_PLATFORM_DIR%\third_party\scons-2.0.1\engine
-set PYTHONPATH=%NACL_PLATFORM_DIR%\third_party\scons-2.0.1\engine
+set SCONS_DIR=%NACL_PLATFORM_DIR%\third_party\scons-2.0.1
+if exist %SCONS_DIR% goto gotscons
+set SCONS_DIR=%~dp0..\..\..\third_party\scons-2.0.1
+:gotscons
+
+set SCONS_LIB_DIR=%SCONS_DIR%\engine
+set PYTHONPATH=%SCONS_LIB_DIR%;%NACL_PLATFORM_DIR%\build_tools
:: We have to do this because scons overrides PYTHONPATH and does not preserve
:: what is provided by the OS. The custom variable name won't be overwritten.
-set PYMOX=%NACL_PLATFORM_DIR%\third_party\pymox
+set PYMOX=%NACL_PLATFORM_DIR%\third_party\pymox\src
+
+set BASE_SCRIPT=%SCONS_DIR%\script\scons
:: Run the included copy of scons.
-python -O -OO "%NACL_PLATFORM_DIR%\third_party\scons-2.0.1\script\scons" ^
+python -O -OO %BASE_SCRIPT% ^
+--warn no-visual-c-missing ^
--file=build.scons ^
---site-dir="%NACL_PLATFORM_DIR%\build_tools\nacl_sdk_scons" %*
+--site-dir="%~dp0..\build_tools\nacl_sdk_scons" %*
+
+:end
diff --git a/native_client_sdk/src/scons b/native_client_sdk/src/scons
index c14f666..ff5918d 100755
--- a/native_client_sdk/src/scons
+++ b/native_client_sdk/src/scons
@@ -7,6 +7,7 @@
readonly SCRIPT_DIR="$(dirname "$0")"
readonly SCRIPT_DIR_ABS="$(cd "${SCRIPT_DIR}" ; pwd -P)"
+readonly SRC_DIR="$(dirname $(dirname ${SCRIPT_DIR_ABS}))"
# Use the batch file as an entry point if on cygwin.
if [ "x${OSTYPE}" = "xcygwin" ]; then
@@ -23,15 +24,15 @@ if [ "x${OSTYPE}" = "xcygwin" ]; then
exit
fi
-readonly BASE_SCRIPT="${SCRIPT_DIR_ABS}/third_party/scons-2.0.1/script/scons"
+readonly BASE_SCRIPT="${SRC_DIR}/third_party/scons-2.0.1/script/scons"
-export NACL_SDK_ROOT="${SCRIPT_DIR_ABS}"
+export NACL_SDK_ROOT="${SCRIPT_DIR_ABS}/../../native_client"
-export SCONS_LIB_DIR="${NACL_SDK_ROOT}/third_party/scons-2.0.1/engine"
-export PYTHONPATH="${SCRIPT_DIR_ABS}/third_party/scons-2.0.1/engine:${SCRIPT_DIR_ABS}/third_party/native_client/native_client/build"
+export SCONS_LIB_DIR="${SRC_DIR}/third_party/scons-2.0.1/engine"
+export PYTHONPATH="${SCONS_LIB_DIR}:${SRC_DIR}/native_client/build:${SCRIPT_DIR_ABS}"
# We have to do this because scons overrides PYTHONPATH and does not preserve
# what is provided by the OS. The custom variable name won't be overwritten.
-export PYMOX="${NACL_SDK_ROOT}/third_party/pymox"
+export PYMOX="${SRC_DIR}/third_party/pymox/src"
"${BASE_SCRIPT}" --file=main.scons $*
diff --git a/native_client_sdk/src/scons.bat b/native_client_sdk/src/scons.bat
index 0a6d3db..7407b68 100755
--- a/native_client_sdk/src/scons.bat
+++ b/native_client_sdk/src/scons.bat
@@ -6,23 +6,23 @@
setlocal
-set NACL_SDK_ROOT=%~dp0
+set NACL_SDK_ROOT=%~dp0..\..\native_client
:: Preserve a copy of the PATH (in case we need it later, mainly for cygwin).
set PRESCONS_PATH=%PATH%
:: Set the PYTHONPATH and SCONS_LIB_DIR so we can import SCons modules
-set SCONS_LIB_DIR=%~dp0third_party\scons-2.0.1\engine
-set PYTHONPATH=%~dp0third_party\scons-2.0.1\engine;%~dp0third_party\native_client\native_client\build
+set SCONS_LIB_DIR=%~dp0..\..\third_party\scons-2.0.1\engine
+set PYTHONPATH=%~dp0..\..\third_party\scons-2.0.1\engine;%~dp0..\..\native_client\build;%~dp0
:: We have to do this because scons overrides PYTHONPATH and does not preserve
:: what is provided by the OS. The custom variable name won't be overwritten.
-set PYMOX=%~dp0third_party\pymox
+set PYMOX=%~dp0..\..\third_party\pymox\src
:: Stop incessant CYGWIN complains about "MS-DOS style path"
set CYGWIN=nodosfilewarning %CYGWIN%
:: Run the included copy of scons.
-python -O -OO "%~dp0third_party\scons-2.0.1\script\scons" --file=main.scons %*
+python -O -OO "%~dp0..\..\third_party\scons-2.0.1\script\scons" --file=main.scons %*
:end