configure: add ability to select plugins to build in --plugins flag

Use ":" as the separator. Useful for plugin development and debugging.

Example:
../tools/configure --target=hibyr1 --type=ADS --plugins="properties.c:imageviewer"

This creates a debug simulator build for Hiby R1 with the properties.c file and the imageviewer directory plugins enabled.

Change-Id: If974cfb0c54bd2c1a53ae11cc3f942c698ef2fe4
This commit is contained in:
Roman Artiukhin 2026-02-16 11:11:19 +02:00
parent dd21a1d1d9
commit aea9e1b63f
2 changed files with 33 additions and 0 deletions

View file

@ -20,11 +20,15 @@ ifeq ($(APP_TYPE),ctru-app)
is_app_build =
endif
ifdef SELECTED_PLUGINS_SRC
PLUGINS_SRC = $(SELECTED_PLUGINS_SRC)
else
ifdef is_app_build
PLUGINS_SRC = $(call preprocess, $(APPSDIR)/plugins/SOURCES.app_build)
else
PLUGINS_SRC = $(call preprocess, $(APPSDIR)/plugins/SOURCES)
endif
endif # ifdef SELECTED_PLUGINS_SRC
OTHER_SRC += $(PLUGINS_SRC)
ROCKS1 := $(PLUGINS_SRC:.c=.rock)
ROCKS1 := $(call full_path_subst,$(ROOTDIR)/%,$(BUILDDIR)/%,$(ROCKS1))
@ -58,11 +62,15 @@ endif
OTHER_SRC += $(ROOTDIR)/apps/plugins/plugin_crt0.c
PLUGIN_CRT0 := $(BUILDDIR)/apps/plugins/plugin_crt0.o
# multifile plugins (subdirs):
ifdef SELECTED_PLUGINS_SUBDIRS
PLUGINSUBDIRS := $(SELECTED_PLUGINS_SUBDIRS)
else
ifdef is_app_build
PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS.app_build)
else
PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
endif
endif # ifdef SELECTED_PLUGINS_SUBDIRS
PLUGIN_LIBS := $(PLUGINLIB) $(PLUGINBITMAPLIB) $(SETJMPLIB) $(FIXEDPOINTLIB)

25
tools/configure vendored
View file

@ -1557,6 +1557,7 @@ ARG_THREAD_SUPPORT=
ARG_32BIT=
ARG_ADDR_SAN=
ARG_UBSAN=
ARG_PLUGINS=
err=
for arg in "$@"; do
case "$arg" in
@ -1573,6 +1574,7 @@ for arg in "$@"; do
--ttsopts=*) ARG_TTSOPTS=`echo "$arg" | cut -d = -f 2`;;
--type=*) ARG_TYPE=`echo "$arg" | cut -d = -f 2`;;
--voice=*) ARG_VOICE=`echo "$arg" | cut -d = -f 2`;;
--plugins=*) ARG_PLUGINS=`echo "$arg" | cut -d = -f 2`;;
--thumb) ARG_ARM_THUMB=1;;
--no-thumb) ARG_ARM_THUMB=0;;
--32-bit) ARG_32BIT=1;;
@ -4828,11 +4830,34 @@ cmdline=`echo $cmdline | sed -e s,--target=[a-zA-Z_0-9]\*,,g \
-e s,--type=[a-zA-Z0-9]\*,,g`
cmdline="$cmdline --target=\$(MODELNAME) --ram=\$(MEMORYSIZE) --rbdir=\$(RBDIR) --type=$btype$advopts"
if [ -n "$ARG_PLUGINS" ]; then
echo "Selected plugins: $ARG_PLUGINS"
plugins="yes"
selected_src=""
selected_subdirs=""
chk_plugin_dir="${rootdir}/apps/plugins"
IFS=":"
for p in $ARG_PLUGINS; do
if [ -d "$chk_plugin_dir/$p" ]; then
selected_subdirs="$selected_subdirs \$(ROOTDIR)/apps/plugins/$p"
elif [ -f "$chk_plugin_dir/$p" ]; then
selected_src="$selected_src \$(ROOTDIR)/apps/plugins/$p"
else
echo "Warning: Plugin '$p' found neither as file nor directory in $chk_plugin_dir. Use ':' as the separator."
fi
done
fi
### end of cmdline
cat > Makefile <<EOF
## Automatically generated. http://www.rockbox.org/
export SELECTED_PLUGINS_SRC=${selected_src}
export SELECTED_PLUGINS_SUBDIRS=${selected_subdirs}
export ROOTDIR=${rootdir}
export FIRMDIR=\$(ROOTDIR)/firmware
export APPSDIR=${appsdir}