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
1414CMAKE_GENERATOR? =Ninja
1515export 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
1822sudo? =sudo
1923
2024debian_codename? =bookworm
@@ -33,14 +37,29 @@ export PATH := ${HOME}/.cargo/bin:${PATH}
3337zpc_exe? =${build_dir}/applications/zpc/zpc
3438exes+ =${zpc_exe}
3539
36- zpc_cmake_options? =\
40+ # Allow overloading from env if needed
41+ BUILD_DEV_GUI? =OFF
42+ BUILD_IMAGE_PROVIDER? =OFF
43+
44+ ifeq (${BUILD_DEV_GUI}, ON)
45+ packages+ =nodejs
46+ packages+ =yarnpkg
47+ endif
48+
49+
50+ cmake_options? =\
51+ -DCMAKE_VERBOSE_MAKEFILE=ON \
52+ \
53+ -DBUILD_ZPC=ON \
54+ \
3755 -DBUILD_AOXPC=OFF \
3856 -DBUILD_CPCD=OFF \
3957 -DBUILD_DEV_GUI=OFF \
4058 -DBUILD_EMD=OFF \
59+ -DBUILD_DEV_GUI=${BUILD_DEV_GUI} \
4160 -DBUILD_EPC=OFF \
4261 -DBUILD_GMS=OFF \
43- -DBUILD_IMAGE_PROVIDER=OFF \
62+ -DBUILD_IMAGE_PROVIDER=${BUILD_IMAGE_PROVIDER} \
4463 -DBUILD_NAL=OFF \
4564 -DBUILD_OTBR=OFF \
4665 -DBUILD_POSITIONING=OFF \
@@ -50,6 +69,22 @@ zpc_cmake_options?=\
5069 -DBUILD_UPVL=OFF \
5170 -DBUILD_ZIGBEED=OFF \
5271 -DBUILD_ZIGPC=OFF
72+ # EoL
73+
74+ # Allow to bypass env detection, to support more build systems
75+ ifdef CMAKE_SYSTEM_PROCESSOR
76+ cmake_options+=-DCMAKE_SYSTEM_PROCESSOR ="${CMAKE_SYSTEM_PROCESSOR}"
77+ export CMAKE_SYSTEM_PROCESSOR
78+ else
79+ # CMAKE_SYSTEM_PROCESSOR?=$(shell uname -m)
80+ endif
81+ ifdef CARGO_TARGET_TRIPLE
82+ cmake_options+=-DCARGO_TARGET_TRIPLE ="${CARGO_TARGET_TRIPLE}"
83+ export CMAKE_TARGET_TRIPLE
84+ else
85+ # CARGO_TARGET_TRIPLE?=${CMAKE_SYSTEM_PROCESSOR}-unknown-linux-gnu
86+ endif
87+
5388
5489help : README.md
5590 @cat $<
@@ -70,41 +105,25 @@ setup/debian: ${CURDIR}/docker/target_dependencies.apt ${CURDIR}/docker/host_dep
70105
71106setup/rust :
72107 @echo " $@ : TODO: Support https://tracker.debian.org/pkg/rustup"
73- curl --insecure --proto ' =https' --tlsv1.2 -sSf ${rust_url} | bash -s -- -y --default-toolchain ${RUST_VERSION}
108+ curl --insecure --proto ' =https' --tlsv1.2 -sSf ${rust_url} \
109+ | bash -x -s -- -y --default-toolchain ${RUST_VERSION}
74110 cat $$ {HOME}/.cargo/env
75111 @echo ' $@: info: You might like to add ". $${HOME}/.cargo/env" to "$${HOME}/.bashrc"'
76112 -which rustc
77113 rustc --version
78114 cargo --version
115+ rustc --print target-list
116+ @echo " $@ : TODO: https://github.com/kornelski/cargo-deb/issues/159"
117+ cargo install --version 1.44.0 --locked cargo-deb
79118 @echo " $@ : TODO: Support stable version from https://releases.rs/ or older"
80119
81120setup/python :
82121 python3 --version
83- @echo " $@ : TODO: https://github.com/wbond/pybars3/issues/82 "
122+ @echo " $@ : TODO: https://bugs.debian.org/1094297 "
84123 pip3 --version || echo " warning: Please install pip"
85124 pip3 install " pybars3" \
86125 || pip3 install --break-system-packages " pybars3"
87126
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-
108127setup/debian/bookworm : setup/debian setup/rust setup/python
109128 date -u
110129
@@ -126,8 +145,8 @@ git/prepare: git/modules/prepare git/lfs/prepare
126145configure : ${build_dir}/CMakeCache.txt
127146 file -E $<
128147
129- ${build_dir}/CMakeCache.txt : CMakeLists.txt ${build_pre_list}
130- cmake -B ${build_dir}
148+ ${build_dir}/CMakeCache.txt : CMakeLists.txt
149+ cmake -B ${build_dir} ${cmake_options}
131150
132151build : ${build_dir}/CMakeCache.txt
133152 cmake --build ${<D} \
@@ -149,6 +168,11 @@ test: ${build_dir}
149168
150169check : test
151170
171+ dist : ${build_dir}
172+ cmake --build $< --target package
173+ install -d $< /$@
174+ cp -av ${<} /* .deb $< /$@
175+
152176distclean :
153177 rm -rf ${build_dir}
154178
@@ -157,66 +181,7 @@ prepare: git/prepare
157181all/default : configure build test
158182 @date -u
159183
160- zpc/configure : CMakeLists.txt
161- cmake -B ${build_dir} ${zpc_cmake_options}
162-
163- zpc/build : zpc/configure build
164- @date -u
165-
184+ # TODO
166185zpc/test : ${build_dir}/applications/zpc/components/zwave_command_classes/test/
167186 ctest --test-dir ${<}
168187
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