From 17204f488d255972cd6906ea24aeecb63853e62a Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Mon, 14 Apr 2025 14:51:26 +0100 Subject: [PATCH] RIOT: Move examples to new directory structures --- Makefile.am | 8 ++++---- examples/riot/Makefile | 16 ++++++++++------ examples/riot/examples_libcoap_client/Kconfig | 4 ++-- examples/riot/examples_libcoap_client/Makefile | 4 ++-- .../{client-coap.c => client_coap.c} | 4 ++-- .../{client-coap.h => client_coap.h} | 0 examples/riot/examples_libcoap_server/Kconfig | 4 ++-- examples/riot/examples_libcoap_server/Makefile | 4 ++-- .../{server-coap.c => server_coap.c} | 4 ++-- .../{server-coap.h => server_coap.h} | 2 +- examples/riot/pkg_libcoap/Makefile | 2 +- 11 files changed, 28 insertions(+), 24 deletions(-) rename examples/riot/examples_libcoap_client/{client-coap.c => client_coap.c} (99%) rename examples/riot/examples_libcoap_client/{client-coap.h => client_coap.h} (100%) rename examples/riot/examples_libcoap_server/{server-coap.c => server_coap.c} (99%) rename examples/riot/examples_libcoap_server/{server-coap.h => server_coap.h} (91%) diff --git a/Makefile.am b/Makefile.am index 5df6653c..baaaf47e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -63,8 +63,8 @@ EXTRA_DIST = \ examples/lwip/config/coap_config.h \ examples/lwip/config/lwipopts.h \ examples/lwip/config/lwippools.h \ - examples/riot/examples_libcoap_client/client-coap.c \ - examples/riot/examples_libcoap_client/client-coap.h \ + examples/riot/examples_libcoap_client/client_coap.c \ + examples/riot/examples_libcoap_client/client_coap.h \ examples/riot/examples_libcoap_client/Kconfig \ examples/riot/examples_libcoap_client/main.c \ examples/riot/examples_libcoap_client/Makefile \ @@ -74,8 +74,8 @@ EXTRA_DIST = \ examples/riot/examples_libcoap_server/Makefile \ examples/riot/examples_libcoap_server/Makefile.ci \ examples/riot/examples_libcoap_server/README.md \ - examples/riot/examples_libcoap_server/server-coap.c \ - examples/riot/examples_libcoap_server/server-coap.h \ + examples/riot/examples_libcoap_server/server_coap.c \ + examples/riot/examples_libcoap_server/server_coap.h \ examples/riot/examples_libcoap_server/Kconfig \ examples/riot/Makefile \ examples/riot/pkg_libcoap/Kconfig \ diff --git a/examples/riot/Makefile b/examples/riot/Makefile index b5b0d1f7..5d82ef65 100644 --- a/examples/riot/Makefile +++ b/examples/riot/Makefile @@ -44,20 +44,24 @@ pkg: if [ "$${HAVE_KCONFIG}" = 0 ] ; then \ sed -i '/rsource "flashdb\/Kconfig"/irsource "libcoap\/Kconfig"' RIOT/pkg/Kconfig ; \ fi + @HAVE_EXAMPLES=`grep libcoap_client RIOT/examples/README.md | wc -l` ; \ + if [ "$${HAVE_EXAMPLES}" = 0 ] ; then \ + sed -i '/nanocoap_server/a| [libcoap_client](./networking/libcoap/libcoap_client/README.md) | This example demonstrates the usage of the `libcoap` module for providing a CoAP client. |\n| [libcoap_server](./networking/libcoap/libcoap_server/README.md) | This example demonstrates the usage of the `libcoap` module for providing a CoAP server. |\n' RIOT/examples/README.md ; \ + fi examples: - rm -rf RIOT/examples/libcoap-client && mkdir RIOT/examples/libcoap-client - cd examples_libcoap_client && cp -r * ../RIOT/examples/libcoap-client - rm -rf RIOT/examples/libcoap-server && mkdir RIOT/examples/libcoap-server - cd examples_libcoap_server && cp -r * ../RIOT/examples/libcoap-server + rm -rf RIOT/examples/networking/libcoap/libcoap_client && mkdir -p RIOT/examples/networking/libcoap/libcoap_client + cd examples_libcoap_client && cp -r * ../RIOT/examples/networking/libcoap/libcoap_client + rm -rf RIOT/examples/networking/libcoap/libcoap_server && mkdir -p RIOT/examples/networking/libcoap/libcoap_server + cd examples_libcoap_server && cp -r * ../RIOT/examples/networking/libcoap/libcoap_server rm -rf RIOT/tests/pkg/libcoap && mkdir -p RIOT/tests/pkg/libcoap cd tests_pkg_libcoap && cp -r * ../RIOT/tests/pkg/libcoap client: RIOT pkg examples - $(MAKE) -C RIOT/examples/libcoap-client/ RIOT_CI_BUILD=1 + $(MAKE) -C RIOT/examples/networking/libcoap/libcoap_client/ RIOT_CI_BUILD=1 server: RIOT pkg examples - $(MAKE) -C RIOT/examples/libcoap-server/ RIOT_CI_BUILD=1 + $(MAKE) -C RIOT/examples/networking/libcoap/libcoap_server/ RIOT_CI_BUILD=1 tests: RIOT pkg examples $(MAKE) -C RIOT/tests/pkg/libcoap/ RIOT_CI_BUILD=1 diff --git a/examples/riot/examples_libcoap_client/Kconfig b/examples/riot/examples_libcoap_client/Kconfig index 2d9caeb7..1f873507 100644 --- a/examples/riot/examples_libcoap_client/Kconfig +++ b/examples/riot/examples_libcoap_client/Kconfig @@ -2,7 +2,7 @@ # General Public License v2.1. See the file LICENSE in the top level # directory for more details. # -menu "libcoap-client" +menu "libcoap_client" depends on USEPKG_LIBCOAP config LIBCOAP_CLIENT_URI @@ -17,4 +17,4 @@ config LIBCOAP_USE_PSK_ID default "user_abc" depends on USEMODULE_TINYDTLS -endmenu # libcoap-client +endmenu # libcoap_client diff --git a/examples/riot/examples_libcoap_client/Makefile b/examples/riot/examples_libcoap_client/Makefile index 8f989f56..5a6b0a4e 100644 --- a/examples/riot/examples_libcoap_client/Makefile +++ b/examples/riot/examples_libcoap_client/Makefile @@ -1,11 +1,11 @@ # name of your application -APPLICATION = libcoap-client +APPLICATION = libcoap_client # If no BOARD is found in the environment, use this default: BOARD ?= native # This has to be the absolute path to the RIOT base directory: -RIOTBASE ?= $(CURDIR)/../.. +RIOTBASE ?= $(CURDIR)/../../../.. # Include packages that pull up and auto-init the link layer. # NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present diff --git a/examples/riot/examples_libcoap_client/client-coap.c b/examples/riot/examples_libcoap_client/client_coap.c similarity index 99% rename from examples/riot/examples_libcoap_client/client-coap.c rename to examples/riot/examples_libcoap_client/client_coap.c index 231cf7d9..00cae2a9 100644 --- a/examples/riot/examples_libcoap_client/client-coap.c +++ b/examples/riot/examples_libcoap_client/client_coap.c @@ -1,5 +1,5 @@ /* - * client-coap.c -- RIOT client example + * client_coap.c -- RIOT client example * * Copyright (C) 2023-2025 Jon Shallow * @@ -12,7 +12,7 @@ #include #include #include -#include "client-coap.h" +#include "client_coap.h" #include #include "macros/utils.h" diff --git a/examples/riot/examples_libcoap_client/client-coap.h b/examples/riot/examples_libcoap_client/client_coap.h similarity index 100% rename from examples/riot/examples_libcoap_client/client-coap.h rename to examples/riot/examples_libcoap_client/client_coap.h diff --git a/examples/riot/examples_libcoap_server/Kconfig b/examples/riot/examples_libcoap_server/Kconfig index 3ab7fd12..dd7969e9 100644 --- a/examples/riot/examples_libcoap_server/Kconfig +++ b/examples/riot/examples_libcoap_server/Kconfig @@ -2,7 +2,7 @@ # General Public License v2.1. See the file LICENSE in the top level # directory for more details. # -menu "libcoap-server" +menu "libcoap_server" depends on USEPKG_LIBCOAP config LIBCOAP_USE_PSK @@ -19,4 +19,4 @@ config LIBCOAP_USE_PSK_ID depends on USEMODULE_TINYDTLS endif # LIBCOAP_CLIENT_SUPPORT -endmenu # libcoap-server +endmenu # libcoap_server diff --git a/examples/riot/examples_libcoap_server/Makefile b/examples/riot/examples_libcoap_server/Makefile index f8a32810..a930247b 100644 --- a/examples/riot/examples_libcoap_server/Makefile +++ b/examples/riot/examples_libcoap_server/Makefile @@ -1,11 +1,11 @@ # name of your application -APPLICATION = libcoap-server +APPLICATION = libcoap_server # If no BOARD is found in the environment, use this default: BOARD ?= native # This has to be the absolute path to the RIOT base directory: -RIOTBASE ?= $(CURDIR)/../.. +RIOTBASE ?= $(CURDIR)/../../../.. # Include packages that pull up and auto-init the link layer. # NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present diff --git a/examples/riot/examples_libcoap_server/server-coap.c b/examples/riot/examples_libcoap_server/server_coap.c similarity index 99% rename from examples/riot/examples_libcoap_server/server-coap.c rename to examples/riot/examples_libcoap_server/server_coap.c index 382d16f4..443a7cc3 100644 --- a/examples/riot/examples_libcoap_server/server-coap.c +++ b/examples/riot/examples_libcoap_server/server_coap.c @@ -1,5 +1,5 @@ /* - * server-coap.c -- RIOT example + * server_coap.c -- RIOT example * * Copyright (C) 2023-2025 Jon Shallow * @@ -11,7 +11,7 @@ #include "coap_config.h" #include -#include "server-coap.h" +#include "server_coap.h" #include #include "macros/utils.h" diff --git a/examples/riot/examples_libcoap_server/server-coap.h b/examples/riot/examples_libcoap_server/server_coap.h similarity index 91% rename from examples/riot/examples_libcoap_server/server-coap.h rename to examples/riot/examples_libcoap_server/server_coap.h index 20f52e21..e922acf6 100644 --- a/examples/riot/examples_libcoap_server/server-coap.h +++ b/examples/riot/examples_libcoap_server/server_coap.h @@ -1,5 +1,5 @@ /* - * server-coap.h -- RIOT client example + * server_coap.h -- RIOT client example * * Copyright (C) 2023-2025 Jon Shallow * diff --git a/examples/riot/pkg_libcoap/Makefile b/examples/riot/pkg_libcoap/Makefile index 5f69bed3..90e3e636 100644 --- a/examples/riot/pkg_libcoap/Makefile +++ b/examples/riot/pkg_libcoap/Makefile @@ -1,6 +1,6 @@ PKG_NAME=libcoap PKG_URL=https://github.com/obgm/libcoap -PKG_VERSION=cd06a72916bd234fd5dfdaea4def50f178440614 +PKG_VERSION=f12b620cdecb00e7d4dcfb104f28f577c80f06cc PKG_LICENSE=BSD-2-Clause LIBCOAP_BUILD_DIR=$(BINDIR)/pkg/$(PKG_NAME)