From 21f4fb62157567eb6e1eac08927d832c7b5b89dd Mon Sep 17 00:00:00 2001 From: Shigeki Ohtsu Date: Mon, 30 Mar 2015 14:33:17 +0900 Subject: deps: update gyp to e1c8fcf7 PR-URL: https://github.com/iojs/io.js/pull/1325 Reviewed-By: Fedor Indutny Reviewed-By: Ben Noordhuis --- tools/gyp/test/dependencies/a.c | 9 +++++ tools/gyp/test/dependencies/b/b.c | 3 ++ tools/gyp/test/dependencies/b/b.gyp | 22 +++++++++++ tools/gyp/test/dependencies/b/b3.c | 9 +++++ tools/gyp/test/dependencies/c/c.c | 4 ++ tools/gyp/test/dependencies/c/c.gyp | 22 +++++++++++ tools/gyp/test/dependencies/c/d.c | 3 ++ tools/gyp/test/dependencies/double_dependency.gyp | 22 +++++++++++ tools/gyp/test/dependencies/double_dependent.gyp | 12 ++++++ tools/gyp/test/dependencies/extra_targets.gyp | 18 +++++++++ .../test/dependencies/gyptest-double-dependency.py | 19 +++++++++ .../gyp/test/dependencies/gyptest-extra-targets.py | 22 +++++++++++ tools/gyp/test/dependencies/gyptest-lib-only.py | 39 ++++++++++++++++++ .../test/dependencies/gyptest-none-traversal.py | 25 ++++++++++++ .../dependencies/gyptest-sharedlib-linksettings.py | 21 ++++++++++ tools/gyp/test/dependencies/lib_only.gyp | 16 ++++++++ tools/gyp/test/dependencies/main.c | 14 +++++++ tools/gyp/test/dependencies/none_traversal.gyp | 46 ++++++++++++++++++++++ .../dependencies/sharedlib-linksettings/program.c | 25 ++++++++++++ .../sharedlib-linksettings/sharedlib.c | 16 ++++++++ .../sharedlib-linksettings/staticlib.c | 24 +++++++++++ .../dependencies/sharedlib-linksettings/test.gyp | 37 +++++++++++++++++ 22 files changed, 428 insertions(+) create mode 100755 tools/gyp/test/dependencies/a.c create mode 100755 tools/gyp/test/dependencies/b/b.c create mode 100755 tools/gyp/test/dependencies/b/b.gyp create mode 100755 tools/gyp/test/dependencies/b/b3.c create mode 100644 tools/gyp/test/dependencies/c/c.c create mode 100644 tools/gyp/test/dependencies/c/c.gyp create mode 100644 tools/gyp/test/dependencies/c/d.c create mode 100644 tools/gyp/test/dependencies/double_dependency.gyp create mode 100644 tools/gyp/test/dependencies/double_dependent.gyp create mode 100644 tools/gyp/test/dependencies/extra_targets.gyp create mode 100644 tools/gyp/test/dependencies/gyptest-double-dependency.py create mode 100755 tools/gyp/test/dependencies/gyptest-extra-targets.py create mode 100755 tools/gyp/test/dependencies/gyptest-lib-only.py create mode 100755 tools/gyp/test/dependencies/gyptest-none-traversal.py create mode 100644 tools/gyp/test/dependencies/gyptest-sharedlib-linksettings.py create mode 100755 tools/gyp/test/dependencies/lib_only.gyp create mode 100644 tools/gyp/test/dependencies/main.c create mode 100755 tools/gyp/test/dependencies/none_traversal.gyp create mode 100644 tools/gyp/test/dependencies/sharedlib-linksettings/program.c create mode 100644 tools/gyp/test/dependencies/sharedlib-linksettings/sharedlib.c create mode 100644 tools/gyp/test/dependencies/sharedlib-linksettings/staticlib.c create mode 100644 tools/gyp/test/dependencies/sharedlib-linksettings/test.gyp (limited to 'tools/gyp/test/dependencies') diff --git a/tools/gyp/test/dependencies/a.c b/tools/gyp/test/dependencies/a.c new file mode 100755 index 0000000000..3bba111d24 --- /dev/null +++ b/tools/gyp/test/dependencies/a.c @@ -0,0 +1,9 @@ +/* Copyright (c) 2009 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +extern int funcB(); + +int funcA() { + return funcB(); +} diff --git a/tools/gyp/test/dependencies/b/b.c b/tools/gyp/test/dependencies/b/b.c new file mode 100755 index 0000000000..b5e771bcc7 --- /dev/null +++ b/tools/gyp/test/dependencies/b/b.c @@ -0,0 +1,3 @@ +int funcB() { + return 2; +} diff --git a/tools/gyp/test/dependencies/b/b.gyp b/tools/gyp/test/dependencies/b/b.gyp new file mode 100755 index 0000000000..893dc64d65 --- /dev/null +++ b/tools/gyp/test/dependencies/b/b.gyp @@ -0,0 +1,22 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'b', + 'type': 'static_library', + 'sources': [ + 'b.c', + ], + }, + { + 'target_name': 'b3', + 'type': 'static_library', + 'sources': [ + 'b3.c', + ], + }, + ], +} diff --git a/tools/gyp/test/dependencies/b/b3.c b/tools/gyp/test/dependencies/b/b3.c new file mode 100755 index 0000000000..287f67ff31 --- /dev/null +++ b/tools/gyp/test/dependencies/b/b3.c @@ -0,0 +1,9 @@ +/* + * Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +int funcB() { + return 3; +} diff --git a/tools/gyp/test/dependencies/c/c.c b/tools/gyp/test/dependencies/c/c.c new file mode 100644 index 0000000000..4949daf3ee --- /dev/null +++ b/tools/gyp/test/dependencies/c/c.c @@ -0,0 +1,4 @@ +int funcC() { + return 3 + // Intentional syntax error. This file should never be compiled, so this + // shouldn't be a problem. diff --git a/tools/gyp/test/dependencies/c/c.gyp b/tools/gyp/test/dependencies/c/c.gyp new file mode 100644 index 0000000000..eabebea9ef --- /dev/null +++ b/tools/gyp/test/dependencies/c/c.gyp @@ -0,0 +1,22 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'c_unused', + 'type': 'static_library', + 'sources': [ + 'c.c', + ], + }, + { + 'target_name': 'd', + 'type': 'static_library', + 'sources': [ + 'd.c', + ], + }, + ], +} diff --git a/tools/gyp/test/dependencies/c/d.c b/tools/gyp/test/dependencies/c/d.c new file mode 100644 index 0000000000..05465fc1af --- /dev/null +++ b/tools/gyp/test/dependencies/c/d.c @@ -0,0 +1,3 @@ +int funcD() { + return 4; +} diff --git a/tools/gyp/test/dependencies/double_dependency.gyp b/tools/gyp/test/dependencies/double_dependency.gyp new file mode 100644 index 0000000000..ca2bf1cd89 --- /dev/null +++ b/tools/gyp/test/dependencies/double_dependency.gyp @@ -0,0 +1,22 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'double_dependency', + 'type': 'shared_library', + 'dependencies': [ + 'double_dependent.gyp:double_dependent', + ], + 'conditions': [ + ['1==1', { + 'dependencies': [ + 'double_dependent.gyp:*', + ], + }], + ], + }, + ], +} diff --git a/tools/gyp/test/dependencies/double_dependent.gyp b/tools/gyp/test/dependencies/double_dependent.gyp new file mode 100644 index 0000000000..334caff723 --- /dev/null +++ b/tools/gyp/test/dependencies/double_dependent.gyp @@ -0,0 +1,12 @@ +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'double_dependent', + 'type': 'none', + }, + ], +} diff --git a/tools/gyp/test/dependencies/extra_targets.gyp b/tools/gyp/test/dependencies/extra_targets.gyp new file mode 100644 index 0000000000..c1a26de422 --- /dev/null +++ b/tools/gyp/test/dependencies/extra_targets.gyp @@ -0,0 +1,18 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'a', + 'type': 'static_library', + 'sources': [ + 'a.c', + ], + # This only depends on the "d" target; other targets in c.gyp + # should not become part of the build (unlike with 'c/c.gyp:*'). + 'dependencies': ['c/c.gyp:d'], + }, + ], +} diff --git a/tools/gyp/test/dependencies/gyptest-double-dependency.py b/tools/gyp/test/dependencies/gyptest-double-dependency.py new file mode 100644 index 0000000000..7692740c54 --- /dev/null +++ b/tools/gyp/test/dependencies/gyptest-double-dependency.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python + +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that pulling in a dependency a second time in a conditional works for +shared_library targets. Regression test for http://crbug.com/122588 +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('double_dependency.gyp') + +# If running gyp worked, all is well. +test.pass_test() diff --git a/tools/gyp/test/dependencies/gyptest-extra-targets.py b/tools/gyp/test/dependencies/gyptest-extra-targets.py new file mode 100755 index 0000000000..09b00d958b --- /dev/null +++ b/tools/gyp/test/dependencies/gyptest-extra-targets.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that dependencies don't pull unused targets into the build. +""" + +import TestGyp + +test = TestGyp.TestGyp() + +test.run_gyp('extra_targets.gyp', + '-G', 'xcode_ninja_target_pattern=^a$') + +# This should fail if it tries to build 'c_unused' since 'c/c.c' has a syntax +# error and won't compile. +test.build('extra_targets.gyp', test.ALL) + +test.pass_test() diff --git a/tools/gyp/test/dependencies/gyptest-lib-only.py b/tools/gyp/test/dependencies/gyptest-lib-only.py new file mode 100755 index 0000000000..3a99a7f4aa --- /dev/null +++ b/tools/gyp/test/dependencies/gyptest-lib-only.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that a link time only dependency will get pulled into the set of built +targets, even if no executable uses it. +""" + +import TestGyp + +import sys + +test = TestGyp.TestGyp() + +test.run_gyp('lib_only.gyp') + +test.build('lib_only.gyp', test.ALL) + +test.built_file_must_exist('a', type=test.STATIC_LIB) + +# TODO(bradnelson/mark): +# On linux and windows a library target will at least pull its link dependencies +# into the generated project, since not doing so confuses users. +# This is not currently implemented on mac, which has the opposite behavior. +if sys.platform == 'darwin': + if test.format == 'xcode': + test.built_file_must_not_exist('b', type=test.STATIC_LIB) + else: + assert test.format in ('make', 'ninja', 'xcode-ninja') + test.built_file_must_exist('b', type=test.STATIC_LIB) +else: + # Make puts the resulting library in a directory matching the input gyp file; + # for the 'b' library, that is in the 'b' subdirectory. + test.built_file_must_exist('b', type=test.STATIC_LIB, subdir='b') + +test.pass_test() diff --git a/tools/gyp/test/dependencies/gyptest-none-traversal.py b/tools/gyp/test/dependencies/gyptest-none-traversal.py new file mode 100755 index 0000000000..c09063dad3 --- /dev/null +++ b/tools/gyp/test/dependencies/gyptest-none-traversal.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +# Copyright (c) 2011 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that static library dependencies don't traverse none targets, unless +explicitly specified. +""" + +import TestGyp + +import sys + +test = TestGyp.TestGyp() + +test.run_gyp('none_traversal.gyp') + +test.build('none_traversal.gyp', test.ALL) + +test.run_built_executable('needs_chain', stdout="2\n") +test.run_built_executable('doesnt_need_chain', stdout="3\n") + +test.pass_test() diff --git a/tools/gyp/test/dependencies/gyptest-sharedlib-linksettings.py b/tools/gyp/test/dependencies/gyptest-sharedlib-linksettings.py new file mode 100644 index 0000000000..87428af459 --- /dev/null +++ b/tools/gyp/test/dependencies/gyptest-sharedlib-linksettings.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python + +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +""" +Verify that link_settings in a shared_library are not propagated to targets +that depend on the shared_library, but are used in the shared_library itself. +""" + +import TestGyp +import sys + +CHDIR='sharedlib-linksettings' + +test = TestGyp.TestGyp() +test.run_gyp('test.gyp', chdir=CHDIR) +test.build('test.gyp', test.ALL, chdir=CHDIR) +test.run_built_executable('program', stdout="1\n2\n", chdir=CHDIR) +test.pass_test() diff --git a/tools/gyp/test/dependencies/lib_only.gyp b/tools/gyp/test/dependencies/lib_only.gyp new file mode 100755 index 0000000000..f6c84dea64 --- /dev/null +++ b/tools/gyp/test/dependencies/lib_only.gyp @@ -0,0 +1,16 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'a', + 'type': 'static_library', + 'sources': [ + 'a.c', + ], + 'dependencies': ['b/b.gyp:b'], + }, + ], +} diff --git a/tools/gyp/test/dependencies/main.c b/tools/gyp/test/dependencies/main.c new file mode 100644 index 0000000000..185bd482f2 --- /dev/null +++ b/tools/gyp/test/dependencies/main.c @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2011 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include + +extern int funcA(); + +int main() { + printf("%d\n", funcA()); + return 0; +} diff --git a/tools/gyp/test/dependencies/none_traversal.gyp b/tools/gyp/test/dependencies/none_traversal.gyp new file mode 100755 index 0000000000..3d8ab30aff --- /dev/null +++ b/tools/gyp/test/dependencies/none_traversal.gyp @@ -0,0 +1,46 @@ +# Copyright (c) 2009 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'needs_chain', + 'type': 'executable', + 'sources': [ + 'a.c', + 'main.c', + ], + 'dependencies': ['chain'], + }, + { + 'target_name': 'chain', + 'type': 'none', + 'dependencies': ['b/b.gyp:b'], + }, + { + 'target_name': 'doesnt_need_chain', + 'type': 'executable', + 'sources': [ + 'main.c', + ], + 'dependencies': ['no_chain', 'other_chain'], + }, + { + 'target_name': 'no_chain', + 'type': 'none', + 'sources': [ + ], + 'dependencies': ['b/b.gyp:b'], + 'dependencies_traverse': 0, + }, + { + 'target_name': 'other_chain', + 'type': 'static_library', + 'sources': [ + 'a.c', + ], + 'dependencies': ['b/b.gyp:b3'], + }, + ], +} diff --git a/tools/gyp/test/dependencies/sharedlib-linksettings/program.c b/tools/gyp/test/dependencies/sharedlib-linksettings/program.c new file mode 100644 index 0000000000..b7c15edcd6 --- /dev/null +++ b/tools/gyp/test/dependencies/sharedlib-linksettings/program.c @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2013 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include + +/* + * This will fail to compile if TEST_DEFINE was propagated from sharedlib to + * program. + */ +#ifdef TEST_DEFINE +#error TEST_DEFINE is already defined! +#endif + +#define TEST_DEFINE 2 + +extern int staticLibFunc(); + +int main() { + printf("%d\n", staticLibFunc()); + printf("%d\n", TEST_DEFINE); + return 0; +} diff --git a/tools/gyp/test/dependencies/sharedlib-linksettings/sharedlib.c b/tools/gyp/test/dependencies/sharedlib-linksettings/sharedlib.c new file mode 100644 index 0000000000..3199bccd66 --- /dev/null +++ b/tools/gyp/test/dependencies/sharedlib-linksettings/sharedlib.c @@ -0,0 +1,16 @@ +/* + * Copyright (c) 2013 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int sharedLibFunc() { + /* + * This will fail to compile if TEST_DEFINE was not obtained from sharedlib's + * link_settings. + */ + return TEST_DEFINE; +} diff --git a/tools/gyp/test/dependencies/sharedlib-linksettings/staticlib.c b/tools/gyp/test/dependencies/sharedlib-linksettings/staticlib.c new file mode 100644 index 0000000000..e889b419fd --- /dev/null +++ b/tools/gyp/test/dependencies/sharedlib-linksettings/staticlib.c @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2013 Google Inc. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* + * This will fail to compile if TEST_DEFINE was propagated from sharedlib to + * staticlib. + */ +#ifdef TEST_DEFINE +#error TEST_DEFINE is defined! +#endif + +#ifdef _WIN32 +__declspec(dllimport) +#else +extern +#endif +int sharedLibFunc(); + +int staticLibFunc() { + return sharedLibFunc(); +} diff --git a/tools/gyp/test/dependencies/sharedlib-linksettings/test.gyp b/tools/gyp/test/dependencies/sharedlib-linksettings/test.gyp new file mode 100644 index 0000000000..830ce3236d --- /dev/null +++ b/tools/gyp/test/dependencies/sharedlib-linksettings/test.gyp @@ -0,0 +1,37 @@ +# Copyright (c) 2013 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'target_defaults': { + 'allow_sharedlib_linksettings_propagation': 0, + }, + 'targets': [ + { + 'target_name': 'sharedlib', + 'type': 'shared_library', + 'sources': [ 'sharedlib.c' ], + 'link_settings': { + 'defines': [ 'TEST_DEFINE=1' ], + }, + 'conditions': [ + ['OS=="linux"', { + # Support 64-bit shared libs (also works fine for 32-bit). + 'cflags': ['-fPIC'], + }], + ], + }, + { + 'target_name': 'staticlib', + 'type': 'static_library', + 'sources': [ 'staticlib.c' ], + 'dependencies': [ 'sharedlib' ], + }, + { + 'target_name': 'program', + 'type': 'executable', + 'sources': [ 'program.c' ], + 'dependencies': [ 'staticlib' ], + }, + ], +} -- cgit v1.2.1