-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add configure script to set up a light-weight build environment (#26154)
* Add configure script to set up a light-weight build environment ... and optionally configure a GN build from environment variables and command line options. This simplifies building a CHIP app as a component within an existing buildroot style build system. Make the custom_toolchain build arg easier to use by interpreting relative paths as relative to ${build_root}/toolchain. Also move the declare_args statements for the 'custom' toolchain into a gni file so they can be discovered correctly. * Factor out python code into configure.utils.py Ensure //build_overrides/pigweed_environment.gni exists. Install wheel in the venv before installing dependencies. * Add chip-build-minimal docker image and minimal-build workflow The chip-build-minimal contains only the minimal build tools for compiling a CHIP app on Linux (c++ toolchain, python3, gn, ninja) and minimal library dependencies (openssl, glib). * Nits from code review * Update with latest zap version from master
- Loading branch information
1 parent
ba564c1
commit f895998
Showing
15 changed files
with
581 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Copyright (c) 2023 Project CHIP Authors | ||
# | ||
# 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. | ||
|
||
name: Minimal Build (Linux / configure) | ||
|
||
on: | ||
push: | ||
pull_request: | ||
merge_group: | ||
|
||
concurrency: | ||
group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
minimal: | ||
name: Linux / configure build of all-clusters-app | ||
timeout-minutes: 60 | ||
|
||
if: github.actor != 'restyled-io[bot]' | ||
runs-on: ubuntu-latest | ||
|
||
container: | ||
image: connectedhomeip/chip-build-minimal:0.7.2 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Checkout submodules | ||
run: scripts/checkout_submodules.py --allow-changing-global-git-config --shallow --platform linux | ||
- name: Configure and build All Clusters App | ||
timeout-minutes: 10 | ||
run: | | ||
CC=gcc CXX=g++ scripts/configure --project=examples/all-clusters-app/linux && ./ninja-build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright (c) 2023 Project CHIP Authors | ||
# | ||
# 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. | ||
|
||
declare_args() { | ||
# C compiler to use for target build. | ||
# Only relevant with custom_toolchain = "custom". | ||
target_cc = "" | ||
|
||
# C++ compiler to use for target build. | ||
# Only relevant with custom_toolchain = "custom". | ||
target_cxx = "" | ||
|
||
# Archive tool to use for target build. | ||
# Only relevant with custom_toolchain = "custom". | ||
target_ar = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This minimal build image is intentionally not based on chip-build | ||
FROM ubuntu:focal | ||
|
||
# ARG NINJA_VERSION=v1.11.1 | ||
ARG GN_HASH=5a004f9427a050c6c393c07ddb85cba8ff3849fa | ||
|
||
RUN set -x \ | ||
&& apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
build-essential ca-certificates git pkg-config python3-venv ninja-build \ | ||
&& git config --global advice.detachedHead false | ||
|
||
# RUN set -x && cd /var/tmp \ | ||
# && git clone --branch "$NINJA_VERSION" https://github.com/ninja-build/ninja.git \ | ||
# && ( cd ninja && ./configure.py --bootstrap && install -m 0755 ninja /usr/local/bin/ ) \ | ||
# && rm -rf ninja | ||
|
||
RUN set -x && cd /var/tmp \ | ||
&& git clone https://gn.googlesource.com/gn \ | ||
&& ( cd gn && git checkout "$GN_HASH" && CXX=g++ build/gen.py && ninja -C out && install -m 0755 out/gn /usr/local/bin/ ) \ | ||
&& rm -rf gn | ||
|
||
# CHIP build dependencies | ||
RUN set -x \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ | ||
libssl-dev libglib2.0-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../run.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../chip-build/version |
Oops, something went wrong.