summaryrefslogtreecommitdiff
path: root/dev-build/ninja
diff options
context:
space:
mode:
Diffstat (limited to 'dev-build/ninja')
-rw-r--r--dev-build/ninja/Manifest6
-rw-r--r--dev-build/ninja/files/ninja-1.12.1-restore-tests-bootstrap.patch135
-rw-r--r--dev-build/ninja/ninja-1.12.1.ebuild39
-rw-r--r--dev-build/ninja/ninja-9999.ebuild38
4 files changed, 204 insertions, 14 deletions
diff --git a/dev-build/ninja/Manifest b/dev-build/ninja/Manifest
index 3f364f454185..3f7024c51c79 100644
--- a/dev-build/ninja/Manifest
+++ b/dev-build/ninja/Manifest
@@ -1,7 +1,9 @@
+AUX ninja-1.12.1-restore-tests-bootstrap.patch 5152 BLAKE2B 133bb641e41b7111a02d13de5d04daa48ad786ed16911cc452c3a44172c425d9f6fc72d52ed5c1bd48750435da083c2e0091d99876180ed328e4d5368887fcc0 SHA512 cb386f2f81aef1bfd7b0d028c8857e5ad474002e90a53ba8469f64c7952e419e7163beb2560ed854f202c44270e4c5c80a101db3903aa04618c018a69e351787
AUX ninja-cflags.patch 738 BLAKE2B ec025836197d41d96cfcab0a7363ab3bda50cb7fc3f91f096ccfaa16babdc353269738aef92e68a261f43ba617720f677766f7044acb1a01dd7e07d6c9eca13e SHA512 97935accbef92e6eeda7d38bae6978016f4423e3989fcfb13c6de55644133ddef43db49811fc85d2649d68473d8b81e1bfb70f59a5e63d2607741d90152a4f42
+DIST gtest-1.14.0.tar.gz 867764 BLAKE2B c457f55ac572b9fb1553eee3df7eeeaf1e7dd2c3d747dd5e90dd279038fa5c71bb7b7d9ba1cf7e6143898b2a1d24d100584bd2a48ded41a426870c4825eec1b2 SHA512 765c326ccc1b87a01027385e69238266e356361cd4ee3e18e3c9d137a5d11fa5d657c164d02dd1be8fe693c8e10f2b580588dbfa57d27f070e2750f50d3e662c
DIST ninja-1.11.1.tar.gz 229479 BLAKE2B c96cf7c319b7abd65f644465688d256f8b3a576c4616d0c63852e25dd0dc5f63c66708d429d8dddb6228502eb147211a86a5dd369b80ec2228902b370d2343e5 SHA512 1bca38877c70ee6613f347ffccef5adc02ba0a3947c62ae004ea97f918442b5a3de92378e4f820ae2a7676bc7609d25fbc7d41f6cfb3a61e5e4b26ec3639e403
DIST ninja-1.12.1.tar.gz 240483 BLAKE2B 915545888cbd7d9e6e7e4fb0bad42f6c36ecef2de93356966541de0f8f4315e59e47cf20f189de5de11ba2a038488c7964ec709bad8868488cc03524a88483f4 SHA512 d6e6f0e89a4844a69069ff0c7cefc07704a41c7b0c062a57534de87decdde63e27928147b321111b806aa7efa1061f031a1319b074391db61b0cbdccf096954c
EBUILD ninja-1.11.1-r5.ebuild 2451 BLAKE2B bf0e6fc2f7d09db24ca6b58a4a1e081ef08ee2bb04acc73af3e2f8fe8f77745f99ac8d68d0338b0867a0040555b6eddad61930c7ce7d72d43d0c426511b078a9 SHA512 831f9e6e2800fdf5c466ba0d69a9034b0c329a2d34b80cad723dead14d02a205ee76b398ca6a56b7d16a1ce8249b1be1493ce77bfb7e8e98e86e0a665f797b1b
-EBUILD ninja-1.12.1.ebuild 2181 BLAKE2B 13965a148b8e30d15bd441624b99f05a0f0750c8bf25d403c3de5cea20c78a000a56fdc39de09fc50c020e6f8eb7069160afb806f21ca0dae3db6e9a1a4a3bdf SHA512 117eb46883ca5bb23d4072a2642110da0fbc9c6d4ce4ebd5d315ccbeb1829dd31e98b3cba14c737cf5f3aa098d840850d7ecac468bb72ead8ed21baf1deb9ac3
-EBUILD ninja-9999.ebuild 2181 BLAKE2B 13965a148b8e30d15bd441624b99f05a0f0750c8bf25d403c3de5cea20c78a000a56fdc39de09fc50c020e6f8eb7069160afb806f21ca0dae3db6e9a1a4a3bdf SHA512 117eb46883ca5bb23d4072a2642110da0fbc9c6d4ce4ebd5d315ccbeb1829dd31e98b3cba14c737cf5f3aa098d840850d7ecac468bb72ead8ed21baf1deb9ac3
+EBUILD ninja-1.12.1.ebuild 2716 BLAKE2B 5fe844d22cba227b4b40288bbaaf63da11c8169903ba326091a53038f8d0b3939e536a4d7b0fe1956976c25bb8040b744536bf531eb5d1a2b1d320d1331c2c06 SHA512 d56b5ed1f71403e277c513a3a270c59944314da476d203045619baacd816d1573f487e00b47cc83060ca3d664f03b75ec96be8fb5518268f6b6dd748b3c86dad
+EBUILD ninja-9999.ebuild 2666 BLAKE2B 154b6da87717b328f639c414d5845fca5718cc5f8bfedfe2a5e6960148bd769a56664432b0afa7f409612facb56026ef5bf09bb4496245c372666724284044cf SHA512 507728d536a374f07cea7b169971c6f6e948b523bf9a186891625c91d8438f64dc1135c3fe7cf64da1d1fed3657519a10c2997b305abd925fa16f564d48c5a7f
MISC metadata.xml 463 BLAKE2B 4094365ee9f5db41a29df26eada46bc42050da4043003bc265733666475d950df0b53cc475585b5d0ad79a1b9cbe83a53076911e564960d21568479e52bc4b33 SHA512 2d08b1e9f5377ba2d1976093fc9a3a9ceec51e80a7473e3d80e536585d1adb21c90d954205b97dd063dc99fe60b7b0c5335a16e05d0a2fa79e951c4833697880
diff --git a/dev-build/ninja/files/ninja-1.12.1-restore-tests-bootstrap.patch b/dev-build/ninja/files/ninja-1.12.1-restore-tests-bootstrap.patch
new file mode 100644
index 000000000000..94aa8ab5b397
--- /dev/null
+++ b/dev-build/ninja/files/ninja-1.12.1-restore-tests-bootstrap.patch
@@ -0,0 +1,135 @@
+https://bugs.gentoo.org/929221
+https://github.com/ninja-build/ninja/issues/2447
+https://github.com/ninja-build/ninja/commit/afcd4a146fb82843f6ff695f89504ce4ca65ddfd
+
+From afcd4a146fb82843f6ff695f89504ce4ca65ddfd Mon Sep 17 00:00:00 2001
+From: David 'Digit' Turner <digit+github@google.com>
+Date: Sun, 12 May 2024 23:45:28 +0200
+Subject: [PATCH] configure.py: Support --gtest-source-dir to build tests.
+
+Allow the Ninja build plan generated by configure.py to
+build `ninja_test` by compiling GoogleTest from source if
+the path to the library if passed through the new option
+`--gtest-source-dir` or the GTEST_SOURCE_DIR environment
+variable.
+
+For simplicity, probing for an installed version of the
+library, and linking to it, is not supported (use the
+CMake build for this).
+
+This also removes the obsolete `--gtest-dir` option.
+
+Fixes #2447
+---
+ configure.py | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 2 files changed, 95 insertions(+), 1 deletion(-)
+
+diff --git a/configure.py b/configure.py
+index f9e49f9cdf..2b16618c43 100755
+--- a/configure.py
++++ b/configure.py
+@@ -223,7 +223,10 @@ def _run_command(self, cmdline: str) -> None:
+ parser.add_option('--profile', metavar='TYPE',
+ choices=profilers,
+ help='enable profiling (' + '/'.join(profilers) + ')',)
+-parser.add_option('--with-gtest', metavar='PATH', help='ignored')
++parser.add_option('--gtest-source-dir', metavar='PATH',
++ help='Path to GoogleTest source directory. If not provided ' +
++ 'GTEST_SOURCE_DIR will be probed in the environment. ' +
++ 'Tests will not be built without a value.')
+ parser.add_option('--with-python', metavar='EXE',
+ help='use EXE as the Python interpreter',
+ default=os.path.basename(sys.executable))
+@@ -435,6 +438,7 @@ def shell_escape(str: str) -> str:
+ if 'LDFLAGS' in configure_env:
+ ldflags.append(configure_env['LDFLAGS'])
+ n.variable('ldflags', ' '.join(shell_escape(flag) for flag in ldflags))
++
+ n.newline()
+
+ if platform.is_msvc():
+@@ -592,6 +596,83 @@ def has_re2c() -> bool:
+ # build.ninja file.
+ n = ninja_writer
+
++# Build the ninja_test executable only if the GTest source directory
++# is provided explicitly. Either from the environment with GTEST_SOURCE_DIR
++# or with the --gtest-source-dir command-line option.
++#
++# Do not try to look for an installed binary version, and link against it
++# because doing so properly is platform-specific (use the CMake build for
++# this).
++if options.gtest_source_dir:
++ gtest_src_dir = options.gtest_source_dir
++else:
++ gtest_src_dir = os.environ.get('GTEST_SOURCE_DIR')
++
++if gtest_src_dir:
++ # Verify GoogleTest source directory, and add its include directory
++ # to the global include search path (even for non-test sources) to
++ # keep the build plan generation simple.
++ gtest_all_cc = os.path.join(gtest_src_dir, 'googletest', 'src', 'gtest-all.cc')
++ if not os.path.exists(gtest_all_cc):
++ print('ERROR: Missing GoogleTest source file: %s' % gtest_all_cc)
++ sys.exit(1)
++
++ n.comment('Tests all build into ninja_test executable.')
++
++ # Test-specific version of cflags, must include the GoogleTest
++ # include directory. Also GoogleTest can only build with a C++14 compiler.
++ test_cflags = [f.replace('std=c++11', 'std=c++14') for f in cflags]
++ test_cflags.append('-I' + os.path.join(gtest_src_dir, 'googletest', 'include'))
++
++ test_variables = [('cflags', test_cflags)]
++ if platform.is_msvc():
++ test_variables += [('pdb', 'ninja_test.pdb')]
++
++ test_names = [
++ 'build_log_test',
++ 'build_test',
++ 'clean_test',
++ 'clparser_test',
++ 'depfile_parser_test',
++ 'deps_log_test',
++ 'disk_interface_test',
++ 'dyndep_parser_test',
++ 'edit_distance_test',
++ 'graph_test',
++ 'json_test',
++ 'lexer_test',
++ 'manifest_parser_test',
++ 'ninja_test',
++ 'state_test',
++ 'string_piece_util_test',
++ 'subprocess_test',
++ 'test',
++ 'util_test',
++ ]
++ if platform.is_windows():
++ test_names += [
++ 'includes_normalize_test',
++ 'msvc_helper_test',
++ ]
++
++ objs = []
++ for name in test_names:
++ objs += cxx(name, variables=test_variables)
++
++ # Build GTest as a monolithic source file.
++ # This requires one extra include search path, so replace the
++ # value of 'cflags' in our list.
++ gtest_all_variables = test_variables[1:] + [
++ ('cflags', test_cflags + ['-I' + os.path.join(gtest_src_dir, 'googletest') ]),
++ ]
++ # Do not use cxx() directly to ensure the object file is under $builddir.
++ objs += n.build(built('gtest_all' + objext), 'cxx', gtest_all_cc, variables=gtest_all_variables)
++
++ ninja_test = n.build(binary('ninja_test'), 'link', objs, implicit=ninja_lib,
++ variables=[('libs', libs)])
++ n.newline()
++ all_targets += ninja_test
++
+ n.comment('Ancillary executables.')
+
+ if platform.is_aix() and '-maix64' not in ldflags:
+
diff --git a/dev-build/ninja/ninja-1.12.1.ebuild b/dev-build/ninja/ninja-1.12.1.ebuild
index b387ddf90c06..1d8f3d0a0b09 100644
--- a/dev-build/ninja/ninja-1.12.1.ebuild
+++ b/dev-build/ninja/ninja-1.12.1.ebuild
@@ -15,12 +15,16 @@ else
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
fi
+GTEST_VER=1.14.0
+SRC_URI+=" test? ( https://github.com/google/googletest/archive/refs/tags/v${GTEST_VER}.tar.gz -> gtest-${GTEST_VER}.tar.gz )"
+
DESCRIPTION="A small build system similar to make"
HOMEPAGE="https://ninja-build.org/"
LICENSE="Apache-2.0"
SLOT="0"
-IUSE="doc"
+IUSE="doc test"
+RESTRICT="!test? ( test )"
BDEPEND="
${PYTHON_DEPS}
@@ -36,14 +40,20 @@ PDEPEND="
app-alternatives/ninja
"
+PATCHES=(
+ "${FILESDIR}"/ninja-cflags.patch
+ "${FILESDIR}"/${P}-restore-tests-bootstrap.patch
+)
+
pkg_setup() {
:
}
-src_prepare() {
- local PATCHES=(
- "${FILESDIR}"/ninja-cflags.patch
- )
+src_unpack() {
+ if [[ ${PV} == 9999 ]] ; then
+ git-r3_src_unpack
+ fi
+
default
}
@@ -55,7 +65,15 @@ bootstrap() {
local -x CXXFLAGS="${BUILD_CXXFLAGS} -D_FILE_OFFSET_BITS=64"
local -x LDFLAGS=${BUILD_LDFLAGS}
fi
- edo ${EPYTHON} configure.py --with-python=python --bootstrap --verbose
+
+ local bootstrap_args=(
+ --with-python=python
+ --bootstrap
+ --verbose
+ $(usev test --gtest-source-dir="${WORKDIR}"/googletest-${GTEST_VER})
+ )
+
+ edo ${EPYTHON} configure.py "${bootstrap_args[@]}"
}
src_compile() {
@@ -77,6 +95,15 @@ src_compile() {
fi
}
+src_test() {
+ if ! tc-is-cross-compiler; then
+ # Bug 485772
+ ulimit -n 2048
+ edo ./ninja -v ninja_test
+ edo ./ninja_test
+ fi
+}
+
src_install() {
newbin ninja{,-reference}
diff --git a/dev-build/ninja/ninja-9999.ebuild b/dev-build/ninja/ninja-9999.ebuild
index b387ddf90c06..1f7a8e02d01c 100644
--- a/dev-build/ninja/ninja-9999.ebuild
+++ b/dev-build/ninja/ninja-9999.ebuild
@@ -15,12 +15,16 @@ else
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
fi
+GTEST_VER=1.14.0
+SRC_URI+=" test? ( https://github.com/google/googletest/archive/refs/tags/v${GTEST_VER}.tar.gz -> gtest-${GTEST_VER}.tar.gz )"
+
DESCRIPTION="A small build system similar to make"
HOMEPAGE="https://ninja-build.org/"
LICENSE="Apache-2.0"
SLOT="0"
-IUSE="doc"
+IUSE="doc test"
+RESTRICT="!test? ( test )"
BDEPEND="
${PYTHON_DEPS}
@@ -36,14 +40,19 @@ PDEPEND="
app-alternatives/ninja
"
+PATCHES=(
+ "${FILESDIR}"/ninja-cflags.patch
+)
+
pkg_setup() {
:
}
-src_prepare() {
- local PATCHES=(
- "${FILESDIR}"/ninja-cflags.patch
- )
+src_unpack() {
+ if [[ ${PV} == 9999 ]] ; then
+ git-r3_src_unpack
+ fi
+
default
}
@@ -55,7 +64,15 @@ bootstrap() {
local -x CXXFLAGS="${BUILD_CXXFLAGS} -D_FILE_OFFSET_BITS=64"
local -x LDFLAGS=${BUILD_LDFLAGS}
fi
- edo ${EPYTHON} configure.py --with-python=python --bootstrap --verbose
+
+ local bootstrap_args=(
+ --with-python=python
+ --bootstrap
+ --verbose
+ $(usev test --gtest-source-dir="${WORKDIR}"/googletest-${GTEST_VER})
+ )
+
+ edo ${EPYTHON} configure.py "${bootstrap_args[@]}"
}
src_compile() {
@@ -77,6 +94,15 @@ src_compile() {
fi
}
+src_test() {
+ if ! tc-is-cross-compiler; then
+ # Bug 485772
+ ulimit -n 2048
+ edo ./ninja -v ninja_test
+ edo ./ninja_test
+ fi
+}
+
src_install() {
newbin ninja{,-reference}