From 982b1e6c8f96783b2915de409fcc6613b2a8ecfc Mon Sep 17 00:00:00 2001 From: Grant Erickson Date: Tue, 24 Apr 2018 09:26:07 -0700 Subject: [PATCH] [build] update nlbuild-autotools to 1.5.1 (#2677) --- configure.ac | 4 +- .../nlbuild-autotools/repo/.default-version | 2 +- third_party/nlbuild-autotools/repo/CHANGES | 15 ++ third_party/nlbuild-autotools/repo/README.md | 151 ++++++++++++-- .../repo/examples/Makefile-bootstrap | 105 ++++++++++ .../repo/examples/Makefile-third_party.am | 21 +- .../repo/examples/Makefile-toplevel.am | 28 ++- .../repo/examples/configure.ac | 92 ++++++++- .../repo/examples/repos.conf | 17 ++ .../repo/make/host/tools.mak | 24 +++ .../repo/make/host/tools/bootstrap.mak | 23 +++ .../repo/make/host/tools/tools.mak | 46 +++++ .../nlbuild-autotools/repo/make/post.mak | 23 +++ .../repo/make/post/rules.mak | 24 +++ .../repo/make/post/rules/bootstrap.mak | 126 ++++++++++++ .../repo/make/post/rules/help.mak | 39 ++++ .../repo/make/post/rules/repos.mak | 190 ++++++++++++++++++ .../nlbuild-autotools/repo/make/pre.mak | 24 +++ .../repo/make/pre/macros.mak | 25 +++ .../repo/make/pre/macros/git.mak | 69 +++++++ .../repo/make/pre/macros/repos.mak | 32 +++ .../repo/make/pre/macros/verbosity.mak | 72 +++++++ .../nlbuild-autotools/repo/make/pre/tools.mak | 25 +++ .../nlbuild-autotools/repo/scripts/mkskeleton | 4 +- .../repo/tools/packages/build | 24 +-- 25 files changed, 1165 insertions(+), 40 deletions(-) create mode 100644 third_party/nlbuild-autotools/repo/examples/Makefile-bootstrap create mode 100644 third_party/nlbuild-autotools/repo/examples/repos.conf create mode 100644 third_party/nlbuild-autotools/repo/make/host/tools.mak create mode 100644 third_party/nlbuild-autotools/repo/make/host/tools/bootstrap.mak create mode 100644 third_party/nlbuild-autotools/repo/make/host/tools/tools.mak create mode 100644 third_party/nlbuild-autotools/repo/make/post.mak create mode 100644 third_party/nlbuild-autotools/repo/make/post/rules.mak create mode 100644 third_party/nlbuild-autotools/repo/make/post/rules/bootstrap.mak create mode 100644 third_party/nlbuild-autotools/repo/make/post/rules/help.mak create mode 100644 third_party/nlbuild-autotools/repo/make/post/rules/repos.mak create mode 100644 third_party/nlbuild-autotools/repo/make/pre.mak create mode 100644 third_party/nlbuild-autotools/repo/make/pre/macros.mak create mode 100644 third_party/nlbuild-autotools/repo/make/pre/macros/git.mak create mode 100644 third_party/nlbuild-autotools/repo/make/pre/macros/repos.mak create mode 100644 third_party/nlbuild-autotools/repo/make/pre/macros/verbosity.mak create mode 100644 third_party/nlbuild-autotools/repo/make/pre/tools.mak diff --git a/configure.ac b/configure.ac index b432a233a..170ff741b 100644 --- a/configure.ac +++ b/configure.ac @@ -74,12 +74,12 @@ AC_CONFIG_SRCDIR([include/openthread/openthread.h]) # Tell autoconf where to find auxilliary build tools (e.g. config.guess, # install-sh, missing, etc.) # -AC_CONFIG_AUX_DIR([third_party/nlbuild-autotools/repo/autoconf]) +AC_CONFIG_AUX_DIR([third_party/nlbuild-autotools/repo/third_party/autoconf]) # # Tell autoconf where to find auxilliary M4 macros # -AC_CONFIG_MACRO_DIR([third_party/nlbuild-autotools/repo/autoconf/m4]) +AC_CONFIG_MACRO_DIRS([third_party/nlbuild-autotools/repo/third_party/autoconf/m4 third_party/nlbuild-autotools/repo/autoconf/m4]) # # Tell autoconf what file the package is using to aggregate C preprocessor diff --git a/third_party/nlbuild-autotools/repo/.default-version b/third_party/nlbuild-autotools/repo/.default-version index 1c99cf0e8..26ca59460 100644 --- a/third_party/nlbuild-autotools/repo/.default-version +++ b/third_party/nlbuild-autotools/repo/.default-version @@ -1 +1 @@ -1.4.4 +1.5.1 diff --git a/third_party/nlbuild-autotools/repo/CHANGES b/third_party/nlbuild-autotools/repo/CHANGES index f4a8ef51a..fa589611d 100644 --- a/third_party/nlbuild-autotools/repo/CHANGES +++ b/third_party/nlbuild-autotools/repo/CHANGES @@ -1,3 +1,18 @@ + +1.5.1 (2018-04-20) + + * Addressed a number of typos and grammatical errors in comments + and help output. + +1.5.0 (2018-04-19) + + * Added support for pulling down remote package dependencies + using git submodule. + + * Addressed an issue in which nl_enable_coverage.m4 did not work + correctly on some Linux distributions by specifying coverage + libraries under LIBS rather than LDFLAGS. + 1.4.4 (2018-02-06) * Addressed an issue where 'mkskeleton' failed while trying to diff --git a/third_party/nlbuild-autotools/repo/README.md b/third_party/nlbuild-autotools/repo/README.md index f09fd0ae6..3e37bf29f 100644 --- a/third_party/nlbuild-autotools/repo/README.md +++ b/third_party/nlbuild-autotools/repo/README.md @@ -65,9 +65,15 @@ following POSIX-based build host systems: * x86_64-apple-darwin * x86_64-unknown-linux-gnu -### Build and Install +### Build and Install {#Build_and_Install} -Simply invoke `make tools` at the top-level of your nlbuild-autotools tree. +Simply invoke `make tools` at the top-level of your nlbuild-autotools +tree or, for example, from your package or project in which you have +integrated nlbuild-autotools: + +``` +make -C third_party/nlbuild-autotools/repo tools +``` ### Download and Expand @@ -103,12 +109,8 @@ The nlbuild-autotools package is laid out as follows: | automake/post.am | GNU automake Makefile.am footer included by every makefile. | | automake/pre/ | GNU automake Makefile.am headers. | | automake/pre.am | GNU automake Makefile.am header included by every makefile. | -| etc/ | Configurations files used by nlbuild-autotools. | | examples/ | Example template files for starting your own nlbuild-autotools-based project. | | scripts/ | Automation scripts for regenerating the build system and for managing package versions. | -| third_party/ | Third-party code and infrastructure used by nlbuild-autotools. | -| third_party/autoconf/ | GNU autoconf infrastructure provided by third-parties, including GNU. | -| third_party/autoconf/m4/ | GNU m4 macros for configure.ac provided by third-parties, including GNU. | | tools/ | Qualified packages of and pre-built instances of GNU autotools. | | tools/host/ | Pre-built instances of GNU autotools (if installed). | | tools/host/i686-pc-cygwin/ | Pre-built instances of GNU autotools for 32-bit Cygwin (if installed). | @@ -116,17 +118,112 @@ The nlbuild-autotools package is laid out as follows: | tools/host/x86_64-apple-darwin/ | Pre-built instances of GNU autotools for 64-bit Mac OS X (if installed). | | tools/host/x86_64-unknown-linux-gnu/ | Pre-built instances of GNU autotools for 64-bit Linux (if installed). | | tools/packages/ | Qualified packages for GNU autotools. | +## Internal Package Dependencies and Repositories -# Interact +Your package may have dependencies on other packages that can either +be inlined into your package or can be specified externally. If your +package has such dependencies, nlbuild-autotools contains support to +facilitate easy standalone tests and a successful 'make distcheck' +target (which effectively reqires 'configure' with no arguments to +produce a successful build) without incurring the costs of inlining +these dependencies into your own package. -There are numerous avenues for nlbuild-autotools support: +nlbuild-autotools supports this by providing a means to pull down +external git package repositories that your package depends on using +git submodules when you use and support --with-=internal as a +location for your dependent packages. - * Bugs and feature requests — [submit to the Issue Tracker](https://github.com/nestlabs/nlbuild-autotools/issues) - * Google Groups — discussion and announcements - * [nlbuild-autotools-announce](https://groups.google.com/forum/#!forum/nlbuild-autotools-announce) — release notes and new updates on nlbuild-autotools - * [nlbuild-autotools-users](https://groups.google.com/forum/#!forum/nlbuild-autotools-users) — discuss use of and enhancements to nlbuild-autotools +The example 'Makefile-bootstrap' has been provided as infrastructure to +make this easy for you as a package maintainer and for your package +users. The bootstrap makefile supports both the generic 'repos' target +to pull down all repositories on which your project depends as well as +relative path targets to where those repositories might live in your +project when they are internal (e.g, +third_party/package/repo). -# FAQ +Consequently, you can, for example, invoke: + +``` +% make -f Makefile-bootstrap repos +``` + +or + +``` +% make -f Makefile-bootstrap third_party/package/repo +``` + +to pull down all repositories or just the repository, for example, +placed at 'third_party/package/repos'. + +The bootstrap makefile generated for your package is yours to edit and +extend. In fact, hooks have been added so that you can do +package-specific work, including recursively pulling down repositories +for other packages. + +However, an even better and easier approach for your package users is +to integrate the bootstrap makefile repository process into your +configure script such that when an "internal" package location is +detected, it invokes the bootstrap makefile to perform this work on +behalf of the user. For example: + +``` +# Depending on whether my-package has been configured for an internal +# location, its directory stem within this package needs to be set +# accordingly. In addition, if the location is internal, then we need +# to attempt to pull it down using the bootstrap makefile. + +if test "${nl_with_my_package}" = "internal"; then + maybe_my_package_dirstem="my-package/repo" + my_package_dirstem="third_party/${maybe_my_package_dirstem}" + + AC_MSG_NOTICE([attempting to create internal ${my_package_dirstem}]) + ${MAKE-make} --no-print-directory -C ${ac_confdir} -f Makefile-bootstrap ${my_package_dirstem} + + if test $? -ne 0; then + AC_MSG_ERROR([failed to create ${my_package_dirstem}. Please check your network connection or the correctness of 'repos.conf']) + fi +else + maybe_my_package_dirstem="" +fi + +AC_SUBST(MY_PACKAGE_SUBDIRS, [${maybe_my_package_dirstem}]) +AM_CONDITIONAL([PACKAGE_WITH_MY_PACKAGE_INTERNAL], [test "${nl_with_my_package}" = "internal"]) +``` + +Note, the use of AC_SUBST on MY_PACKAGE_SUBDIRS to provide a mechanism +to conditionally populate SUBDIRS in the appropriate automake file +locations such that GNU autoconf does not generate syntax errors about +the potential absence of the subdirectory at bootstrap time. + +Of course, in either case, network connectivity is required to reach +the external git server hosting the packages on which your project +depends. + +In addition to the 'repos' target, the bootstrap makefile also +supports the 'clean-repos' target that undoes the work of the 'repos' +target. It will clean-up all of the synchronized repositories, all the +while being careful to ensure it does not disturb existing git or git +submodule state your project might be using. + +The infrastructure all works, of course, whether you are working in or +out of git and whether you have colocated or non-colocated source and +build directories. + +### Configuration + +This dependent repository feature of nlbuild-autotools uses a file, +'repos.conf', at the top level of your project source directory to +determine what external project repositories your package might want +to pull down, the location of their git server, the branch you want to +pull, and the location in your project in which you want to place +them. + +The format of 'repos.conf' precisely follows that used by git +submodules. More information is available in 'Makefile-bootstrap' or +with `man gitmodules` or `git help gitmodules`. + +# FAQ {#FAQ} Q: Why does nlbuild-autotools have an option for its own built versions of GNU autotools rather than leveraging whatever versions exist on @@ -144,6 +241,34 @@ A: Some build host systems such as Mac OS X may not have GNU autotools standalone set of scripts to drive them without reliance on those versions of the tools on the build host system. +Q: When I rebootstrap my package, I see that a number of files related to + nlbuild-autotools have unexpectedly changed. Why is this happening? + +A: From time to time, the packages that comprise GNU autotools change + upstream. Frequently, common host operating systems (e.g., Ubuntu) take + a stable snapshot of the current autotools for a major release (e.g., + Ubuntu 14). On the next major release (e.g., Ubuntu 16), another snapshot + is taken. + + If your package was first bootstrapped with one version of + autotools and those bootstrap-generated files checked-in but you + later bootstrap with another version of autotools, then you will + likely observe this behavior. + + There are two solutions to this problem. First, to ensure a + consistent set of bootstrap-generated files, you can build the + autotools included with nlbuild-autotools. The bootstrap process + will always prefer to use those versions rather than those + available on the build host when they are available. See the + section [Build and Install](#Build_and_Install) for more + information. + + The second way to ensure a consistent set of bootstrap-generated + files is to not check them in. This does, however, require that + package users, rather than package maintainers, perform the + bootstrap process and does require that package users, rather than + package maintainers, have autotools available on the build host. + ## Maintainers If you are maintaining nlbuild-autotools, you have several key things to know: diff --git a/third_party/nlbuild-autotools/repo/examples/Makefile-bootstrap b/third_party/nlbuild-autotools/repo/examples/Makefile-bootstrap new file mode 100644 index 000000000..130db3789 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/examples/Makefile-bootstrap @@ -0,0 +1,105 @@ +# +# Copyright 2017-2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is the makefile for inlining optional and required +# third-party packages as package-internal copies and for providing +# convenience targets for bootstrapping the GNU autotools-based build +# system used by this package. +# +# If your package has dependent git repositories that you might +# otherwise be inclined to subtree in, you can define a +# "repos.conf" file at the top of your project that enumerates +# the repositories, the branch thereof, and where to put it in +# your project. An example is shown below: +# +# [submodule "nlassert"] +# path = third_party/nlassert/repo +# url = git@github.com:nestlabs/nlassert.git +# branch = master +# update = none +# [submodule "nlunit-test"] +# path = third_party/nlunit-test/repo +# url = git@github.com:nestlabs/nlunit-test.git +# branch = master +# update = none +# + +ThisMakefile := $(firstword $(MAKEFILE_LIST)) + +builddir ?= . +abs_builddir ?= $(realpath $(builddir)) +top_builddir ?= $(builddir) +abs_top_builddir ?= $(realpath $(top_builddir)) +srcdir ?= $(dir $(realpath $(ThisMakefile))) +abs_srcdir ?= $(realpath $(srcdir)) +top_srcdir ?= $(srcdir) +abs_top_srcdir ?= $(realpath $(top_srcdir)) + +nlbuild_autotools_stem ?= @NLBUILD_AUTOTOOLS_STEM@ +abs_top_nlbuild_autotools_dir ?= $(abs_top_srcdir)/$(nlbuild_autotools_stem) + +include $(abs_top_nlbuild_autotools_dir)/make/pre.mak +include $(abs_top_nlbuild_autotools_dir)/make/host/tools/bootstrap.mak + +# +# Add any project-specific bootstrap help commands to this +# 'help-hook' target. +# +# These commands will be executed AFTER the core bootstrap 'help' +# target commands. +# +help-hook: + +# +# Add any project-specific bootstrap help commands to this +# 'help-bootstrap-hook' target. +# +# These commands will be executed AFTER the core bootstrap 'help' and +# 'help-bootstrap' target commands. +# +help-bootstrap-hook: + +# +# Add any project-specific bootstrap help commands to this +# 'help-repos-hook' target. +# +# These commands will be executed AFTER the core bootstrap 'help' and +# 'help-repos' target commands. +# +help-repos-hook: + +# +# Add any project-specific bootstrap repos commands to this +# 'repos-hook' target. +# +# These commands will be executed AFTER the core bootstrap 'repos' +# target commands. +# +repos-hook: + +# +# Add any project-specific bootstrap repos commands to this +# 'clean-repos-hook' target. +# +# These commands will be executed BEFORE the core bootstrap 'clean-repos' +# target commands. +# +clean-repos-hook: + +include $(abs_top_nlbuild_autotools_dir)/make/post.mak +include $(abs_top_nlbuild_autotools_dir)/make/post/rules/bootstrap.mak diff --git a/third_party/nlbuild-autotools/repo/examples/Makefile-third_party.am b/third_party/nlbuild-autotools/repo/examples/Makefile-third_party.am index 519e61482..7bd0be595 100644 --- a/third_party/nlbuild-autotools/repo/examples/Makefile-third_party.am +++ b/third_party/nlbuild-autotools/repo/examples/Makefile-third_party.am @@ -27,9 +27,26 @@ include $(abs_top_nlbuild_autotools_dir)/automake/pre.am DIST_SUBDIRS = \ $(NULL) -# Always build (e.g. for 'make all') these subdirectories. +# Here is an example with nlunit-test. Uncomment and adapt or delete +# this, as needed. If you choose to use this, please also take a look at +# configure.ac and Makefile.am and uncomment the appropriate sections +# there. -SUBDIRS = \ +# # NLUNIT_TEST_SUBDIRS is not a permanent part of DIST_SUBDIRS since we do not +# # ever want to include it in a distribution archive; however, when it's been +# # pulled as a 'repo' module, we do want to remove it on invocation of the +# # 'distclean' target. Consequently, we conditionally include it in DIST_SUBDIRS +# # on invocation of 'distclean-recursive' +# +# distclean-recursive: DIST_SUBDIRS += $(NLUNIT_TEST_SUBDIRS) + +# Always build (e.g. for 'make all') these subdirectories. +# # +# # The value of NLUNIT_TEST_SUBDIRS will be populated by configure if +# # --with-nlunit_test=internal + +SUBDIRS = \ + $(NLUNIT_TEST_SUBDIRS) \ $(NULL) include $(abs_top_nlbuild_autotools_dir)/automake/post.am diff --git a/third_party/nlbuild-autotools/repo/examples/Makefile-toplevel.am b/third_party/nlbuild-autotools/repo/examples/Makefile-toplevel.am index e122b699e..54578d371 100644 --- a/third_party/nlbuild-autotools/repo/examples/Makefile-toplevel.am +++ b/third_party/nlbuild-autotools/repo/examples/Makefile-toplevel.am @@ -1,5 +1,5 @@ # -# Copyright 2016 Nest Labs Inc. All Rights Reserved. +# Copyright 2016-2018 Nest Labs Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ SUBDIRS = \ $(NULL) EXTRA_DIST = \ + Makefile-bootstrap \ .default-version \ bootstrap \ bootstrap-configure \ @@ -136,10 +137,35 @@ $(distdir)/.dist-version: $(builddir)/.local-version force $(distdir)/.dist-version $(builddir)/.local-version: $(call check-file,$(@F)) +# If you are synchronizing a package on which yours depends using 'repos.conf', +# to 'third_party', uncomment and adapt or delete this, as needed. If you choose +# to use this, please also take a look at Makefile.am and third_party/Makefile.am +# and uncomment the appropriate sections there. + +# # +# # When we run 'distcheck' and --with-nlunit_test defaults to 'internal', +# # the nlbuild-autotools infrastructure will attempt to create git paths +# # to manage the nlunit-test repo. Two directories need to be writable +# # to facilitate this. +# # +# DISTCHECK_CONFIGURE_FLAGS=`chmod u+w .. ../third_party` + dist distcheck: $(BUILT_SOURCES) dist-hook: $(distdir)/.dist-version +# If you are synchronizing a package on which yours depends using 'repos.conf', +# to 'third_party', uncomment and adapt or delete this, as needed. If you choose +# to use this, please also take a look at Makefile.am and third_party/Makefile.am +# and uncomment the appropriate sections there. + +# # +# # Ensure any locally synchronized repositories defined by 'repos.conf' +# # are cleaned up. +# # +# distclean-local: +# $(MAKE) -C $(srcdir) -f Makefile-bootstrap clean-repos + # # Top-level convenience target for making a documentation-only # distribution whose results appear at the top level of the build tree diff --git a/third_party/nlbuild-autotools/repo/examples/configure.ac b/third_party/nlbuild-autotools/repo/examples/configure.ac index 588a33113..02bc83d96 100644 --- a/third_party/nlbuild-autotools/repo/examples/configure.ac +++ b/third_party/nlbuild-autotools/repo/examples/configure.ac @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. # -# Copyright 2016-2017 Nest Labs Inc. All Rights Reserved. +# Copyright 2016-2018 Nest Labs Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ AC_PREREQ([2.68]) # # Initialize autoconf for the package # -AC_INIT([@PACKAGE_SHORT_UPPER@], +AC_INIT([@PACKAGE_SHORT_LOWER@], m4_esyscmd([@NLBUILD_AUTOTOOLS_STEM@/scripts/mkversion -b `cat .default-version` .]), [@PACKAGE_EMAIL@], [@PACKAGE_SHORT_LOWER@], @@ -268,12 +268,69 @@ AM_CONDITIONAL(@PACKAGE_SHORT_UPPER@_BUILD_DOCS, [test "${nl_cv_build_docs}" = " # AC_MSG_NOTICE([checking required package dependencies]) -# NL_WITH_PACKAGE(...) - # Check if the build host has pkg-config AC_PATH_PROG([PKG_CONFIG],[pkg-config]) +# Here is a package example with nlunit-test. Uncomment and adapt or delete +# this, as needed. If you choose to use this, please also take a look at +# Makefile.am and third_party/Makefile.am and uncomment the appropriate +# sections there. + +# # +# # Nlunit-test +# # +# +# if test "${nl_cv_build_tests}" = "yes"; then +# NL_WITH_PACKAGE( +# [Nlunit-test], +# [NLUNIT_TEST], +# [nlunit_test], +# [-lnlunit-test], +# [ +# # At this point, the internal Nlunit-test package will be neither +# # configured nor built, so the normal checks we undertake for an +# # external package cannot be run here. Simply set the appropriate +# # variables and trust all will be well. +# +# NLUNIT_TEST_CPPFLAGS="-I\${abs_top_srcdir}/third_party/nlunit-test/repo/src" +# NLUNIT_TEST_LDFLAGS="-L${ac_pwd}/third_party/nlunit-test/repo/src" +# NLUNIT_TEST_LIBS="-lnlunit-test" +# ], +# [ +# # Check for required nlunit-test headers. +# +# AC_CHECK_HEADERS([nlunit-test.h], +# [], +# [ +# AC_MSG_ERROR(The nlunit-test header "$ac_header" is required but cannot be found.) +# ]) +# ]) +# fi +# +# # Depending on whether nlunit-test has been configured for an internal +# # location, its directory stem within this package needs to be set +# # accordingly. In addition, if the location is internal, then we need +# # to attempt to pull it down using the bootstrap makefile. +# +# if test "${nl_with_nlunit_test}" = "internal"; then +# maybe_nlunit_test_dirstem="nlunit-test/repo" +# nlunit_test_dirstem="third_party/${maybe_nlunit_test_dirstem}" +# +# AC_MSG_NOTICE([attempting to create internal ${nlunit_test_dirstem}]) +# +# ${MAKE-make} --no-print-directory -C ${srcdir} -f Makefile-bootstrap ${nlunit_test_dirstem} +# +# if test $? -ne 0; then +# AC_MSG_ERROR([failed to create ${nlunit_test_dirstem}. Please check your network connection or the correctness of 'repos.conf']) +# fi +# else +# maybe_nlunit_test_dirstem="" +# fi +# +# AC_SUBST(NLUNIT_TEST_SUBDIRS, [${maybe_nlunit_test_dirstem}]) +# AM_CONDITIONAL([@PACKAGE_SHORT_UPPER@_WITH_NLUNIT_TEST_INTERNAL], [test "${nl_with_nlunit_test}" = "internal"]) + # # Check for headers # @@ -303,17 +360,35 @@ if test "${ac_no_link}" != "yes"; then AC_CHECK_FUNCS([memcpy]) fi +# Here is an example with nlunit-test. Uncomment and adapt or delete +# this, as needed. + +# # Add any nlunit-test CPPFLAGS, LDFLAGS, and LIBS +# +# CPPFLAGS="${CPPFLAGS} ${NLUNIT_TEST_CPPFLAGS}" +# LDFLAGS="${LDFLAGS} ${NLUNIT_TEST_LDFLAGS}" +# LIBS="${LIBS} ${NLUNIT_TEST_LIBS}" + # Add any code coverage CPPFLAGS and LIBS CPPFLAGS="${CPPFLAGS} ${NL_COVERAGE_CPPFLAGS}" LIBS="${LIBS} ${NL_COVERAGE_LIBS}" # At this point, we can restore the compiler flags to whatever the -# user passed in, now that we're clear of an -Werror issues by +# user passed in, now that we're clear of any -Werror issues by # transforming -Wno-error back to -Werror. NL_RESTORE_WERROR +# Here is an example with nlunit-test. Uncomment and adapt or delete +# this, as needed. + +# # Configure any autotools-based subdirectories +# +# if test "${nl_with_nlunit_test}" = "internal"; then +# AC_CONFIG_SUBDIRS([third_party/nlunit-test/repo]) +# fi + # # Identify the various makefiles and auto-generated files for the package # @@ -362,6 +437,10 @@ AC_MSG_NOTICE([ Doxygen : ${DOXYGEN:--} GraphViz dot : ${DOT:--} PERL : ${PERL:--} + Nlunit-test source : ${nl_with_nlunit_test:--} + Nlunit-test compile flags : ${NLUNIT_TEST_CPPFLAGS:--} + Nlunit-test link flags : ${NLUNIT_TEST_LDFLAGS:--} + Nlunit-test link libraries : ${NLUNIT_TEST_LIBS:--} C Preprocessor : ${CPP} C Compiler : ${CC} C++ Preprocessor : ${CXXCPP} @@ -377,6 +456,3 @@ AC_MSG_NOTICE([ Link libraries : ${LIBS} ]) - - - diff --git a/third_party/nlbuild-autotools/repo/examples/repos.conf b/third_party/nlbuild-autotools/repo/examples/repos.conf new file mode 100644 index 000000000..0fc4b7482 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/examples/repos.conf @@ -0,0 +1,17 @@ +# You can synchronize a remote package on which yours depends with git +# to 'third_party' (or another directory). +# +# Here is an example using nlunit-test. Uncomment and adapter or +# delete this, as needed. If you do not have any packages to +# sychronize, then this file is unneeded and may be deleted from your +# project. +# +# If you choose to use this, please also take a look at configure.ac, +# Makefile.am, and third_party/Makefile.am and uncomment the appropriate +# sections there. + +# [submodule "nlunit-test"] +# path = third_party/nlunit-test/repo +# url = https://github.com/nestlabs/nlunit-test.git +# branch = master +# update = none diff --git a/third_party/nlbuild-autotools/repo/make/host/tools.mak b/third_party/nlbuild-autotools/repo/make/host/tools.mak new file mode 100644 index 000000000..04ee0f4fc --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/host/tools.mak @@ -0,0 +1,24 @@ +# +# Copyright 2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is the generic "header" or pre make header for all +# common host-specific (i.e., non-target and -toolchain-specific) +# tools included in any makefile used in the build tree. +# + +include $(abs_top_nlbuild_autotools_dir)/make/host/tools/tools.mak diff --git a/third_party/nlbuild-autotools/repo/make/host/tools/bootstrap.mak b/third_party/nlbuild-autotools/repo/make/host/tools/bootstrap.mak new file mode 100644 index 000000000..5959df425 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/host/tools/bootstrap.mak @@ -0,0 +1,23 @@ +# +# Copyright 2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is the make header for the nlbuild-autotools +# bootstrap script. +# + +BOOTSTRAP ?= $(top_srcdir)/bootstrap diff --git a/third_party/nlbuild-autotools/repo/make/host/tools/tools.mak b/third_party/nlbuild-autotools/repo/make/host/tools/tools.mak new file mode 100644 index 000000000..2de99c933 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/host/tools/tools.mak @@ -0,0 +1,46 @@ +# +# Copyright 2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is the generic "header" or pre make header for all +# common host-specific (i.e., non-target and -toolchain-specific) +# tools included in any makefile used in the build tree. +# + +CAT ?= cat +CHMOD ?= chmod +CMP ?= cmp +CUT ?= cut +FIND ?= find +GIT ?= git +GREP ?= grep +GZIP ?= gzip +MKDIR ?= mkdir +MV ?= mv + +RMFLAGS = -f +ifeq ($(V),1) +RMFLAGS += -v +endif +RM ?= rm $(RMFLAGS) + +RMDIR ?= rmdir +SED ?= sed +SORT ?= sort +TAR ?= tar +UNIQ ?= uniq +XZ ?= xz diff --git a/third_party/nlbuild-autotools/repo/make/post.mak b/third_party/nlbuild-autotools/repo/make/post.mak new file mode 100644 index 000000000..702580b41 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/post.mak @@ -0,0 +1,23 @@ +# +# Copyright 2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is the generic "footer" or post make header included in +# any makefile used in the build tree. +# + +include $(abs_top_nlbuild_autotools_dir)/make/post/rules.mak diff --git a/third_party/nlbuild-autotools/repo/make/post/rules.mak b/third_party/nlbuild-autotools/repo/make/post/rules.mak new file mode 100644 index 000000000..da4503a53 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/post/rules.mak @@ -0,0 +1,24 @@ +# +# Copyright 2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is the generic "footer" or post make header for all +# common rules included in any makefile used in the build tree. +# + +include $(abs_top_nlbuild_autotools_dir)/make/post/rules/help.mak +include $(abs_top_nlbuild_autotools_dir)/make/post/rules/repos.mak diff --git a/third_party/nlbuild-autotools/repo/make/post/rules/bootstrap.mak b/third_party/nlbuild-autotools/repo/make/post/rules/bootstrap.mak new file mode 100644 index 000000000..36f07f662 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/post/rules/bootstrap.mak @@ -0,0 +1,126 @@ +# +# Copyright 2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is the make footer for nlbuild-autotools bootstrap +# convenience targets. +# + +# The following targets provide some convenience targets for bootstrapping +# the GNU autotools-based build system used by this package. + +all check coverage dist distcheck doc docdist install install-headers pretty pretty-check: Makefile + $(NL_V_MAKE)$(MAKE) -f $(<) --no-print-directory $(@) + +Makefile: $(top_srcdir)/Makefile.in $(top_srcdir)/configure + $(NL_V_CONFIGURE)$(top_srcdir)/configure + +$(top_srcdir)/configure: $(top_srcdir)/configure.ac + $(NL_V_BOOTSTRAP_CONFIG)$(BOOTSTRAP) -w config + +Makefile.in: Makefile.am + $(NL_V_BOOTSTRAP_MAKE)$(BOOTSTRAP) -w make + +.PHONY: bootstrap +bootstrap: + $(NL_V_BOOTSTRAP_ALL)$(BOOTSTRAP) -w all + +.PHONY: bootstrap-config +bootstrap-config: + $(NL_V_BOOTSTRAP_CONFIG)$(BOOTSTRAP) -w config + +.PHONY: bootstrap-make +bootstrap-make: + $(NL_V_BOOTSTRAP_MAKE)$(BOOTSTRAP) -w make + +define PrintBootstrapHelp +$(NL_V_AT)echo " all" +$(NL_V_AT)echo " Generate all configured build artifacts for this project." +$(NL_V_AT)echo +$(NL_V_AT)echo " bootstrap" +$(NL_V_AT)echo " (Re-)generate all build infrastructure for the project, " +$(NL_V_AT)echo " including both build configuration scripts and makefiles." +$(NL_V_AT)echo +$(NL_V_AT)echo " bootstrap-all" +$(NL_V_AT)echo " (Re-)generate all build infrastructure for the project, " +$(NL_V_AT)echo " including both build configuration scripts and makefiles." +$(NL_V_AT)echo +$(NL_V_AT)echo " bootstrap-config" +$(NL_V_AT)echo " (Re-)generate build configuration scripts for the project." +$(NL_V_AT)echo +$(NL_V_AT)echo " bootstrap-make" +$(NL_V_AT)echo " (Re-)generate build makefiles for the project." +$(NL_V_AT)echo +$(NL_V_AT)echo " check" +$(NL_V_AT)echo " Generate all configured build artifacts and run all unit " +$(NL_V_AT)echo " and functional tests for this project." +$(NL_V_AT)echo +$(NL_V_AT)echo " coverage" +$(NL_V_AT)echo " Generate all configured build artifacts, run all unit " +$(NL_V_AT)echo " and functional tests, and generate code coverage results " +$(NL_V_AT)echo " for this project." +$(NL_V_AT)echo +$(NL_V_AT)echo " dist" +$(NL_V_AT)echo " Generate an archive distribution snapshot for this project." +$(NL_V_AT)echo +$(NL_V_AT)echo " distcheck" +$(NL_V_AT)echo " Generate an archive distribution snapshot for this project " +$(NL_V_AT)echo " and sanity check the resulting distribution by running " +$(NL_V_AT)echo " 'make check' on it for this project." +$(NL_V_AT)echo +$(NL_V_AT)echo " doc" +$(NL_V_AT)echo " Generate documentation for the project." +$(NL_V_AT)echo +$(NL_V_AT)echo " docdist" +$(NL_V_AT)echo " Generate an archive distribution of the documentation for " +$(NL_V_AT)echo " the project." +$(NL_V_AT)echo +$(NL_V_AT)echo " install" +$(NL_V_AT)echo " Generate all configured build artifacts for this project " +$(NL_V_AT)echo " and install them in DESTDIR on the build host system." +$(NL_V_AT)echo +$(NL_V_AT)echo " install-headers" +$(NL_V_AT)echo " Generate all configured public header artifacts for this " +$(NL_V_AT)echo " project and install them in DESTDIR on the build host " +$(NL_V_AT)echo " system." +$(NL_V_AT)echo +$(NL_V_AT)echo " pretty" +$(NL_V_AT)echo " (Re-)format a collection of project source files." +$(NL_V_AT)echo +$(NL_V_AT)echo " pretty-check" +$(NL_V_AT)echo " Check but do not (re-)format a collection of project " +$(NL_V_AT)echo " source files." +$(NL_V_AT)echo +$(NL_V_AT)echo " Makefile" +$(NL_V_AT)echo " Run 'configure' for this project and generate the" +$(NL_V_AT)echo " host-specific makefile." +$(NL_V_AT)echo +endef # PrintBootstrapHelp + +.PHONY: help-bootstrap-local +help-bootstrap-local: + $(call PrintBootstrapHelp) + +.PHONY: help-bootstrap-hook +help-bootstrap-hook: help-bootstrap-local + +.PHONY: help-bootstrap +help-bootstrap: help-bootstrap-local help-bootstrap-hook + +.PHONY: help +help: help-bootstrap + diff --git a/third_party/nlbuild-autotools/repo/make/post/rules/help.mak b/third_party/nlbuild-autotools/repo/make/post/rules/help.mak new file mode 100644 index 000000000..8c9061535 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/post/rules/help.mak @@ -0,0 +1,39 @@ +# +# Copyright 2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is the make "footer" or post make header for help-related +# targets. +# + +define PrintHelp +$(NL_V_AT)echo "This makefile supports the following build targets:" +$(NL_V_AT)echo +$(NL_V_AT)echo " help" +$(NL_V_AT)echo " Display this content." +$(NL_V_AT)echo +endef # PrintHelp + +.PHONY: help-local +help-local: + $(call PrintHelp) + +.PHONY: help-hook +help-hook: help-local + +.PHONY: help +help: help-local help-hook diff --git a/third_party/nlbuild-autotools/repo/make/post/rules/repos.mak b/third_party/nlbuild-autotools/repo/make/post/rules/repos.mak new file mode 100644 index 000000000..a7bca8ef8 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/post/rules/repos.mak @@ -0,0 +1,190 @@ +# +# Copyright 2017-2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is a make "footer" or post make header that defines make +# convenience targets and templates for interacting with and managing git +# submodules in the context of managing project dependencies. +# + +ifneq ($(REPOS),) +# Stem for the git configuration file for a git repository. + +__REPOS_GIT_CONFIG_STEM := /.git/config + +# Stem for the git cache directory for a git submodule + +__REPOS_GIT_MODULE_CACHE_STEM := /.git/modules + +# git submodule configuration file and path + +__REPOS_GIT_MODULES_FILE := .gitmodules +__REPOS_GIT_MODULES_PATH := $(top_srcdir)/$(__REPOS_GIT_MODULES_FILE) + +# Stem for the git configuration file for a git submodule. + +__REPOS_GIT_SUBMODULE_STEM := /.git + +# Git repository configuration for this package, if it exists. + +REPOS_PACKAGE_GIT_PATH := $(top_srcdir)$(__REPOS_GIT_CONFIG_STEM) + +# Sentinel Files + +REPOS_GIT_INIT_SENTINEL := $(top_srcdir)/.repos-git-init-stamp +REPOS_GIT_MODULES_SENTINEL := $(top_srcdir)/.repos-git-modules-stamp +REPOS_WARNING_SENTINEL := $(top_builddir)/.repos-warning-stamp + +# +# REPOS_template +# +# This template defines variables and targets used for inlining optional and required +# third-party packages as package-internal copies. +# +# - Path to the repo configuration file from which to get values for +# named repo. +# - Name of the repository in for which to get values for +# branch, local path, and URL. +# +define REPOS_template +$(2)_repo_NAME := $(2) +$(2)_repo_BRANCH := $$(call nlGitGetBranchForRepoFromNameFromFile,$(1),$(2)) +$(2)_repo_PATH := $$(call nlGitGetPathForRepoFromNameFromFile,$(1),$(2)) +$(2)_repo_URL := $$(call nlGitGetURLForRepoFromNameFromFile,$(1),$(2)) + +$(2)_repo_GIT := $$(addsuffix $(__REPOS_GIT_SUBMODULE_STEM),$$($(2)_repo_PATH)) +$(2)_repo_CACHE := $(top_srcdir)$(__REPOS_GIT_MODULE_CACHE_STEM)/$$($(2)_repo_PATH) + +REPO_NAMES += $$($(2)_repo_NAME) +REPO_GITS += $$($(2)_repo_GIT) +REPO_PATHS += $$($(2)_repo_PATH) +REPO_URLS += $$($(2)_repo_URL) +REPO_CACHES += $$($(2)_repo_CACHE) + +# Allow a repo to be made with a path target (e.g., third_party/foo/repo) or +# with its actual git target (e.g., third_party/foo/repo/.git). + +$$($(2)_repo_PATH): $$($(2)_repo_GIT) + +$$($(2)_repo_GIT): $(REPOS_PACKAGE_GIT_PATH) repos-warning + @echo " SUBMODULE $$(subst $(__REPOS_GIT_SUBMODULE_STEM),,$$(@))" + $(NL_V_AT)if ! test -f $(__REPOS_GIT_MODULES_PATH); then \ + touch $(REPOS_GIT_MODULES_SENTINEL); \ + fi + $(NL_V_AT)$(GIT) -C $(top_srcdir) submodule -q add -f -b $$($(2)_repo_BRANCH) -- $$($(2)_repo_URL) $$($(2)_repo_PATH) +endef # REPOS_template + +$(REPOS_PACKAGE_GIT_PATH): + $(NL_V_GIT_INIT)$(GIT) -C $(top_srcdir) init -q $(top_srcdir) + $(NL_V_AT)touch $(REPOS_GIT_INIT_SENTINEL) + +define PrintReposWarning +$(NL_V_AT)echo "The 'repos' target requires external network connectivity to" +$(NL_V_AT)echo "reach the following upstream GIT repositories:" +$(NL_V_AT)echo "" +$(NL_V_AT)for url in $(REPO_URLS); do echo " $${url}"; done +$(NL_V_AT)echo "" +$(NL_V_AT)echo "and will fail if external network connectivity is not" +$(NL_V_AT)echo "available. This package may still be buildable without these" +$(NL_V_AT)echo "packages but may require disabling certain features or" +$(NL_V_AT)echo "functionality." +$(NL_V_AT)echo "" +endef # PrintReposWarning + +$(REPOS_WARNING_SENTINEL): + $(NL_V_AT)touch $(@) + $(call PrintReposWarning) + +.PHONY: repos-warning +repos-warning: $(REPOS_WARNING_SENTINEL) + +.PHONY: repos-local +repos-local: repos-warning + $(NL_V_AT)$(MAKE) -f $(firstword $(MAKEFILE_LIST)) --no-print-directory $(REPO_GITS) + +.PHONY: repos-hook +repos-hook: repos-local + +.PHONY: repos +repos: repos-local repos-hook + +.PHONY: clean-repos-hook +clean-repos-hook: + +.PHONY: clean-repos-local +clean-repos-local: clean-repos-hook + @echo " CLEAN" + $(NL_V_AT)$(GIT) -C $(top_srcdir) submodule -q deinit -f -- $(REPO_PATHS) 2> /dev/null || true + $(NL_V_AT)if test -f $(REPOS_GIT_MODULES_SENTINEL); then \ + $(RM) $(REPOS_GIT_MODULES_SENTINEL); \ + $(GIT) -C $(top_srcdir) rm -f -q $(__REPOS_GIT_MODULES_PATH) 2> /dev/null; \ + fi + $(NL_V_AT)if test -f $(REPOS_GIT_INIT_SENTINEL); then \ + $(RM) -r $(dir $(REPOS_PACKAGE_GIT_PATH)); \ + $(RM) $(REPOS_GIT_INIT_SENTINEL); \ + fi + $(NL_V_AT)$(RM) $(REPOS_WARNING_SENTINEL) + $(NL_V_AT)$(GIT) -C $(top_srcdir) rm -rf -q --cached $(REPO_PATHS) 2> /dev/null || true + $(NL_V_AT)$(RM) -r $(addprefix $(top_srcdir)/,$(REPO_PATHS)) + $(NL_V_AT)$(RMDIR) -p $(addprefix $(top_srcdir),$(dir $(REPO_PATHS))) 2> /dev/null || true + $(NL_V_AT)$(RM) -r $(REPO_CACHES) 2> /dev/null + +.PHONY: clean-repos +clean-repos: clean-repos-local + +# Invoke the REPOS_template for each defined optionally-inlined package repo + +$(foreach repo,$(REPOS),$(eval $(call REPOS_template,$(REPOS_CONFIG),$(repo)))) + +define MaybePrintReposHelp +$(NL_V_AT)echo " repos" +$(NL_V_AT)echo " Clone any upstream, dependent git repositories that this package" +$(NL_V_AT)echo " regards as required or optional rather than using '--with-'" +$(NL_V_AT)echo " options to specify external instances of those packages." +$(NL_V_AT)echo +$(NL_V_AT)echo " clean-repos" +$(NL_V_AT)echo " This is the opposite of the 'repos' target. This removes, in their" +$(NL_V_AT)echo " entirety, any clones of any upstream, dependent git repositories that" +$(NL_V_AT)echo " this package regards as required or optional." +$(NL_V_AT)echo +endef # MaybePrintReposHelp + +.DEFAULT_GOAL := repos +else + +define MaybePrintReposHelp +endef # MaybePrintReposHelp + +.DEFAULT_GOAL := help +endif # REPOS + +define PrintReposHelp +$(call MaybePrintReposHelp) +endef # PrintReposHelp + +.PHONY: help-repos-local +help-repos-local: + $(call PrintReposHelp) + +.PHONY: help-repos-hook +help-repos-hook: help-repos-local + +.PHONY: help-repos +help-repos: help-repos-local help-repos-hook + +.PHONY: help +help: help-repos diff --git a/third_party/nlbuild-autotools/repo/make/pre.mak b/third_party/nlbuild-autotools/repo/make/pre.mak new file mode 100644 index 000000000..62b204daa --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/pre.mak @@ -0,0 +1,24 @@ +# +# Copyright 2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is the generic "header" or pre make header included in +# any makefile used in the build tree. +# + +include $(abs_top_nlbuild_autotools_dir)/make/pre/tools.mak +include $(abs_top_nlbuild_autotools_dir)/make/pre/macros.mak diff --git a/third_party/nlbuild-autotools/repo/make/pre/macros.mak b/third_party/nlbuild-autotools/repo/make/pre/macros.mak new file mode 100644 index 000000000..f92b4427a --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/pre/macros.mak @@ -0,0 +1,25 @@ +# +# Copyright 2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is the make "header" or pre make header for macros common to +# all other make headers and files. +# + +include $(abs_top_nlbuild_autotools_dir)/make/pre/macros/git.mak +include $(abs_top_nlbuild_autotools_dir)/make/pre/macros/repos.mak +include $(abs_top_nlbuild_autotools_dir)/make/pre/macros/verbosity.mak diff --git a/third_party/nlbuild-autotools/repo/make/pre/macros/git.mak b/third_party/nlbuild-autotools/repo/make/pre/macros/git.mak new file mode 100644 index 000000000..145e01125 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/pre/macros/git.mak @@ -0,0 +1,69 @@ +# +# Copyright 2017-2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is the make "header" or pre make header that defines make +# convenience macros for interacting with git. +# + +# nlGitGetConfigFromFileCommand +# +# Command to get a value for a variable set in the specified git config file . + +nlGitGetConfigFromFileCommand = $(GIT) config --file $(1) + +# nlGitListConfigFromFileCommand +# +# Command to list all variables set in the specified config file + +nlGitListConfigFromFileCommand = $(call nlGitGetConfigFromFileCommand,$(1)) --list --name-only + +# nlGitGetConfigFromFile +# +# Get a value for a variable set in the specified git config file . + +nlGitGetConfigFromFile = $(shell $(call nlGitGetConfigFromFileCommand,$(1))) + +# NlGitListConfigFromFile +# +# List all variables set in the specified config file + +nlGitListConfigFromFile = $(shell $(call nlGitListConfigFromFileCommand,$(1))) + +# nlGitGetValueForRepoFromNameFromFile +# +# Get a value for a repo / submodule variable set in specified git config file . + +nlGitGetValueForRepoFromNameFromFile = $(shell $(call nlGitGetConfigFromFileCommand,$(1)) 'submodule.$(2).$(3)') + +# nlGitGetBranchForRepoFromNameFromFile +# +# Get a the remote branch for a repo / submodule variable set in specified git config file . + +nlGitGetBranchForRepoFromNameFromFile = $(call nlGitGetValueForRepoFromNameFromFile,$(1),$(2),branch) + +# nlGitGetURLForRepoFromNameFromFile +# +# Get a the remote URL for a repo / submodule variable set in specified git config file . + +nlGitGetURLForRepoFromNameFromFile = $(call nlGitGetValueForRepoFromNameFromFile,$(1),$(2),url) + +# nlGitGetPathForRepoFromNameFromFile +# +# Get a the local path for a repo / submodule variable set in specified git config file . + +nlGitGetPathForRepoFromNameFromFile = $(call nlGitGetValueForRepoFromNameFromFile,$(1),$(2),path) diff --git a/third_party/nlbuild-autotools/repo/make/pre/macros/repos.mak b/third_party/nlbuild-autotools/repo/make/pre/macros/repos.mak new file mode 100644 index 000000000..dfc7df62b --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/pre/macros/repos.mak @@ -0,0 +1,32 @@ +# +# Copyright 2017-2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is a make "header" or pre make header that defines make +# convenience macros for interacting with and managing git submodules +# in the context of managing project dependencies. +# + +# Third-party package repository configuration, if it exists, listing all +# packages and their names, branches, URLs, and local paths that may be +# optionally inlined for this package. +# +# This file is formatted identically to .gitmodules (see gitmodules(5)). + +REPOS_CONFIG ?= $(top_srcdir)/repos.conf + +REPOS := $(shell if test -f $(REPOS_CONFIG); then $(call nlGitListConfigFromFileCommand,$(REPOS_CONFIG)) | $(GREP) '^submodule\.' | $(CUT) -d '.' -f 2 | $(SORT) | $(UNIQ); fi) diff --git a/third_party/nlbuild-autotools/repo/make/pre/macros/verbosity.mak b/third_party/nlbuild-autotools/repo/make/pre/macros/verbosity.mak new file mode 100644 index 000000000..1fb5cb096 --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/pre/macros/verbosity.mak @@ -0,0 +1,72 @@ +# +# Copyright 2017-2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is a make "header" or pre make header that defines make macros +# for controlling build verbosity. +# + +# +# Verbosity +# + +NL_DEFAULT_VERBOSITY ?= 0 + +NL_V_AT = $(NL_V_AT_$(V)) +NL_V_AT_ = $(NL_V_AT_$(NL_DEFAULT_VERBOSITY)) +NL_V_AT_0 = @ +NL_V_AT_1 = + +NL_V_BOOTSTRAP_ALL = $(NL_V_BOOTSTRAP_ALL_$(V)) +NL_V_BOOTSTRAP_ALL_ = $(NL_V_BOOTSTRAP_ALL_$(NL_DEFAULT_VERBOSITY)) +NL_V_BOOTSTRAP_ALL_0 = @echo " BOOTSTRAP all"; +NL_V_BOOTSTRAP_ALL_1 = + +NL_V_BOOTSTRAP_CONFIG = $(NL_V_BOOTSTRAP_CONFIG_$(V)) +NL_V_BOOTSTRAP_CONFIG_ = $(NL_V_BOOTSTRAP_CONFIG_$(NL_DEFAULT_VERBOSITY)) +NL_V_BOOTSTRAP_CONFIG_0 = @echo " BOOTSTRAP config"; +NL_V_BOOTSTRAP_CONFIG_1 = + +NL_V_BOOTSTRAP_MAKE = $(NL_V_BOOTSTRAP_MAKE_$(V)) +NL_V_BOOTSTRAP_MAKE_ = $(NL_V_BOOTSTRAP_MAKE_$(NL_DEFAULT_VERBOSITY)) +NL_V_BOOTSTRAP_MAKE_0 = @echo " BOOTSTRAP make"; +NL_V_BOOTSTRAP_MAKE_1 = + +NL_V_CONFIGURE = $(NL_V_CONFIGURE_$(V)) +NL_V_CONFIGURE_ = $(NL_V_CONFIGURE_$(NL_DEFAULT_VERBOSITY)) +NL_V_CONFIGURE_0 = @echo " CONFIGURE"; +NL_V_CONFIGURE_1 = + +NL_V_GIT_INIT = $(NL_V_GIT_INIT_$(V)) +NL_V_GIT_INIT_ = $(NL_V_GIT_INIT_$(NL_DEFAULT_VERBOSITY)) +NL_V_GIT_INIT_0 = @echo " GIT INIT $(@)"; +NL_V_GIT_INIT_1 = + +NL_V_MAKE = $(NL_V_MAKE_$(V)) +NL_V_MAKE_ = $(NL_V_MAKE_$(NL_DEFAULT_VERBOSITY)) +NL_V_MAKE_0 = @echo " MAKE $(@)"; +NL_V_MAKE_1 = + +NL_V_MKDIR_P = $(NL_V_MKDIR_P_$(V)) +NL_V_MKDIR_P_ = $(NL_V_MKDIR_P_$(NL_DEFAULT_VERBOSITY)) +NL_V_MKDIR_P_0 = @echo " MKDIR $(1)"; +NL_V_MKDIR_P_1 = + +NL_V_RMDIR = $(NL_V_RMDIR_$(V)) +NL_V_RMDIR_ = $(NL_V_RMDIR_$(NL_DEFAULT_VERBOSITY)) +NL_V_RMDIR_0 = @echo " RMDIR $(1)"; +NL_V_RMDIR_1 = diff --git a/third_party/nlbuild-autotools/repo/make/pre/tools.mak b/third_party/nlbuild-autotools/repo/make/pre/tools.mak new file mode 100644 index 000000000..96ae503bb --- /dev/null +++ b/third_party/nlbuild-autotools/repo/make/pre/tools.mak @@ -0,0 +1,25 @@ +# +# Copyright 2018 Nest Labs Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Description: +# This file is the generic "header" or pre make header for all +# common (i.e., non-host-specific, non-target-specific, and +# non-toolchain-specific) tools included in any makefile used in the +# build tree. +# + +include $(abs_top_nlbuild_autotools_dir)/make/host/tools.mak diff --git a/third_party/nlbuild-autotools/repo/scripts/mkskeleton b/third_party/nlbuild-autotools/repo/scripts/mkskeleton index 734904485..2a1233eda 100755 --- a/third_party/nlbuild-autotools/repo/scripts/mkskeleton +++ b/third_party/nlbuild-autotools/repo/scripts/mkskeleton @@ -1,7 +1,7 @@ #!/bin/bash # -# Copyright 2015-2016 Nest Labs Inc. All Rights Reserved. +# Copyright 2015-2018 Nest Labs Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -222,7 +222,9 @@ done populate "${DIR}" 664 configure.ac . populate "${DIR}" 775 bootstrap . +populate "${DIR}" 664 repos.conf . populate "${DIR}" 664 Makefile.am . +populate "${DIR}" 664 Makefile-bootstrap . populate "${DIR}" 664 Makefile.am doc populate "${DIR}" 664 Doxyfile.in doc populate "${DIR}" 664 Makefile.am third_party diff --git a/third_party/nlbuild-autotools/repo/tools/packages/build b/third_party/nlbuild-autotools/repo/tools/packages/build index a71c0c4c0..04755fe80 100755 --- a/third_party/nlbuild-autotools/repo/tools/packages/build +++ b/third_party/nlbuild-autotools/repo/tools/packages/build @@ -187,20 +187,20 @@ fetch_url_with_command() { shift 2 if [ -x "${executable}" ]; then - cd "${fetchdir}" - - verbose " `echo ${1} | tr '[[:lower:]]' '[[:upper:]]'` ${url}" + cd "${fetchdir}" + + verbose " `echo ${1} | tr '[[:lower:]]' '[[:upper:]]'` ${url}" - ${*} "${url}" + ${*} "${url}" - status=${?} + status=${?} - if [ ${?} -ne 0 ]; then - error "Failed to fetch ${url} with ${1}." - fi + if [ ${?} -ne 0 ]; then + error "Failed to fetch ${url} with ${1}." + fi - cd "${curdir}" - fi + cd "${curdir}" + fi return ${status} } @@ -433,8 +433,8 @@ while [ ${#} -gt 0 ]; do ;; *) - usage 1 - ;; + usage 1 + ;; esac done