Skip to content

Commit dd13533

Browse files
committed
SWPROT-8953: zpc: build: Adjust helper for uic-zpc only
Make dev-gui optional Build package Signed-off-by: Philippe Coval <philippe.coval@silabs.com>
1 parent a252845 commit dd13533

File tree

1 file changed

+50
-87
lines changed

1 file changed

+50
-87
lines changed

helper.mk

Lines changed: 50 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# ex: set tabstop=4 noexpandtab:
44
# -*- coding: utf-8 -*
55

6-
default: help zpc/default
6+
default: help configure build test dist
77
@echo "$@: TODO: Support more than $^ by default"
88
@date -u
99

@@ -14,7 +14,11 @@ project?=unifysdk
1414
CMAKE_GENERATOR?=Ninja
1515
export CMAKE_GENERATOR
1616

17-
build_dir?=build
17+
# https://cmake.org/cmake/help/latest/envvar/VERBOSE.html#envvar:VERBOSE
18+
VERBOSE=1
19+
export VERBOSE
20+
21+
build_dir?=${CURDIR}/build
1822
sudo?=sudo
1923

2024
debian_codename?=bookworm
@@ -33,14 +37,28 @@ export PATH := ${HOME}/.cargo/bin:${PATH}
3337
zpc_exe?=${build_dir}/applications/zpc/zpc
3438
exes+=${zpc_exe}
3539

36-
zpc_cmake_options?=\
40+
BUILD_DEV_GUI?=ON
41+
42+
ifeq (${BUILD_DEV_GUI}, ON)
43+
packages+=nodejs
44+
# packages+=npm
45+
packages+=yarnpkg
46+
endif
47+
48+
49+
cmake_options?=\
50+
-DCMAKE_VERBOSE_MAKEFILE=ON \
51+
\
52+
-DBUILD_ZPC=ON \
53+
\
3754
-DBUILD_AOXPC=OFF \
3855
-DBUILD_CPCD=OFF \
3956
-DBUILD_DEV_GUI=OFF \
4057
-DBUILD_EMD=OFF \
58+
-DBUILD_DEV_GUI=${BUILD_DEV_GUI} \
4159
-DBUILD_EPC=OFF \
4260
-DBUILD_GMS=OFF \
43-
-DBUILD_IMAGE_PROVIDER=OFF \
61+
-DBUILD_IMAGE_PROVIDER=ON \
4462
-DBUILD_NAL=OFF \
4563
-DBUILD_OTBR=OFF \
4664
-DBUILD_POSITIONING=OFF \
@@ -50,6 +68,22 @@ zpc_cmake_options?=\
5068
-DBUILD_UPVL=OFF \
5169
-DBUILD_ZIGBEED=OFF \
5270
-DBUILD_ZIGPC=OFF
71+
#EoL
72+
73+
# Allow to bypass env detection, to support more build systems
74+
ifdef CMAKE_SYSTEM_PROCESSOR
75+
cmake_options+=-DCMAKE_SYSTEM_PROCESSOR="${CMAKE_SYSTEM_PROCESSOR}"
76+
export CMAKE_SYSTEM_PROCESSOR
77+
else
78+
# CMAKE_SYSTEM_PROCESSOR?=$(shell uname -m)
79+
endif
80+
ifdef CARGO_TARGET_TRIPLE
81+
cmake_options+=-DCARGO_TARGET_TRIPLE="${CARGO_TARGET_TRIPLE}"
82+
export CMAKE_TARGET_TRIPLE
83+
else
84+
# CARGO_TARGET_TRIPLE?=${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu
85+
endif
86+
5387

5488
help: README.md
5589
@cat $<
@@ -76,35 +110,18 @@ setup/rust:
76110
-which rustc
77111
rustc --version
78112
cargo --version
113+
rustc --print target-list
114+
@echo "$@: TODO: https://github.com/kornelski/cargo-deb/issues/159"
115+
cargo install --version 1.44.0 --locked cargo-deb
79116
@echo "$@: TODO: Support stable version from https://releases.rs/ or older"
80117

81118
setup/python:
82119
python3 --version
83-
@echo "$@: TODO: https://github.com/wbond/pybars3/issues/82"
120+
@echo "$@: TODO: https://bugs.debian.org/1094297"
84121
pip3 --version || echo "warning: Please install pip"
85122
pip3 install "pybars3" \
86123
|| pip3 install --break-system-packages "pybars3"
87124

88-
cmake_url?=https://github.com/Kitware/CMake/releases/download/v3.21.6/cmake-3.21.6-Linux-x86_64.sh
89-
cmake_filename?=$(shell basename -- "${cmake_url}")
90-
cmake_sha256?=d460a33c42f248388a8f2249659ad2f5eab6854bebaf4f57c1df49ded404e593
91-
92-
setup/cmake:
93-
@echo "$@: TODO: remove for debian-12+"
94-
curl -O -L ${cmake_url}
95-
sha256sum ${cmake_filename} \
96-
| grep "${cmake_sha256}"
97-
${SHELL} "${cmake_filename}" \
98-
--prefix=/usr/local \
99-
--skip-license
100-
rm -v "${cmake_filename}"
101-
cmake --version
102-
103-
setup-cmake: setup/cmake
104-
105-
setup/debian/bullseye: setup/debian setup/rust setup/python setup/cmake
106-
date -u
107-
108125
setup/debian/bookworm: setup/debian setup/rust setup/python
109126
date -u
110127

@@ -126,8 +143,8 @@ git/prepare: git/modules/prepare git/lfs/prepare
126143
configure: ${build_dir}/CMakeCache.txt
127144
file -E $<
128145

129-
${build_dir}/CMakeCache.txt: CMakeLists.txt ${build_pre_list}
130-
cmake -B ${build_dir}
146+
${build_dir}/CMakeCache.txt: CMakeLists.txt
147+
cmake -B ${build_dir} ${cmake_options}
131148

132149
build: ${build_dir}/CMakeCache.txt
133150
cmake --build ${<D} \
@@ -149,6 +166,11 @@ test: ${build_dir}
149166

150167
check: test
151168

169+
dist: ${build_dir}
170+
cmake --build $< --target package
171+
install -d $</$@
172+
cp -av ${<}/*.deb $</$@
173+
152174
distclean:
153175
rm -rf ${build_dir}
154176

@@ -157,66 +179,7 @@ prepare: git/prepare
157179
all/default: configure build test
158180
@date -u
159181

160-
zpc/configure: CMakeLists.txt
161-
cmake -B ${build_dir} ${zpc_cmake_options}
162-
163-
zpc/build: zpc/configure build
164-
@date -u
165-
182+
# TODO
166183
zpc/test: ${build_dir}/applications/zpc/components/zwave_command_classes/test/
167184
ctest --test-dir ${<}
168185

169-
zpc/default: zpc/configure zpc/build zpc/test
170-
@date -u
171-
172-
### @rootfs is faster than docker for env check
173-
174-
rootfs_dir?=/var/tmp/var/lib/machines/${project}
175-
176-
rootfs_shell?=${sudo} systemd-nspawn \
177-
--machine="${project}" \
178-
--directory="${rootfs_dir}"
179-
${rootfs_dir}:
180-
@mkdir -pv ${@D}
181-
time ${sudo} debootstrap --include="systemd,dbus" "${debian_codename}" "${rootfs_dir}"
182-
@${sudo} chmod -v u+rX "${rootfs_dir}"
183-
184-
clean/rootfs:
185-
-${sudo} mv -fv -- "${rootfs_dir}" "${rootfs_dir}._$(shell date -u +%s).bak"
186-
187-
rootfs/%: ${rootfs_dir}
188-
${sudo} file -E -- "${rootfs_dir}" \
189-
|| ${SELF} "${rootfs_dir}"
190-
${rootfs_shell} apt-get update
191-
${rootfs_shell} apt-get install -- make sudo
192-
${rootfs_shell} \
193-
--bind="${CURDIR}:${CURDIR}" \
194-
${MAKE} \
195-
--directory="${CURDIR}" \
196-
--file="${CURDIR}/helper.mk" \
197-
HOME="${HOME}" \
198-
USER="${USER}" \
199-
-- "${@F}"
200-
201-
check/rootfs: prepare rootfs/check
202-
echo "# TODO only touched files"
203-
@echo "# ${project}: log: $@: done: $^"
204-
205-
test/rootfs: clean/rootfs rootfs/setup rootfs/distclean check/rootfs
206-
@echo "# ${project}: log: $@: done: $^"
207-
208-
### @Docker: is only for validation no need to rely on it
209-
210-
prepare/docker: Dockerfile prepare
211-
time docker build \
212-
--tag="${project}" \
213-
--file="$<" .
214-
@echo "# ${project}: log: $@: done: $^"
215-
216-
docker_workdir?=/usr/local/opt/${project}
217-
218-
docker/%: Dockerfile
219-
time docker run "${project}:latest" -C "${docker_workdir}" "${@F}"
220-
221-
test/docker: distclean prepare/docker docker/help docker/test
222-
@echo "# ${project}: log: $@: done: $^"

0 commit comments

Comments
 (0)