mirror of
https://github.com/espressif/openthread.git
synced 2026-08-03 01:17:46 +00:00
[build] make OpenThread POSIX deb packages (#4592)
This commit enables building OpenThread deb packages: * openthread-simulation: simulation of OpenThread * openthread-daemon: daemon of OpenThread Host * openthread-standalone: standalone binaries of OpenThread Host
This commit is contained in:
@@ -49,6 +49,10 @@ stages:
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- env: BUILD_TARGET="package-check" VERBOSE=1
|
||||
os: linux
|
||||
compiler: gcc
|
||||
script: script/test package
|
||||
- env: BUILD_TARGET="v1.2" VERBOSE=1 VIRTUAL_TIME=1 THREAD_VERSION=1.2
|
||||
os: linux
|
||||
compiler: gcc
|
||||
|
||||
@@ -59,3 +59,6 @@ target_link_libraries(ot-cli-mtd
|
||||
${OT_PLATFORM_LIB}
|
||||
mbedcrypto
|
||||
)
|
||||
|
||||
install(TARGETS ot-cli-ftd ot-cli-mtd
|
||||
DESTINATION bin)
|
||||
|
||||
@@ -71,3 +71,6 @@ target_link_libraries(ot-rcp
|
||||
openthread-radio
|
||||
${OT_PLATFORM_LIB}
|
||||
)
|
||||
|
||||
install(TARGETS ot-rcp ot-ncp-ftd ot-ncp-mtd
|
||||
DESTINATION bin)
|
||||
|
||||
@@ -81,3 +81,9 @@ target_include_directories(openthread-posix PRIVATE
|
||||
${PROJECT_SOURCE_DIR}/examples/platforms
|
||||
${PROJECT_SOURCE_DIR}/src/core
|
||||
)
|
||||
|
||||
set(CPACK_PACKAGE_NAME "openthread-simulation")
|
||||
set(CPACK_GENERATOR "DEB")
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "OpenThread Authors <[email protected]")
|
||||
set(CPACK_PACKAGE_CONTACT "OpenThread Authors <[email protected]")
|
||||
include(CPack)
|
||||
|
||||
+38
-13
@@ -33,8 +33,10 @@
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
readonly SYSTEM_TRIPLET="$(third_party/nlbuild-autotools/repo/third_party/autoconf/config.guess | sed -e 's/[[:digit:].]*$//g')"
|
||||
export top_builddir="build/${SYSTEM_TRIPLET}"
|
||||
readonly OT_BUILD_JOBS=$(getconf _NPROCESSORS_ONLN)
|
||||
readonly OT_SYSTEM_TRIPLET="$(third_party/nlbuild-autotools/repo/third_party/autoconf/config.guess | sed -e 's/[[:digit:].]*$//g')"
|
||||
readonly OT_BUILDDIR="$(pwd)/build"
|
||||
readonly OT_SRCDIR="$(pwd)"
|
||||
|
||||
do_build() {
|
||||
./bootstrap
|
||||
@@ -61,14 +63,11 @@ do_build() {
|
||||
}
|
||||
|
||||
do_clean() {
|
||||
rm -rfv "build/${SYSTEM_TRIPLET}" "build/posix/${SYSTEM_TRIPLET}"
|
||||
# Extra 1.1 clean for 1.2 env
|
||||
if [ "${THREAD_VERSION}" = "1.2" ]; then
|
||||
rm -rfv "build/${SYSTEM_TRIPLET}-1.1" "build/posix/${SYSTEM_TRIPLET}-1.1"
|
||||
fi
|
||||
rm -rfv "${OT_BUILDDIR}"
|
||||
}
|
||||
|
||||
do_cert() {
|
||||
export top_builddir="${OT_BUILDDIR}/${OT_SYSTEM_TRIPLET}"
|
||||
[[ ! -d tmp ]] || rm -rvf tmp
|
||||
PYTHONUNBUFFERED=1 "$1"
|
||||
}
|
||||
@@ -113,6 +112,29 @@ EXAMPLES:
|
||||
exit $1
|
||||
}
|
||||
|
||||
do_package() {
|
||||
local builddir="${OT_BUILDDIR}/cmake/openthread-sim"
|
||||
(mkdir -p "${builddir}" \
|
||||
&& cd "${builddir}" \
|
||||
&& cmake "${OT_SRCDIR}" -DOT_PLATFORM="posix" \
|
||||
&& make -j${OT_BUILD_JOBS} package \
|
||||
&& ls "${builddir}"/openthread-simulation-*.deb)
|
||||
|
||||
builddir="${OT_BUILDDIR}/cmake/openthread-host"
|
||||
(mkdir -p "${builddir}" \
|
||||
&& cd "${builddir}" \
|
||||
&& cmake "${OT_SRCDIR}" -DOT_PLATFORM="posix-host" \
|
||||
&& make -j${OT_BUILD_JOBS} package \
|
||||
&& ls "${builddir}"/openthread-standalone-*.deb)
|
||||
|
||||
builddir="${OT_BUILDDIR}/cmake/openthread-daemon"
|
||||
(mkdir -p "${builddir}" \
|
||||
&& cd "${builddir}" \
|
||||
&& cmake "${OT_SRCDIR}" -DOT_PLATFORM="posix-host" -DOT_DAEMON=1 -DOT_PLATFORM_NETIF=1 -DOT_PLATFORM_UDP=1 \
|
||||
&& make -j${OT_BUILD_JOBS} package \
|
||||
&& ls "${builddir}"/openthread-daemon-*.deb)
|
||||
}
|
||||
|
||||
main()
|
||||
{
|
||||
export NODE_TYPE="${NODE_TYPE:-sim}"
|
||||
@@ -124,14 +146,14 @@ main()
|
||||
fi
|
||||
|
||||
if [[ "${NODE_MODE}" = 'transceiver' ]] ; then
|
||||
export RADIO_DEVICE="build/${SYSTEM_TRIPLET}/examples/apps/ncp/ot-rcp"
|
||||
export OT_CLI_PATH="build/posix/${SYSTEM_TRIPLET}/src/posix/ot-cli"
|
||||
export OT_NCP_PATH="build/posix/${SYSTEM_TRIPLET}/src/posix/ot-ncp"
|
||||
export RADIO_DEVICE="${OT_BUILDDIR}/${OT_SYSTEM_TRIPLET}/examples/apps/ncp/ot-rcp"
|
||||
export OT_CLI_PATH="${OT_BUILDDIR}/posix/${OT_SYSTEM_TRIPLET}/src/posix/ot-cli"
|
||||
export OT_NCP_PATH="${OT_BUILDDIR}/posix/${OT_SYSTEM_TRIPLET}/src/posix/ot-ncp"
|
||||
|
||||
if [ "${THREAD_VERSION}" = "1.2" ]; then
|
||||
export RADIO_DEVICE_1_1="build/${SYSTEM_TRIPLET}-1.1/examples/apps/ncp/ot-rcp"
|
||||
export OT_CLI_PATH_1_1="build/posix/${SYSTEM_TRIPLET}-1.1/src/posix/ot-cli"
|
||||
export OT_NCP_PATH_1_1="build/posix/${SYSTEM_TRIPLET}-1.1/src/posix/ot-ncp"
|
||||
export RADIO_DEVICE_1_1="${OT_BUILDDIR}/${SYSTEM_TRIPLET}-1.1/examples/apps/ncp/ot-rcp"
|
||||
export OT_CLI_PATH_1_1="${OT_BUILDDIR}/posix/${SYSTEM_TRIPLET}-1.1/src/posix/ot-cli"
|
||||
export OT_NCP_PATH_1_1="${OT_BUILDDIR}/posix/${SYSTEM_TRIPLET}-1.1/src/posix/ot-ncp"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -159,6 +181,9 @@ main()
|
||||
help)
|
||||
print_usage
|
||||
;;
|
||||
package)
|
||||
do_package
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
@@ -35,82 +35,12 @@ set(COMMON_INCLUDES
|
||||
)
|
||||
|
||||
if(OT_DAEMON)
|
||||
add_executable(ot-daemon
|
||||
main.c
|
||||
)
|
||||
|
||||
target_include_directories(ot-daemon PRIVATE ${COMMON_INCLUDES})
|
||||
|
||||
target_compile_definitions(ot-daemon PRIVATE
|
||||
OPENTHREAD_POSIX_APP_TYPE=2
|
||||
)
|
||||
|
||||
target_compile_options(ot-daemon PRIVATE
|
||||
${OT_CFLAGS}
|
||||
)
|
||||
|
||||
target_link_libraries(ot-daemon PRIVATE
|
||||
openthread-cli-ftd
|
||||
${OT_PLATFORM_LIB}
|
||||
openthread-ftd
|
||||
${OT_PLATFORM_LIB}
|
||||
openthread-ncp-ftd
|
||||
mbedcrypto
|
||||
)
|
||||
|
||||
add_executable(ot-ctl
|
||||
client.cpp
|
||||
)
|
||||
|
||||
target_compile_options(ot-ctl PRIVATE
|
||||
${OT_CFLAGS}
|
||||
)
|
||||
|
||||
target_include_directories(ot-ctl PRIVATE ${COMMON_INCLUDES})
|
||||
include(daemon.cmake)
|
||||
else()
|
||||
add_executable(ot-cli
|
||||
main.c
|
||||
)
|
||||
|
||||
target_include_directories(ot-cli PRIVATE ${COMMON_INCLUDES})
|
||||
|
||||
target_compile_definitions(ot-cli PRIVATE
|
||||
OPENTHREAD_POSIX_APP_TYPE=2
|
||||
)
|
||||
|
||||
target_compile_options(ot-cli PRIVATE
|
||||
${OT_CFLAGS}
|
||||
)
|
||||
|
||||
target_link_libraries(ot-cli
|
||||
openthread-cli-ftd
|
||||
${OT_PLATFORM_LIB}
|
||||
openthread-ftd
|
||||
${OT_PLATFORM_LIB}
|
||||
mbedcrypto
|
||||
openthread-ncp-ftd
|
||||
)
|
||||
|
||||
add_executable(ot-ncp
|
||||
main.c
|
||||
)
|
||||
|
||||
target_include_directories(ot-ncp PRIVATE ${COMMON_INCLUDES})
|
||||
|
||||
target_compile_definitions(ot-ncp PRIVATE
|
||||
OPENTHREAD_POSIX_APP_TYPE=1
|
||||
)
|
||||
|
||||
target_compile_options(ot-ncp PRIVATE
|
||||
${OT_CFLAGS}
|
||||
)
|
||||
|
||||
target_link_libraries(ot-ncp
|
||||
openthread-ncp-ftd
|
||||
${OT_PLATFORM_LIB}
|
||||
openthread-ftd
|
||||
${OT_PLATFORM_LIB}
|
||||
mbedcrypto
|
||||
openthread-ncp-ftd
|
||||
)
|
||||
include(standalone.cmake)
|
||||
endif()
|
||||
|
||||
set(CPACK_GENERATOR "DEB")
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "OpenThread Authors <[email protected]")
|
||||
set(CPACK_PACKAGE_CONTACT "OpenThread Authors <[email protected]")
|
||||
include(CPack)
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#
|
||||
# Copyright (c) 2020, 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.
|
||||
#
|
||||
|
||||
add_executable(ot-daemon
|
||||
main.c
|
||||
)
|
||||
|
||||
target_include_directories(ot-daemon PRIVATE ${COMMON_INCLUDES})
|
||||
|
||||
target_compile_definitions(ot-daemon PRIVATE
|
||||
OPENTHREAD_POSIX_APP_TYPE=2
|
||||
)
|
||||
|
||||
target_compile_options(ot-daemon PRIVATE
|
||||
${OT_CFLAGS}
|
||||
)
|
||||
|
||||
target_link_libraries(ot-daemon PRIVATE
|
||||
openthread-cli-ftd
|
||||
${OT_PLATFORM_LIB}
|
||||
openthread-ftd
|
||||
${OT_PLATFORM_LIB}
|
||||
openthread-ncp-ftd
|
||||
mbedcrypto
|
||||
)
|
||||
|
||||
add_executable(ot-ctl
|
||||
client.cpp
|
||||
)
|
||||
|
||||
target_compile_options(ot-ctl PRIVATE
|
||||
${OT_CFLAGS}
|
||||
)
|
||||
|
||||
target_include_directories(ot-ctl PRIVATE ${COMMON_INCLUDES})
|
||||
|
||||
install(TARGETS ot-daemon
|
||||
DESTINATION sbin)
|
||||
install(TARGETS ot-ctl
|
||||
DESTINATION bin)
|
||||
|
||||
set(CPACK_PACKAGE_NAME "openthread-daemon")
|
||||
@@ -62,7 +62,11 @@ target_link_libraries(openthread-posix PUBLIC
|
||||
util
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-posix PUBLIC ${OT_PLATFORM_DEFINES})
|
||||
target_compile_definitions(openthread-posix PUBLIC
|
||||
${OT_PRIVATE_DEFINES}
|
||||
${OT_PUBLIC_DEFINES}
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_options(openthread-posix PRIVATE
|
||||
${OT_CFLAGS}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# Copyright (c) 2020, 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.
|
||||
#
|
||||
|
||||
add_executable(ot-cli
|
||||
main.c
|
||||
)
|
||||
|
||||
target_include_directories(ot-cli PRIVATE ${COMMON_INCLUDES})
|
||||
|
||||
target_compile_definitions(ot-cli PRIVATE
|
||||
OPENTHREAD_POSIX_APP_TYPE=2
|
||||
)
|
||||
|
||||
target_compile_options(ot-cli PRIVATE
|
||||
${OT_CFLAGS}
|
||||
)
|
||||
|
||||
target_link_libraries(ot-cli
|
||||
openthread-cli-ftd
|
||||
${OT_PLATFORM_LIB}
|
||||
openthread-ftd
|
||||
${OT_PLATFORM_LIB}
|
||||
mbedcrypto
|
||||
openthread-ncp-ftd
|
||||
)
|
||||
|
||||
add_executable(ot-ncp
|
||||
main.c
|
||||
)
|
||||
|
||||
target_include_directories(ot-ncp PRIVATE ${COMMON_INCLUDES})
|
||||
|
||||
target_compile_definitions(ot-ncp PRIVATE
|
||||
OPENTHREAD_POSIX_APP_TYPE=1
|
||||
)
|
||||
|
||||
target_compile_options(ot-ncp PRIVATE
|
||||
${OT_CFLAGS}
|
||||
)
|
||||
|
||||
target_link_libraries(ot-ncp
|
||||
openthread-ncp-ftd
|
||||
${OT_PLATFORM_LIB}
|
||||
openthread-ftd
|
||||
${OT_PLATFORM_LIB}
|
||||
mbedcrypto
|
||||
openthread-ncp-ftd
|
||||
)
|
||||
|
||||
install(TARGETS ot-cli ot-ncp
|
||||
DESTINATION bin)
|
||||
|
||||
set(CPACK_PACKAGE_NAME "openthread-standalone")
|
||||
Reference in New Issue
Block a user