aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcheckbuild.py173
-rwxr-xr-xsources/host-tools/ndk-depends/build-ndk-depends.sh11
-rwxr-xr-xsources/host-tools/ndk-depends/build.py2
-rwxr-xr-xsources/host-tools/ndk-stack/build-ndk-stack.sh13
-rwxr-xr-xsources/host-tools/ndk-stack/build.py2
5 files changed, 117 insertions, 84 deletions
diff --git a/checkbuild.py b/checkbuild.py
index 52ee2c796..20961cf13 100755
--- a/checkbuild.py
+++ b/checkbuild.py
@@ -25,6 +25,7 @@ from __future__ import print_function
import argparse
import copy
import distutils.spawn
+import errno
import inspect
import json
import logging
@@ -395,14 +396,6 @@ class HostTools(ndk.builds.Module):
def build(self, out_dir, dist_dir, args):
build_args = common_build_args(out_dir, dist_dir, args)
- print('Building ndk-stack...')
- invoke_external_build(
- 'ndk/sources/host-tools/ndk-stack/build.py', build_args)
-
- print('Building ndk-depends...')
- invoke_external_build(
- 'ndk/sources/host-tools/ndk-depends/build.py', build_args)
-
print('Building make...')
invoke_external_build(
'ndk/sources/host-tools/make-3.81/build.py', build_args)
@@ -421,58 +414,116 @@ class HostTools(ndk.builds.Module):
print('Building YASM...')
invoke_external_build('toolchain/yasm/build.py', build_args)
- package_host_tools(out_dir, dist_dir, args.system)
-
-
-def package_host_tools(out_dir, dist_dir, host):
- packages = [
- 'gdb-multiarch-7.11',
- 'ndk-depends',
- 'ndk-make',
- 'ndk-python',
- 'ndk-stack',
- 'ndk-yasm',
- ]
-
- files = [
- 'ndk-gdb',
- 'ndk-gdb.py',
- 'ndk-which',
- ]
-
- if host in ('windows', 'windows64'):
- packages.append('toolbox')
- files.append('ndk-gdb.cmd')
-
- host_tag = build_support.host_to_tag(host)
-
- package_names = [p + '-' + host_tag + '.tar.bz2' for p in packages]
- for package_name in package_names:
- package_path = os.path.join(out_dir, package_name)
- subprocess.check_call(['tar', 'xf', package_path, '-C', out_dir])
-
- for f in files:
- shutil.copy2(f, os.path.join(out_dir, 'host-tools/bin'))
-
- build_support.merge_license_files(
- os.path.join(out_dir, 'host-tools/NOTICE'), [
- build_support.android_path('toolchain/gdb/gdb-7.11/COPYING'),
- build_support.ndk_path('sources/host-tools/ndk-depends/NOTICE'),
- build_support.ndk_path('sources/host-tools/make-3.81/COPYING'),
- build_support.android_path(
- 'toolchain/python/Python-2.7.5/LICENSE'),
- build_support.ndk_path('sources/host-tools/ndk-stack/NOTICE'),
- build_support.ndk_path('sources/host-tools/toolbox/NOTICE'),
- build_support.android_path('toolchain/yasm/COPYING'),
- build_support.android_path('toolchain/yasm/BSD.txt'),
- build_support.android_path('toolchain/yasm/Artistic.txt'),
- build_support.android_path('toolchain/yasm/GNU_GPL-2.0'),
- build_support.android_path('toolchain/yasm/GNU_LGPL-2.0'),
- ])
-
- package_name = 'host-tools-' + host_tag
- path = os.path.join(out_dir, 'host-tools')
- build_support.make_package(package_name, path, dist_dir)
+ def install(self, out_dir, _dist_dir, args):
+ install_dir = self.get_install_path(out_dir, args.system)
+
+ try:
+ os.makedirs(install_dir)
+ except OSError as ex:
+ # Another build might be trying to create this simultaneously,
+ # which we can safely ignore.
+ if ex.errno != errno.EEXIST:
+ raise
+
+ packages = [
+ 'gdb-multiarch-7.11',
+ 'ndk-make',
+ 'ndk-python',
+ 'ndk-yasm',
+ ]
+
+ files = [
+ 'ndk-gdb',
+ 'ndk-gdb.py',
+ 'ndk-which',
+ ]
+
+ if args.system in ('windows', 'windows64'):
+ packages.append('toolbox')
+ files.append('ndk-gdb.cmd')
+
+ host_tag = build_support.host_to_tag(args.system)
+
+ package_names = [p + '-' + host_tag + '.tar.bz2' for p in packages]
+ for package_name in package_names:
+ package_path = os.path.join(out_dir, package_name)
+ subprocess.check_call(
+ ['tar', 'xf', package_path, '-C', install_dir,
+ '--strip-components=1'])
+
+ for f in files:
+ shutil.copy2(f, os.path.join(install_dir, 'bin'))
+
+ build_support.merge_license_files(
+ os.path.join(install_dir, 'NOTICE'), [
+ build_support.android_path('toolchain/gdb/gdb-7.11/COPYING'),
+ build_support.ndk_path(
+ 'sources/host-tools/ndk-depends/NOTICE'),
+ build_support.ndk_path('sources/host-tools/make-3.81/COPYING'),
+ build_support.android_path(
+ 'toolchain/python/Python-2.7.5/LICENSE'),
+ build_support.ndk_path('sources/host-tools/ndk-stack/NOTICE'),
+ build_support.ndk_path('sources/host-tools/toolbox/NOTICE'),
+ build_support.android_path('toolchain/yasm/COPYING'),
+ build_support.android_path('toolchain/yasm/BSD.txt'),
+ build_support.android_path('toolchain/yasm/Artistic.txt'),
+ build_support.android_path('toolchain/yasm/GNU_GPL-2.0'),
+ build_support.android_path('toolchain/yasm/GNU_LGPL-2.0'),
+ ])
+
+ build_support.make_repo_prop(install_dir)
+
+ self.validate_notice(install_dir)
+
+
+def install_exe(out_dir, install_dir, name, system):
+ is_win = system.startswith('windows')
+ ext = '.exe' if is_win else ''
+ exe_name = name + ext
+ src = os.path.join(out_dir, exe_name)
+ dst = os.path.join(install_dir, exe_name)
+
+ try:
+ os.makedirs(install_dir)
+ except OSError as ex:
+ # Another build might be trying to create this simultaneously,
+ # which we can safely ignore.
+ if ex.errno != errno.EEXIST:
+ raise
+
+ shutil.copy2(src, dst)
+
+
+class NdkDepends(ndk.builds.InvokeExternalBuildModule):
+ name = 'ndk-depends'
+ path = 'prebuilt/{host}/bin'
+ script = 'ndk/sources/host-tools/ndk-depends/build.py'
+
+ def install(self, out_dir, _dist_dir, args):
+ src = os.path.join(out_dir, self.name)
+ install_dir = self.get_install_path(out_dir, args.system)
+ install_exe(src, install_dir, self.name, args.system)
+
+ def validate_notice(self, _install_base):
+ # ndk-depends shares a directory with many other components. Its
+ # license is merged with the others as part of HostTools.
+ pass
+
+
+class NdkStack(ndk.builds.InvokeExternalBuildModule):
+ name = 'ndk-stack'
+ path = 'prebuilt/{host}/bin'
+ script = 'ndk/sources/host-tools/ndk-stack/build.py'
+
+ def install(self, out_dir, _dist_dir, args):
+ src = os.path.join(out_dir, self.name)
+ install_dir = self.get_install_path(out_dir, args.system)
+ install_exe(src, install_dir, self.name, args.system)
+
+ def validate_notice(self, _install_base):
+ # ndk-stack shares a directory with many other components. Its license
+ # is merged with the others as part of HostTools.
+ pass
class GdbServer(ndk.builds.InvokeBuildModule):
@@ -1361,9 +1412,11 @@ ALL_MODULES = [
NativeAppGlue(),
NdkBuild(),
NdkBuildShortcut(),
+ NdkDepends(),
NdkDependsShortcut(),
NdkGdbShortcut(),
NdkHelper(),
+ NdkStack(),
NdkStackShortcut(),
NdkWhichShortcut(),
Platforms(),
diff --git a/sources/host-tools/ndk-depends/build-ndk-depends.sh b/sources/host-tools/ndk-depends/build-ndk-depends.sh
index 981eff8d4..5f362b0ed 100755
--- a/sources/host-tools/ndk-depends/build-ndk-depends.sh
+++ b/sources/host-tools/ndk-depends/build-ndk-depends.sh
@@ -75,10 +75,8 @@ if [ "$MINGW" = "yes" ]; then
fi
NAME=$(get_host_exec_name ndk-depends)
-INSTALL_ROOT=$BUILD_DIR/install
INSTALL_SUBDIR=host-tools/bin
-INSTALL_PATH=$INSTALL_ROOT/$INSTALL_SUBDIR
-OUT=$INSTALL_PATH/$NAME
+OUT=$BUILD_DIR/$NAME
mkdir $INSTALL_PATH
# GNU Make
@@ -115,12 +113,5 @@ if [ $? != 0 ]; then
exit 1
fi
-if [ "$PACKAGE_DIR" ]; then
- ARCHIVE=ndk-depends-$HOST_TAG.tar.bz2
- dump "Packaging: $ARCHIVE"
- pack_archive "$PACKAGE_DIR/$ARCHIVE" "$INSTALL_ROOT" "$INSTALL_SUBDIR"
- fail_panic "Could not create package: $PACKAGE_DIR/$ARCHIVE from $OUT"
-fi
-
log "Done!"
exit 0
diff --git a/sources/host-tools/ndk-depends/build.py b/sources/host-tools/ndk-depends/build.py
index 57b9465b3..65dc54711 100755
--- a/sources/host-tools/ndk-depends/build.py
+++ b/sources/host-tools/ndk-depends/build.py
@@ -41,7 +41,7 @@ def main(args):
build_cmd.append(
'--build-dir=' + os.path.join(args.out_dir, 'ndk-depends'))
- build_support.build(build_cmd, args, intermediate_package=True)
+ build_support.build(build_cmd, args)
if __name__ == '__main__':
build_support.run(main)
diff --git a/sources/host-tools/ndk-stack/build-ndk-stack.sh b/sources/host-tools/ndk-stack/build-ndk-stack.sh
index 4d2a110e3..61a93e65d 100755
--- a/sources/host-tools/ndk-stack/build-ndk-stack.sh
+++ b/sources/host-tools/ndk-stack/build-ndk-stack.sh
@@ -101,11 +101,7 @@ run make -j$NUM_JOBS
fail_panic "Can't build $BINUTILS_SRC_DIR"
NAME=$(get_host_exec_name ndk-stack)
-INSTALL_ROOT=$BUILD_DIR/install
-INSTALL_SUBDIR=host-tools/bin
-INSTALL_PATH=$INSTALL_ROOT/$INSTALL_SUBDIR
-OUT=$INSTALL_PATH/$NAME
-mkdir $INSTALL_PATH
+OUT=$BUILD_DIR/$NAME
# GNU Make
if [ -z "$GNUMAKE" ]; then
@@ -162,12 +158,5 @@ if [ $? != 0 ]; then
exit 1
fi
-if [ "$PACKAGE_DIR" ]; then
- ARCHIVE=ndk-stack-$HOST_TAG.tar.bz2
- dump "Packaging: $ARCHIVE"
- pack_archive "$PACKAGE_DIR/$ARCHIVE" "$INSTALL_ROOT" "$INSTALL_SUBDIR"
- fail_panic "Could not create package: $PACKAGE_DIR/$ARCHIVE from $OUT"
-fi
-
log "Done!"
exit 0
diff --git a/sources/host-tools/ndk-stack/build.py b/sources/host-tools/ndk-stack/build.py
index 14ee57e33..72e42f055 100755
--- a/sources/host-tools/ndk-stack/build.py
+++ b/sources/host-tools/ndk-stack/build.py
@@ -40,7 +40,7 @@ def main(args):
build_cmd.append('--build-dir=' + os.path.join(args.out_dir, 'ndk-stack'))
- build_support.build(build_cmd, args, intermediate_package=True)
+ build_support.build(build_cmd, args)
if __name__ == '__main__':
build_support.run(main)