[Buildroot] [PATCH 24/29 v2] package/sdcc: new package

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


Although they are optional, most ports need sdcppp and sdbinutils,
especially when we later add an option to build the device libraries.
Furthermore, they are relatively quick to build. So, we always build
them unconditionally.

For now, we enable no port, to get a basic package. Enabling ports will
come in following commits [0].

To be noted: sdcc will hard-code its PREFIX/share/sdcc/ (from configure
--datadir and --datarootdir) as a search path to lok for its stdlib. It
also add a path relative ot where its executable is, i.e. something like
[...]/bin/../share/sdcc/ as an additional search path for additional
libraries. When PPD is enabled, PREFIX/share/sdcc/ is copied to the
depndee's PPD, so the stdlibs will be found in both locations, causing
sdld to eventually whine because of duplicate symbols:

    ?ASlink-Warning-Definition of public symbol '___sdcc_external_startup' found more than once:
       Library: '.../per-package/fx2lafw/host/bin/../share/sdcc/lib/small/libsdcc.lib', Module: '_startup.rel'
       Library: '.../per-package/host-sdcc/host/share/sdcc/lib/small/libsdcc.lib', Module: '_startup.rel'

As tested with fx2lafw (to come in a later commit), the generated
binaries are byte-for-byte identical whether PPD is enabled (duplicate
symbols) or not (no duplicate symbol).

The licensing terms are a bit hectic: the core of sdcc, the sdcc
compiler itself, is GPLv2, and the doc [1] adds "GPLv3 might apply
depending on the libraries used when building", which is a bit
ambiguous... GPLv3 is however the license for other parts of sdcc,
like the sdcpp preprocessor (derived from gcc), the sdbinutils (derived
from binutils), or the sdasXXX assemblers and sdld linker (derived from
an external package, asXXXX [2]). As sdld is always built, GPLv3 always
applies. One tool is under the zlib license. Others are disabled, so
their licensing terms do not apply (until we add options to enable
them).

[0] with all ports disabled as it is in this initial commit, sdcc will
    end up building some stuff at install time; this is not a problem in
    practice, as the default commands and flags all work nicely.
    Furthermore, the issue will disappear when we eventually add one
    port, in the following commit.
[1] the PDF rendered from the in-tree docs/dsccman.lyx, and of which the
    latest version is at https://sdcc.sourceforge.net/doc/sdccman.pdf,
    notably section 1.2, SDCC Suite Licenses.
[2] https://shop-pdp.net/ashtml/

Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---
 DEVELOPERS                  |  3 ++
 package/Config.in.host      |  1 +
 package/sdcc/Config.in.host | 15 ++++++++
 package/sdcc/sdcc.hash      |  7 ++++
 package/sdcc/sdcc.mk        | 75 +++++++++++++++++++++++++++++++++++++
 5 files changed, 101 insertions(+)
 create mode 100644 package/sdcc/Config.in.host
 create mode 100644 package/sdcc/sdcc.hash
 create mode 100644 package/sdcc/sdcc.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 1c84f95943..b4250a5dbf 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -3438,6 +3438,9 @@ F:	package/casync/
 F:	package/gloox/
 F:	package/tpm2-pkcs11/
 
+N:	Yann E. MORIN <yann.morin.1998 at free.fr>
+F:	package/sdcc/
+
 N:	Yann E. MORIN <yann.morin at orange.com>
 F:	.editorconfig
 F:	package/gpsd/
diff --git a/package/Config.in.host b/package/Config.in.host
index 3e6fef9e50..d29fa33e27 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -109,6 +109,7 @@ menu "Host utilities"
 	source "package/sam-ba/Config.in.host"
 	source "package/sdbus-cpp/Config.in.host"
 	source "package/sdbusplus/Config.in.host"
+	source "package/sdcc/Config.in.host"
 	source "package/sentry-cli/Config.in.host"
 	source "package/skopeo/Config.in.host"
 	source "package/sloci-image/Config.in.host"
diff --git a/package/sdcc/Config.in.host b/package/sdcc/Config.in.host
new file mode 100644
index 0000000000..52934aa150
--- /dev/null
+++ b/package/sdcc/Config.in.host
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_HOST_SDCC
+	bool "host sdcc"
+	select BR2_PACKAGE_HOST_BOOST
+	select BR2_PACKAGE_HOST_BOOST_GRAPH
+	help
+	  SDCC is a retargettable, optimizing Standard C (ANSI C89, ISO
+	  C99, ISO C11, ISO C23) compiler suite that targets the Intel
+	  MCS51 based microprocessors (8031, 8032, 8051, 8052, etc.),
+	  Maxim (formerly Dallas) DS80C390 variants, Freescale (formerly
+	  Motorola) HC08 based (hc08, s08), Zilog Z80 based MCUs (Z80,
+	  Z180, SM83, Rabbit 2000, 2000A, 3000A, TLCS-90, R800), Padauk
+	  (pdk14, pdk15), STMicroelectronics STM8, MOS 6502 and WDC
+	  65C02.
+
+	  https://sdcc.sourceforge.net/
diff --git a/package/sdcc/sdcc.hash b/package/sdcc/sdcc.hash
new file mode 100644
index 0000000000..ef5ceb686a
--- /dev/null
+++ b/package/sdcc/sdcc.hash
@@ -0,0 +1,7 @@
+# From sourceforge
+sha1  ffc600a471b2684a3b268859b038487e43b811ed  sdcc-src-4.5.0.tar.bz2
+# Locally computed
+sha256  d5030437fb436bb1d93a8dbdbfb46baaa60613318f4fb3f5871d72815d1eed80  sdcc-src-4.5.0.tar.bz2
+sha256  1ca3e8f71b7de618968e7ea9fe47822d9e704dc476aef8544033abedec355225  COPYING
+sha256  c23d0df4adc62b3f7cddcf96bec64e7100bfe7671eefe2ce31b9ace366fcc001  LICENSE
+sha256  39c81a22595e472dcae2caf7b1a4009a9bbaad7b043d800a5af0631c612961af  doc/README.txt
diff --git a/package/sdcc/sdcc.mk b/package/sdcc/sdcc.mk
new file mode 100644
index 0000000000..b2082c36bc
--- /dev/null
+++ b/package/sdcc/sdcc.mk
@@ -0,0 +1,75 @@
+################################################################################
+#
+# sdcc
+#
+################################################################################
+
+SDCC_VERSION = 4.5.0
+SDCC_SOURCE = sdcc-src-$(SDCC_VERSION).tar.bz2
+SDCC_SITE = https://downloads.sourceforge.net/project/sdcc/sdcc/$(SDCC_VERSION)
+
+SDCC_LICENSE = \
+	GPL-2.0-only (sdcc), \
+	GPL-3.0-or-later (sdcpp, sdas, sdld), \
+	Zlib (makebin)
+
+# doc/README.txt refers to dccman.pdf for the whole licensing information,
+# but that's a generated file, so we can't add it to the license files.
+SDCC_LICENSE_FILES = \
+	COPYING \
+	LICENSE \
+	doc/README.txt
+
+HOST_SDCC_DEPENDENCIES = \
+	$(BR2_PYTHON3_HOST_DEPENDENCY) \
+	host-bison \
+	host-flex \
+	host-gawk \
+	host-zlib \
+	host-boost
+
+# ccache is handled by Buildroot and included in $(HOSTCC)
+HOST_SDCC_CONF_OPTS = \
+	--without-ccache \
+	--disable-doc \
+	--disable-device-lib \
+	--disable-non-free \
+	--disable-libgc
+
+# Keep utilities separate, and alphabeticaly ordered.
+HOST_SDCC_CONF_OPTS += \
+	--enable-sdbinutils \
+	--enable-sdcpp \
+	--disable-packihx \
+	--disable-sdcdb \
+	--disable-ucsim
+
+# Keep the list of ports separate, and alphabetically ordered.
+HOST_SDCC_CONF_OPTS += \
+	--disable-ds390-port \
+	--disable-ds400-port \
+	--disable-ez80_z80-port \
+	--disable-f8-port \
+	--disable-hc08-port \
+	--disable-mcs51-port \
+	--disable-mos6502-port \
+	--disable-mos65c02-port \
+	--disable-pdk13-port \
+	--disable-pdk14-port \
+	--disable-pdk15-port \
+	--disable-pdk16-port \
+	--disable-pic14-port \
+	--disable-pic16-port \
+	--disable-r2k-port \
+	--disable-r2ka-port \
+	--disable-r3ka-port \
+	--disable-r800-port \
+	--disable-s08-port \
+	--disable-sm83-port \
+	--disable-stm8-port \
+	--disable-tlcs90-port \
+	--disable-z180-port \
+	--disable-z80-port \
+	--disable-z80n-port
+
+$(eval $(host-autotools-package))
-- 
2.47.0



More information about the buildroot mailing list