summaryrefslogtreecommitdiffstats
path: root/native_client_sdk/src
diff options
context:
space:
mode:
authorsbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-02 18:11:57 +0000
committersbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-02 18:11:57 +0000
commit98cfbd794cf07960ba0ba11d5e1543dfb2b0d66b (patch)
tree32748ab06723004e4768d86698b1b11e56c98289 /native_client_sdk/src
parent40944d1a8d4f01bcd8ee84887d4f1519d3efa486 (diff)
downloadchromium_src-98cfbd794cf07960ba0ba11d5e1543dfb2b0d66b.zip
chromium_src-98cfbd794cf07960ba0ba11d5e1543dfb2b0d66b.tar.gz
chromium_src-98cfbd794cf07960ba0ba11d5e1543dfb2b0d66b.tar.bz2
[NaCl SDK] Allow use of goma for building libs/examples.
This also enables users of our build system to use things like cache and distcc via the NACL_COMPILER_PREFIX setting. Goma is not enabled on the bots, or by default just yet. R=binji@chromium.org, noelallen@chromium.org Review URL: https://codereview.chromium.org/17759004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@209728 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk/src')
-rwxr-xr-xnative_client_sdk/src/build_tools/build_projects.py39
-rw-r--r--native_client_sdk/src/tools/host_gcc.mk4
-rw-r--r--native_client_sdk/src/tools/nacl_gcc.mk43
-rw-r--r--native_client_sdk/src/tools/nacl_llvm.mk14
4 files changed, 59 insertions, 41 deletions
diff --git a/native_client_sdk/src/build_tools/build_projects.py b/native_client_sdk/src/build_tools/build_projects.py
index e081137..40bc52d008 100755
--- a/native_client_sdk/src/build_tools/build_projects.py
+++ b/native_client_sdk/src/build_tools/build_projects.py
@@ -3,6 +3,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import multiprocessing
import optparse
import os
import sys
@@ -39,8 +40,9 @@ def CopyFilesFromTo(filelist, srcdir, dstdir):
def UpdateHelpers(pepperdir, platform, clobber=False):
- if not os.path.exists(os.path.join(pepperdir, 'tools')):
- buildbot_common.ErrorExit('Examples depend on missing tools.')
+ tools_dir = os.path.join(pepperdir, 'tools')
+ if not os.path.exists(tools_dir):
+ buildbot_common.ErrorExit('SDK tools dir is missing: %s' % tools_dir)
exampledir = os.path.join(pepperdir, 'examples')
if clobber:
@@ -58,15 +60,15 @@ def UpdateHelpers(pepperdir, platform, clobber=False):
# Copy tools scripts and make includes
buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.py'),
- os.path.join(pepperdir, 'tools'))
+ tools_dir)
buildbot_common.CopyDir(os.path.join(SDK_SRC_DIR, 'tools', '*.mk'),
- os.path.join(pepperdir, 'tools'))
+ tools_dir)
# On Windows add a prebuilt make
if platform == 'win':
buildbot_common.BuildStep('Add MAKE')
http_download.HttpDownload(GSTORE + MAKE,
- os.path.join(pepperdir, 'tools', 'make.exe'))
+ os.path.join(tools_dir, 'make.exe'))
def ValidateToolchains(toolchains):
@@ -145,31 +147,44 @@ def BuildProjectsBranch(pepperdir, platform, branch, deps, clean, config,
verbose):
make_dir = os.path.join(pepperdir, branch)
print "\n\nMake: " + make_dir
+
if platform == 'win':
# We need to modify the environment to build host on Windows.
make = os.path.join(make_dir, 'make.bat')
else:
make = 'make'
+ env = None
+ if os.environ.get('USE_GOMA') == '1':
+ env = dict(os.environ)
+ env['NACL_COMPILER_PREFIX'] = 'gomacc'
+ # Add -m32 to the CFLAGS when building using i686-nacl-gcc
+ # otherwise goma won't recognise it as different to the x86_64
+ # build.
+ env['X86_32_CFLAGS'] = '-m32'
+ env['X86_32_CXXFLAGS'] = '-m32'
+ jobs = '50'
+ else:
+ jobs = str(multiprocessing.cpu_count())
+
+ make_cmd = [make, '-j', jobs, 'TOOLCHAIN=all']
- extra_args = ['CONFIG='+config]
+ make_cmd.append('CONFIG='+config)
if not deps:
- extra_args += ['IGNORE_DEPS=1']
+ make_cmd.append('IGNORE_DEPS=1')
if verbose:
- extra_args += ['V=1']
+ make_cmd.append('V=1')
try:
- buildbot_common.Run([make, '-j8', 'TOOLCHAIN=all'] + extra_args,
- cwd=make_dir)
+ buildbot_common.Run(make_cmd, cwd=make_dir, env=env)
except:
print 'Failed to build ' + branch
raise
if clean:
# Clean to remove temporary files but keep the built
- buildbot_common.Run([make, '-j8', 'clean', 'TOOLCHAIN=all'] + extra_args,
- cwd=make_dir)
+ buildbot_common.Run(make_cmd + ['clean'], cwd=make_dir, env=env)
def BuildProjects(pepperdir, platform, project_tree, deps=True,
diff --git a/native_client_sdk/src/tools/host_gcc.mk b/native_client_sdk/src/tools/host_gcc.mk
index 562e277..601ec81 100644
--- a/native_client_sdk/src/tools/host_gcc.mk
+++ b/native_client_sdk/src/tools/host_gcc.mk
@@ -14,8 +14,8 @@
# We use the C++ compiler for everything and then use the -Wl,-as-needed flag
# in the linker to drop libc++ unless it's actually needed.
#
-HOST_CC ?= gcc
-HOST_CXX ?= g++
+HOST_CC ?= $(NACL_COMPILER_PREFIX) gcc
+HOST_CXX ?= $(NACL_COMPILER_PREFIX) g++
HOST_LINK ?= g++
HOST_LIB ?= ar
HOST_STRIP ?= strip
diff --git a/native_client_sdk/src/tools/nacl_gcc.mk b/native_client_sdk/src/tools/nacl_gcc.mk
index b03251c..86c8679 100644
--- a/native_client_sdk/src/tools/nacl_gcc.mk
+++ b/native_client_sdk/src/tools/nacl_gcc.mk
@@ -22,26 +22,29 @@ LD_ARM := -L$(NACL_SDK_ROOT)/lib/$(TOOLCHAIN)_arm/$(CONFIG)
# We always link with the C++ compiler but include -Wl,-as-needed flag
# in LD_FLAGS so the linker should drop libc++ unless it's actually needed.
#
-X86_32_CC ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/i686-nacl-gcc
-X86_32_CXX ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/i686-nacl-g++
-X86_32_LINK ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/i686-nacl-g++
-X86_32_LIB ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/i686-nacl-ar
-X86_32_STRIP ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/i686-nacl-strip
-X86_32_NM ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/i686-nacl-nm
-
-X86_64_CC ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/x86_64-nacl-gcc
-X86_64_CXX ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/x86_64-nacl-g++
-X86_64_LINK ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/x86_64-nacl-g++
-X86_64_LIB ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/x86_64-nacl-ar
-X86_64_STRIP ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/x86_64-nacl-strip
-X86_64_NM ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin/x86_64-nacl-nm
-
-ARM_CC ?= $(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin/arm-nacl-gcc
-ARM_CXX ?= $(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin/arm-nacl-g++
-ARM_LINK ?= $(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin/arm-nacl-g++
-ARM_LIB ?= $(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin/arm-nacl-ar
-ARM_STRIP ?= $(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin/arm-nacl-strip
-ARM_NM ?= $(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin/arm-nacl-nm
+X86_TC_BIN ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/bin
+ARM_TC_BIN ?= $(TC_PATH)/$(OSNAME)_arm_$(TOOLCHAIN)/bin
+
+X86_32_CC ?= $(NACL_COMPILER_PREFIX) $(X86_TC_BIN)/i686-nacl-gcc
+X86_32_CXX ?= $(NACL_COMPILER_PREFIX) $(X86_TC_BIN)/i686-nacl-g++
+X86_32_LINK ?= $(X86_TC_BIN)/i686-nacl-g++
+X86_32_LIB ?= $(X86_TC_BIN)/i686-nacl-ar
+X86_32_STRIP ?= $(X86_TC_BIN)/i686-nacl-strip
+X86_32_NM ?= $(X86_TC_BIN)/i686-nacl-nm
+
+X86_64_CC ?= $(NACL_COMPILER_PREFIX) $(X86_TC_BIN)/x86_64-nacl-gcc
+X86_64_CXX ?= $(NACL_COMPILER_PREFIX) $(X86_TC_BIN)/x86_64-nacl-g++
+X86_64_LINK ?= $(X86_TC_BIN)/x86_64-nacl-g++
+X86_64_LIB ?= $(X86_TC_BIN)/x86_64-nacl-ar
+X86_64_STRIP ?= $(X86_TC_BIN)/x86_64-nacl-strip
+X86_64_NM ?= $(X86_TC_BIN)/x86_64-nacl-nm
+
+ARM_CC ?= $(NACL_COMPILER_PREFIX) $(ARM_TC_BIN)/arm-nacl-gcc
+ARM_CXX ?= $(NACL_COMPILER_PREFIX) $(ARM_TC_BIN)/arm-nacl-g++
+ARM_LINK ?= $(ARM_TC_BIN)/arm-nacl-g++
+ARM_LIB ?= $(ARM_TC_BIN)/arm-nacl-ar
+ARM_STRIP ?= $(ARM_TC_BIN)/arm-nacl-strip
+ARM_NM ?= $(ARM_TC_BIN)/arm-nacl-nm
# Architecture-specific flags
X86_32_CFLAGS ?=
diff --git a/native_client_sdk/src/tools/nacl_llvm.mk b/native_client_sdk/src/tools/nacl_llvm.mk
index 761343e..f6301e5 100644
--- a/native_client_sdk/src/tools/nacl_llvm.mk
+++ b/native_client_sdk/src/tools/nacl_llvm.mk
@@ -7,16 +7,16 @@
# http://www.gnu.org/software/make/manual/make.html
#
-
#
# Paths to Tools
#
-PNACL_CC ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang -c
-PNACL_CXX ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang++ -c
-PNACL_LINK ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-clang++
-PNACL_LIB ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-ar
-PNACL_STRIP ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-strip
-PNACL_FINALIZE ?= $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin/pnacl-finalize
+PNACL_BIN = $(TC_PATH)/$(OSNAME)_x86_$(TOOLCHAIN)/newlib/bin
+PNACL_CC ?= $(PNACL_BIN)/pnacl-clang -c
+PNACL_CXX ?= $(PNACL_BIN)/pnacl-clang++ -c
+PNACL_LINK ?= $(PNACL_BIN)/pnacl-clang++
+PNACL_LIB ?= $(PNACL_BIN)/pnacl-ar
+PNACL_STRIP ?= $(PNACL_BIN)/pnacl-strip
+PNACL_FINALIZE ?= $(PNACL_BIN)/pnacl-finalize
#
# Compile Macro