[Buildroot] [PATCH 27/29 v2] package/sdcc: add option for the device lib

Yann E. MORIN yann.morin.1998 at free.fr
Wed Apr 9 20:03:42 UTC 2025


This enables the "stdlib"-like set of libraries for the enabled ports
and for the various memory models supported by each port.

For some ports, there are non-fee libraries (and includes) available.
However, their licensing terms are dubious, and they are only available
for the PIC ports which we currently do not enable in Buildroot. So we
do not enable those non-free stuff.

Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
---
 package/sdcc/Config.in.host |  5 +++++
 package/sdcc/sdcc.mk        | 21 +++++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/package/sdcc/Config.in.host b/package/sdcc/Config.in.host
index 711da37444..56ac8c7ed1 100644
--- a/package/sdcc/Config.in.host
+++ b/package/sdcc/Config.in.host
@@ -36,4 +36,9 @@ config BR2_PACKAGE_HOST_SDCC_Z80
 	  mode, SM83, Rabbit 2000/3000, Rabbit 3000A , Toshiba TLCS-90,
 	  Zilog eZ80 in Z80 mode, ASCII R800),
 
+comment "libraries"
+
+config BR2_PACKAGE_HOST_SDCC_DEV_LIB
+	bool "device-lib"
+
 endif
diff --git a/package/sdcc/sdcc.mk b/package/sdcc/sdcc.mk
index 8e5032427f..0e2de37748 100644
--- a/package/sdcc/sdcc.mk
+++ b/package/sdcc/sdcc.mk
@@ -32,8 +32,6 @@ HOST_SDCC_DEPENDENCIES = \
 HOST_SDCC_CONF_OPTS = \
 	--without-ccache \
 	--disable-doc \
-	--disable-device-lib \
-	--disable-non-free \
 	--disable-libgc
 
 # Keep utilities separate, and alphabeticaly ordered.
@@ -72,4 +70,23 @@ HOST_SDCC_CONF_OPTS += \
 	$(if $(BR2_PACKAGE_HOST_SDCC_Z80),--enable,--disable)-z80-port \
 	$(if $(BR2_PACKAGE_HOST_SDCC_Z80),--enable,--disable)-z80n-port
 
+ifeq ($(BR2_PACKAGE_HOST_SDCC_DEV_LIB),y)
+SDCC_LICENSE += \
+	, GPL-2.0-only with Library Exception (device libraries)
+
+HOST_SDCC_CONF_OPTS += \
+	--enable-device-lib \
+	--disable-non-free
+define HOST_SDCC_DEV_LIB_CLEAN
+	rm -rf $(HOST_DIR)/share/sdcc/lib/src
+	find $(HOST_DIR)/share/sdcc/include $(HOST_DIR)/share/sdcc/lib \
+		-depth -type d -empty -delete
+endef
+HOST_SDCC_POST_INSTALL_HOOKS += HOST_SDCC_DEV_LIB_CLEAN
+else
+HOST_SDCC_CONF_OPTS += \
+	--disable-device-lib \
+	--disable-non-free
+endif
+
 $(eval $(host-autotools-package))
-- 
2.47.0



More information about the buildroot mailing list