summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
authorbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-08 00:12:52 +0000
committerbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-08 00:12:52 +0000
commit87a7e725a8fb46f08fd7ae7db1aaa5506751e890 (patch)
treed80835b340b85739ab1ac8e5ba371316410a0710 /native_client_sdk
parentd1f355bba03332716cf667efaa5e374402404642 (diff)
downloadchromium_src-87a7e725a8fb46f08fd7ae7db1aaa5506751e890.zip
chromium_src-87a7e725a8fb46f08fd7ae7db1aaa5506751e890.tar.gz
chromium_src-87a7e725a8fb46f08fd7ae7db1aaa5506751e890.tar.bz2
[NaCl SDK] Fix examples/Makefile to build all projects. Also change the
buildscript to test this use case. BUG=126319 TEST=naclsdk buildbots TBR=noelallen1@chromium.org Review URL: https://chromiumcodereview.appspot.com/10387011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135763 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rwxr-xr-xnative_client_sdk/src/build_tools/build_sdk.py56
-rw-r--r--native_client_sdk/src/examples/Makefile10
2 files changed, 53 insertions, 13 deletions
diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py
index 4d37630..5c4315b 100755
--- a/native_client_sdk/src/build_tools/build_sdk.py
+++ b/native_client_sdk/src/build_tools/build_sdk.py
@@ -433,6 +433,40 @@ EXAMPLE_MAP = {
],
}
+def GenerateExamplesMakefile(in_path, out_path, examples):
+ """Generate a Makefile that includes only the examples supported by this
+ SDK."""
+ # Line wrap the PROJECTS variable
+ wrap_width = 80
+ projects_text = ''
+ projects_line = 'PROJECTS:='
+ for example in examples:
+ if len(projects_line + example + ' ') > wrap_width:
+ projects_text += projects_line + '\n'
+ projects_line = 'PROJECTS+='
+ projects_line += example + ' '
+
+ # Add the last unwrapped line
+ projects_text += projects_line + '\n'
+
+ out_makefile_text = ''
+ wrote_projects_text = False
+ snipping = False
+ for line in open(in_path, 'r'):
+ if line.startswith('# =SNIP='):
+ snipping = not snipping
+ continue
+
+ if snipping:
+ if not wrote_projects_text:
+ out_makefile_text += projects_text
+ wrote_projects_text = True
+ else:
+ out_makefile_text += line
+
+ open(out_path, 'w').write(out_makefile_text)
+
+
def CopyExamples(pepperdir, toolchains):
buildbot_common.BuildStep('Copy examples')
@@ -447,7 +481,7 @@ def CopyExamples(pepperdir, toolchains):
AddMakeBat(pepperdir, exampledir)
# Copy individual files
- files = ['favicon.ico', 'httpd.cmd', 'httpd.py', 'index.html', 'Makefile']
+ files = ['favicon.ico', 'httpd.cmd', 'httpd.py', 'index.html']
for filename in files:
oshelpers.Copy(['-v', os.path.join(SDK_EXAMPLE_DIR, filename), exampledir])
@@ -459,6 +493,12 @@ def CopyExamples(pepperdir, toolchains):
buildbot_common.CopyDir(os.path.join(SDK_EXAMPLE_DIR, example), exampledir)
AddMakeBat(pepperdir, os.path.join(exampledir, example))
+ # Generate a root Makefile that only includes supported examples
+ out_makefile = os.path.join(exampledir, 'Makefile')
+ print 'Generating %s' % (out_makefile,)
+ GenerateExamplesMakefile(os.path.join(SDK_EXAMPLE_DIR, 'Makefile'),
+ out_makefile, examples)
+
UPDATER_FILES = [
# launch scripts
('build_tools/naclsdk', 'nacl_sdk/naclsdk'),
@@ -682,14 +722,12 @@ def main(args):
# build examples.
if not skip_examples:
buildbot_common.BuildStep('Test Build Examples')
- filelist = os.listdir(os.path.join(pepperdir, 'examples'))
- for filenode in filelist:
- dirnode = os.path.join(pepperdir, 'examples', filenode)
- makefile = os.path.join(dirnode, 'Makefile')
- if os.path.isfile(makefile):
- print "\n\nMake: " + dirnode
- buildbot_common.Run(['make', 'all', '-j8'],
- cwd=os.path.abspath(dirnode), shell=True)
+ example_dir = os.path.join(pepperdir, 'examples')
+ makefile = os.path.join(example_dir, 'Makefile')
+ if os.path.isfile(makefile):
+ print "\n\nMake: " + example_dir
+ buildbot_common.Run(['make', '-j8'],
+ cwd=os.path.abspath(example_dir), shell=True)
# Archive on non-trybots.
buildername = os.environ.get('BUILDBOT_BUILDERNAME', '')
diff --git a/native_client_sdk/src/examples/Makefile b/native_client_sdk/src/examples/Makefile
index 16e3547..7ad5e22 100644
--- a/native_client_sdk/src/examples/Makefile
+++ b/native_client_sdk/src/examples/Makefile
@@ -7,10 +7,12 @@
#   http://www.gnu.org/software/make/manual/make.html
#
-PROJECTS:=dlopen file_histogram fullscreen_tumbler gamepad geturl
-PROJECTS:=hello_world_glibc hello_world_interactive hello_world_newlib
-PROJECTS:=input_events load_progress mouselock multithreaded_input_events
-PROJECTS:=pi_generator pong sine_synth tumbler websocket
+# =SNIP=
+# This Makefile is used as a template to generate the real Makefile that is
+# included in the SDK distribution. The toolchain-specific project lists can be
+# found in build_tools/build_sdk.py.
+$(error MISSING PROJECTS)
+# =SNIP=
# Define the default target
all: