diff --git a/.gn b/.gn index 61e4b7946..3b480b54d 100644 --- a/.gn +++ b/.gn @@ -1,3 +1,3 @@ -buildconfig = "//third_party/build_gn/BUILDCONFIG.gn" +buildconfig = "//etc/gn/BUILDCONFIG.gn" check_system_includes = true diff --git a/etc/gn/BUILDCONFIG.gn b/etc/gn/BUILDCONFIG.gn new file mode 100644 index 000000000..9e4a5d441 --- /dev/null +++ b/etc/gn/BUILDCONFIG.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2025, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE] +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +if (target_os == "") { + target_os = host_os +} +if (target_cpu == "") { + target_cpu = host_cpu +} +if (current_cpu == "") { + current_cpu = target_cpu +} +if (current_os == "") { + current_os = target_os +} + +set_default_toolchain("//etc/gn/toolchain:gcc") diff --git a/third_party/build_gn/toolchain/BUILD.gn b/etc/gn/toolchain/BUILD.gn similarity index 61% rename from third_party/build_gn/toolchain/BUILD.gn rename to etc/gn/toolchain/BUILD.gn index 64df6a8b6..06939efd9 100644 --- a/third_party/build_gn/toolchain/BUILD.gn +++ b/etc/gn/toolchain/BUILD.gn @@ -1,6 +1,30 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. +# Copyright (c) 2025, The OpenThread Authors. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of the copyright holder nor the +# names of its contributors may be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE] +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + toolchain("gcc") { tool("cc") { depfile = "{{output}}.d" diff --git a/third_party/build_gn/BUILDCONFIG.gn b/third_party/build_gn/BUILDCONFIG.gn deleted file mode 100644 index f9202d9f5..000000000 --- a/third_party/build_gn/BUILDCONFIG.gn +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -if (target_os == "") { - target_os = host_os -} -if (target_cpu == "") { - target_cpu = host_cpu -} -if (current_cpu == "") { - current_cpu = target_cpu -} -if (current_os == "") { - current_os = target_os -} - -set_default_toolchain("//third_party/build_gn/toolchain:gcc") diff --git a/third_party/build_gn/README.md b/third_party/build_gn/README.md deleted file mode 100644 index 0430d1199..000000000 --- a/third_party/build_gn/README.md +++ /dev/null @@ -1,22 +0,0 @@ -# build_gn - -## URL - -https://gn.googlesource.com/gn/+/refs/heads/master/examples/simple_build/build - -## License - -BSD 3-Clause - -## License File - -[LICENSE](https://gn.googlesource.com/gn/+/refs/heads/master/LICENSE) - -## Description - -gn is metabuild system that generates ninja files for further compilation - -gn tool requires paths to all the toolchains to be used for compilation, for -example compiler, linker etc. The toolchains in toolchain/BUILD.gn are from the -examples repository for gn. BUILDCONFIG.gn is also trimmed down version from -examples/simple_build/build/