From 095fd4372c280ddd55bc09eddde0fdfd37358f44 Mon Sep 17 00:00:00 2001 From: Viorel Munteanu Date: Fri, 20 Feb 2026 14:17:38 +0200 Subject: [PATCH] dev-embedded/sdcc: add 4.5.0 Add version 4.5.0. Sync live ebuild. The build system for this package is a mess. eautoreconf does not work by default, there are multiple hacks to make it work. I included binutils in SRC_URI to copy two m4 files from there. I could have packaged them alone, but I assume most people already have it anyway. Also looks a bit more secure this way. Closes: https://bugs.gentoo.org/970237 Closes: https://bugs.gentoo.org/922301 Signed-off-by: Viorel Munteanu --- dev-embedded/sdcc/Manifest | 3 + dev-embedded/sdcc/files/sdcc-4.5.0-c23.patch | 74 ++++++ .../sdcc/files/sdcc-4.5.0-install-apps.patch | 14 ++ .../sdcc/files/sdcc-4.5.0-link-tinfo.patch | 24 ++ dev-embedded/sdcc/metadata.xml | 2 + dev-embedded/sdcc/sdcc-4.5.0.ebuild | 223 ++++++++++++++++++ dev-embedded/sdcc/sdcc-9999.ebuild | 81 ++++++- 7 files changed, 409 insertions(+), 12 deletions(-) create mode 100644 dev-embedded/sdcc/files/sdcc-4.5.0-c23.patch create mode 100644 dev-embedded/sdcc/files/sdcc-4.5.0-install-apps.patch create mode 100644 dev-embedded/sdcc/files/sdcc-4.5.0-link-tinfo.patch create mode 100644 dev-embedded/sdcc/sdcc-4.5.0.ebuild diff --git a/dev-embedded/sdcc/Manifest b/dev-embedded/sdcc/Manifest index 8f200014c25c5..05aed014c6af3 100644 --- a/dev-embedded/sdcc/Manifest +++ b/dev-embedded/sdcc/Manifest @@ -1,2 +1,5 @@ +DIST binutils-2.45.1.tar.xz 27962312 BLAKE2B 1ccab38659ec47f9100b61322627345fe79ebd04ed0b1e872c988edded4d292d7c9ac33d9f6ea47bf265ec823dfba60da0e84374900c15ec89e3aa9280ac020c SHA512 ea030419eba387579ab717be7e3223fc99e93b586860b06003c12489f93441640d4082736f76aa5e98233db4f46e232f536a45e471486de1f5b64e1b827c167e DIST sdcc-doc-4.3.0.tar.bz2 1271916 BLAKE2B a8c8018990ff2ae5504253f38a9de045b8a5227a60d76604394c286cb55d11b24f3ab97ed0a11d434c0b1ccb7e5340c33872c5ff5e677130e395b396a389f532 SHA512 088dce843c9e06380a8058b5253051e2a2442655be38435f15ed6754291e75d3f6e2b1a416e4f90dd865b2d89a9e1c59a2b9ee1422096132f49f038c527bcd19 +DIST sdcc-doc-4.5.0.tar.bz2 1404904 BLAKE2B 6d48c83b698e94e721c45dc6928bc718054b6bc019f1e62104929633fb16eaad77efefd2cd827ce36a19809508d6f53c67f8f1113c7df9ab3d0ea1006d4f4fef SHA512 0591352d6ed3dd39b71ac79135da0bb37782911c400b6802ee300bc9ffd397aba7558b5d53ae0e37a0408ba686dfb548be0e2fcf9ecebb550e0f5d254789bbd8 DIST sdcc-src-4.3.0.tar.bz2 19931677 BLAKE2B 94fc7ade96801ea6c9eb89d32b99554d27ad3d926d2d5889e91334b11d4658ccc160606cd2b1c6f3bb21bd25ea3df1dca274f40553aa8a52a73ac07764b3eaad SHA512 dabe276a0d2872bee2cdc14433f31a1e94153f9dce5a11add916ede2e76bfacf763be8e6d8134dc3aefdae29e38d3a7354626755e81e0f6db0e60c1798476f21 +DIST sdcc-src-4.5.0.tar.bz2 20298103 BLAKE2B 8f7e79224e8c0692b8bc1377dbeb9c743f959ebb83bc444a215edf20f7d8c9faece7d0898ad130d141e81256cde00a74e1263f2fd9b65df0cca379524af2f93a SHA512 46edd0456d82ebeacc6e7b2ecf5038aac38ce161dc938662c438cca9c41f73b2004589788c18a0f1dd295033c9c35c202c052b463ec7bd8c605065d440d617f4 diff --git a/dev-embedded/sdcc/files/sdcc-4.5.0-c23.patch b/dev-embedded/sdcc/files/sdcc-4.5.0-c23.patch new file mode 100644 index 0000000000000..0c19a6dff0fad --- /dev/null +++ b/dev-embedded/sdcc/files/sdcc-4.5.0-c23.patch @@ -0,0 +1,74 @@ +https://sourceforge.net/p/sdcc/code/15567/ +https://sourceforge.net/p/sdcc/bugs/3823/ + +--- sdcc/debugger/mcs51/sdcdb.c ++++ sdcc/debugger/mcs51/sdcdb.c +@@ -62,7 +62,7 @@ + int nLinkrecs = 0; + linkrec **linkrecs = NULL; /* all linkage editor records */ + context *currCtxt = NULL; +-short fullname = 0; ++bool fullname = 0; + short showfull = 0; + char userinterrupt = 0; + char nointerrupt = 0; +@@ -573,7 +573,7 @@ + { + /* for module records do */ + case MOD_REC: +- currMod = parseModule(loop->line, TRUE); ++ currMod = parseModule(loop->line, true); + currModName = currMod->name ; + + /* search the c source file and load it into buffer */ +@@ -1906,7 +1906,7 @@ + + if (strcmp(argv[i], "-fullname") == 0) + { +- fullname = TRUE; ++ fullname = true; + continue; + } + +--- sdcc/debugger/mcs51/sdcdb.h ++++ sdcc/debugger/mcs51/sdcdb.h +@@ -42,6 +42,7 @@ + #define Dprintf(f, fs) { } + #endif + ++#include + #include + #include + #include +@@ -57,11 +58,6 @@ + #include "src/SDCCset.h" + #include "src/SDCChasht.h" + +-#define TRUE 1 +-#define FALSE !TRUE +- +-typedef short bool; +- + #ifndef max + #define max(a,b) (a > b ? a : b) + #endif +@@ -279,7 +275,7 @@ + char *gc_strdup(const char *s); + srcLine **loadFile (char *name, int *nlines); + +-extern short fullname; ++extern bool fullname; + extern int srcMode; + extern char contsim; + char *searchDirsFname (char *); +--- sdcc/debugger/mcs51/symtab.c ++++ sdcc/debugger/mcs51/symtab.c +@@ -836,7 +836,7 @@ + mod = NULL; + if (!applyToSet(modules,moduleWithCName,mname,&mod)) + { +- mod = parseModule(mname, FALSE); ++ mod = parseModule(mname, false); + mod->c_name = alloccpy(mname,strlen(mname)); + mod->cfullname=searchDirsFname(mod->c_name); + mod->cLines = loadFile(mod->c_name,&mod->ncLines); diff --git a/dev-embedded/sdcc/files/sdcc-4.5.0-install-apps.patch b/dev-embedded/sdcc/files/sdcc-4.5.0-install-apps.patch new file mode 100644 index 0000000000000..8627910e8cbae --- /dev/null +++ b/dev-embedded/sdcc/files/sdcc-4.5.0-install-apps.patch @@ -0,0 +1,14 @@ +Upstream do not install apps (in particular serialview is missing) + +--- a/sim/ucsim/src/Makefile.in ++++ b/sim/ucsim/src/Makefile.in +@@ -61,6 +61,9 @@ + @for pkg in $(PKGS); do\ + $(MAKE) -C sims/$${pkg} install ;\ + done ++ @for app in $(APPS); do\ ++ $(MAKE) -C apps/$${app} install ;\ ++ done + + + # Deleting all the installed files diff --git a/dev-embedded/sdcc/files/sdcc-4.5.0-link-tinfo.patch b/dev-embedded/sdcc/files/sdcc-4.5.0-link-tinfo.patch new file mode 100644 index 0000000000000..71de5d5db7565 --- /dev/null +++ b/dev-embedded/sdcc/files/sdcc-4.5.0-link-tinfo.patch @@ -0,0 +1,24 @@ +Link -ltinfo for ucsim + +/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /var/tmp/portage/dev-embedded/sdcc-4.2.0/temp/cc3R2ckl.ltrans0.ltrans.o: undefined reference to symbol 'nodelay' +/usr/lib/gcc/x86_64-pc-linux-gnu/11.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /lib64/libtinfo.so.6: error adding symbols: DSO missing from command line + +--- a/sim/ucsim/src/configure.ac ++++ b/sim/ucsim/src/configure.ac +@@ -405,14 +405,14 @@ + if test $curses_ok != yes; then + AC_CHECK_LIB(curses,nl, + curses_ok="yes" +- CURSES_LIBS="${CURSES_LIBS} -lcurses", ++ CURSES_LIBS="${CURSES_LIBS} -lcurses -ltinfo", + curses_ok="no") + fi + + if test $curses_ok != yes; then + AC_CHECK_LIB(ncurses,nl, + curses_ok="yes" +- CURSES_LIBS="${CURSES_LIBS} -lncurses", ++ CURSES_LIBS="${CURSES_LIBS} -lncurses -ltinfo", + curses_ok="no") + fi + fi diff --git a/dev-embedded/sdcc/metadata.xml b/dev-embedded/sdcc/metadata.xml index 822e493b63604..9c0fca6ed5f37 100644 --- a/dev-embedded/sdcc/metadata.xml +++ b/dev-embedded/sdcc/metadata.xml @@ -31,6 +31,7 @@ be retargeted for other microprocessors. Add support for Intel mcs51 Add support for Zilog Z80 Add support for Zilog Z180 + Add support for ASCII Corporation R800 Add support for Rabbit 2000 Add support for Rabbit 2000A Add support for Rabbit 3000A @@ -51,5 +52,6 @@ be retargeted for other microprocessors. Add support for PDK16 Add support for MOS 6502 Add support for MOS 65C02 + Add support for the new F8 arch diff --git a/dev-embedded/sdcc/sdcc-4.5.0.ebuild b/dev-embedded/sdcc/sdcc-4.5.0.ebuild new file mode 100644 index 0000000000000..bad1f8f025122 --- /dev/null +++ b/dev-embedded/sdcc/sdcc-4.5.0.ebuild @@ -0,0 +1,223 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools toolchain-funcs + +DESCRIPTION="Small device C compiler (for various microprocessors)" +HOMEPAGE="https://sdcc.sourceforge.net/" + +if [[ ${PV} == "9999" ]] ; then + ESVN_REPO_URI="https://svn.code.sf.net/p/sdcc/code/trunk/sdcc" + inherit subversion +else + SRC_URI=" + https://downloads.sourceforge.net/project/${PN}/sdcc/${PV}/${PN}-src-${PV}.tar.bz2 + doc? ( https://downloads.sourceforge.net/project/${PN}/sdcc-doc/${PV}/${PN}-doc-${PV}.tar.bz2 ) + " + + KEYWORDS="~amd64 ~x86" +fi +BINUTILS_PV=2.45.1 +SRC_URI+=" + mirror://gnu/binutils/binutils-${BINUTILS_PV}.tar.xz + https://sourceware.org/pub/binutils/releases/binutils-${BINUTILS_PV}.tar.xz +" + +LICENSE=" + GPL-2 ZLIB + non-free? ( MicroChip-SDCC ) + packihx? ( public-domain ) +" +SLOT="0" +# in order of configure.ac's AC_DO_PORT stanzas +SDCC_PORTS=" + mcs51 + z80 z180 + r2k r2ka r3ka + sm83 + tlcs90 + ez80-z80 + z80n r800 + ds390 ds400 + pic14 pic16 + hc08 + s08 + stm8 + pdk13 pdk14 pdk15 pdk16 + mos6502 mos65c02 + f8 +" +IUSE=" + ${SDCC_PORTS} + +boehm-gc device-lib doc non-free packihx sdcdb +sdcpp ucsim +" + +RDEPEND=" + dev-libs/boost:= + virtual/zlib:= + pic14? ( >=dev-embedded/gputils-0.13.7 ) + pic16? ( >=dev-embedded/gputils-0.13.7 ) + boehm-gc? ( dev-libs/boehm-gc:= ) + sdcdb? ( sys-libs/readline:0= ) + ucsim? ( sys-libs/ncurses:= ) +" +DEPEND=" + ${RDEPEND} + dev-util/gperf +" +PATCHES=( + "${FILESDIR}"/sdcc-4.3.2-override-override.patch + "${FILESDIR}"/sdcc-4.5.0-link-tinfo.patch + "${FILESDIR}"/sdcc-4.3.0-fix-mkdir-autoconf-test.patch + "${FILESDIR}"/sdcc-4.3.0-autoreconf-libiberty.patch + "${FILESDIR}"/sdcc-4.3.0-fix-elf-type.patch + "${FILESDIR}"/${P}-c23.patch +) + +src_unpack() { + if [[ ${PV} == "9999" ]] ; then + subversion_src_unpack + fi + default +} + +src_prepare() { + # Fix conflicting variable names between Gentoo and sdcc + find device/lib/pic{14,16} device/non-free/lib/pic{14,16} \( \ + -name 'configure.ac' -o -name 'Makefile.*' \) \ + -exec sed -i 's/\/SDCC_&/g' {} + || die + find device -name 'Makefile.in' \ + -exec sed -i 's/\/SDCC_&/g' {} + || die + # Possible alternative: Patch the following files to not pick up the + # variables from the environment: + # - lib/Makefile.in (PORTDIR ifndef/endif) + # - device/non-free/lib/pic14/Makefile.common.in (ARCH ?= 877) + # - device/non-free/lib/pic16/configure.ac (${ARCH:-18f452}) + # - device/lib/pic14/configure.ac (${ARCH:-16f877}) + # - device/lib/pic16/configure.ac (${ARCH:-18f452}) + + # Make sure timestamps don't get messed up. + [[ ${PV} == "9999" ]] && find "${S}" -type f -exec touch -r . {} + + + mkdir -p support/sdbinutils/bfd/doc || die + + # add m4 files from binutils to run autoreconf for libiberty + cp "${WORKDIR}"/binutils-${BINUTILS_PV}/libiberty/acinclude.m4 support/sdbinutils/libiberty/acinclude.m4 || die + cp "${WORKDIR}"/binutils-${BINUTILS_PV}/config/mmap.m4 support/sdbinutils/config/mmap.m4 || die + # libiberty configure will check this file and fail if not found + cp install-sh support/sdbinutils/libiberty/ || die + # libiberty configure will fail if this was not set + export libiberty_topdir="${S}"/support/sdbinutils/libiberty + + default + + # Upstream moved sim/ucsim to sim/ucsim/src and added some wrappers in sim/ucsim. + # Now eautoreconf needs to run in sim/ucsim/src, but configure needs to run in sim/ucsim. + # Run eautoreconf manually where it is needed and leave econf do its thing. + local dirs=( + support/cpp + support/packihx + sim/ucsim/src + debugger/mcs51 + support/sdbinutils + support/sdbinutils/libiberty + device/lib/pic14 + device/non-free/lib/pic14 + device/lib/pic16 + device/non-free/lib/pic16 + ) + for i in "${dirs[@]}"; do + pushd "$i" &> /dev/null || die + AT_NOELIBTOOLIZE=yes eautoreconf + popd &> /dev/null || die + done + AT_NO_RECURSIVE=yes eautoreconf + + # Avoid 'bfd.info' rebuild with 'makeinfo': bug #705424 + # Build dependencies are: eautoreconf->Makefile.in->bfdver.texi->bfd.info + touch support/sdbinutils/bfd/doc/bfdver.texi || die + touch support/sdbinutils/bfd/doc/bfd.info || die +} + +src_configure() { + # bug #922301 + tc-export CC CPP + local myeconfargs=( + ac_cv_prog_STRIP=true + --without-ccache + --enable-sdbinutils + + $(use_enable ucsim) + + $(use_enable device-lib) + $(use_enable packihx) + $(use_enable sdcpp) + $(use_enable sdcdb) + $(use_enable non-free) + $(use_enable boehm-gc libgc) + + $(use_enable mcs51 mcs51-port) + $(use_enable z80 z80-port) + $(use_enable z180 z180-port) + $(use_enable r2k r2k-port) + $(use_enable r2ka r2ka-port) + $(use_enable r3ka r3ka-port) + $(use_enable sm83 sm83-port) + $(use_enable tlcs90 tlcs90-port) + $(use_enable ez80-z80 ez80_z80-port) + $(use_enable z80n z80n-port) + $(use_enable r800 r800-port) + $(use_enable ds390 ds390-port) + $(use_enable ds400 ds400-port) + $(use_enable pic14 pic14-port) + $(use_enable pic16 pic16-port) + $(use_enable hc08 hc08-port) + $(use_enable s08 s08-port) + $(use_enable stm8 stm8-port) + $(use_enable pdk13 pdk13-port) + $(use_enable pdk14 pdk14-port) + $(use_enable pdk15 pdk15-port) + $(use_enable pdk16 pdk16-port) + $(use_enable mos6502 mos6502-port) + $(use_enable mos65c02 mos65c02-port) + $(use_enable f8 f8-port) + ) + + # ucsim has extra sims that do not correspond to USE flags; enable them all. + if use ucsim; then + myeconfargs+=( --enable-serio ) + for i in avr st7 p1516 m6809 m6800 m68hc11 m68hc12 pblaze i8085 i8048 oisc; do + myeconfargs+=( --enable-$i-sim ) + done + fi + + econf "${myeconfargs[@]}" +} + +src_compile() { + default + + # Sanity check, as gputils errors/segfaults don't cause make to stop + local libs=() + use pic14 && libs+=( device/lib/build/pic14/libsdcc.lib ) + use pic16 && libs+=( device/lib/build/pic16/libsdcc.lib ) + for lib in "${libs[@]}"; do + [[ -f "${lib}" ]] || die "Failed to build ${lib}" + done +} + +src_install() { + default + dodoc doc/*.txt + find "${ED}" -type d -name .deps -exec rm -vr {} + || die + + # make install does not install this + use ucsim && dobin sim/ucsim/src/apps/serio.src/serialview + + if use doc && [[ ${PV} != "9999" ]]; then + cd "${WORKDIR}"/doc + dodoc -r * + fi +} diff --git a/dev-embedded/sdcc/sdcc-9999.ebuild b/dev-embedded/sdcc/sdcc-9999.ebuild index e56d6782290ca..0329305c0727f 100644 --- a/dev-embedded/sdcc/sdcc-9999.ebuild +++ b/dev-embedded/sdcc/sdcc-9999.ebuild @@ -1,9 +1,12 @@ -# Copyright 1999-2025 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 -inherit autotools flag-o-matic +inherit autotools toolchain-funcs + +DESCRIPTION="Small device C compiler (for various microprocessors)" +HOMEPAGE="https://sdcc.sourceforge.net/" if [[ ${PV} == "9999" ]] ; then ESVN_REPO_URI="https://svn.code.sf.net/p/sdcc/code/trunk/sdcc" @@ -16,9 +19,11 @@ else KEYWORDS="~amd64 ~x86" fi - -DESCRIPTION="Small device C compiler (for various microprocessors)" -HOMEPAGE="https://sdcc.sourceforge.net/" +BINUTILS_PV=2.45.1 +SRC_URI+=" + mirror://gnu/binutils/binutils-${BINUTILS_PV}.tar.xz + https://sourceware.org/pub/binutils/releases/binutils-${BINUTILS_PV}.tar.xz +" LICENSE=" GPL-2 ZLIB @@ -34,7 +39,7 @@ SDCC_PORTS=" sm83 tlcs90 ez80-z80 - z80n + z80n r800 ds390 ds400 pic14 pic16 hc08 @@ -42,6 +47,7 @@ SDCC_PORTS=" stm8 pdk13 pdk14 pdk15 pdk16 mos6502 mos65c02 + f8 " IUSE=" ${SDCC_PORTS} @@ -63,8 +69,18 @@ DEPEND=" " PATCHES=( "${FILESDIR}"/sdcc-4.3.2-override-override.patch + "${FILESDIR}"/sdcc-4.5.0-link-tinfo.patch + "${FILESDIR}"/sdcc-4.3.0-fix-mkdir-autoconf-test.patch + "${FILESDIR}"/sdcc-4.3.0-autoreconf-libiberty.patch ) +src_unpack() { + if [[ ${PV} == "9999" ]] ; then + subversion_src_unpack + fi + default +} + src_prepare() { # Fix conflicting variable names between Gentoo and sdcc find device/lib/pic{14,16} device/non-free/lib/pic{14,16} \( \ @@ -85,8 +101,37 @@ src_prepare() { mkdir -p support/sdbinutils/bfd/doc || die + # add m4 files from binutils to run autoreconf for libiberty + cp "${WORKDIR}"/binutils-${BINUTILS_PV}/libiberty/acinclude.m4 support/sdbinutils/libiberty/acinclude.m4 || die + cp "${WORKDIR}"/binutils-${BINUTILS_PV}/config/mmap.m4 support/sdbinutils/config/mmap.m4 || die + # libiberty configure will check this file and fail if not found + cp install-sh support/sdbinutils/libiberty/ || die + # libiberty configure will fail if this was not set + export libiberty_topdir="${S}"/support/sdbinutils/libiberty + default - eautoreconf + + # Upstream moved sim/ucsim to sim/ucsim/src and added some wrappers in sim/ucsim. + # Now eautoreconf needs to run in sim/ucsim/src, but configure needs to run in sim/ucsim. + # Run eautoreconf manually where it is needed and leave econf do its thing. + local dirs=( + support/cpp + support/packihx + sim/ucsim/src + debugger/mcs51 + support/sdbinutils + support/sdbinutils/libiberty + device/lib/pic14 + device/non-free/lib/pic14 + device/lib/pic16 + device/non-free/lib/pic16 + ) + for i in "${dirs[@]}"; do + pushd "$i" &> /dev/null || die + AT_NOELIBTOOLIZE=yes eautoreconf + popd &> /dev/null || die + done + AT_NO_RECURSIVE=yes eautoreconf # Avoid 'bfd.info' rebuild with 'makeinfo': bug #705424 # Build dependencies are: eautoreconf->Makefile.in->bfdver.texi->bfd.info @@ -95,17 +140,15 @@ src_prepare() { } src_configure() { - # -Werror=odr, -Werror=lto-type-mismatch - # https://bugs.gentoo.org/924691 - # https://sourceforge.net/p/sdcc/bugs/3725/ - filter-lto - + # bug #922301 + tc-export CC CPP local myeconfargs=( ac_cv_prog_STRIP=true --without-ccache --enable-sdbinutils $(use_enable ucsim) + $(use_enable device-lib) $(use_enable packihx) $(use_enable sdcpp) @@ -123,6 +166,7 @@ src_configure() { $(use_enable tlcs90 tlcs90-port) $(use_enable ez80-z80 ez80_z80-port) $(use_enable z80n z80n-port) + $(use_enable r800 r800-port) $(use_enable ds390 ds390-port) $(use_enable ds400 ds400-port) $(use_enable pic14 pic14-port) @@ -136,7 +180,17 @@ src_configure() { $(use_enable pdk16 pdk16-port) $(use_enable mos6502 mos6502-port) $(use_enable mos65c02 mos65c02-port) + $(use_enable f8 f8-port) ) + + # ucsim has extra sims that do not correspond to USE flags; enable them all. + if use ucsim; then + myeconfargs+=( --enable-serio ) + for i in avr st7 p1516 m6809 m6800 m68hc11 m68hc12 pblaze i8085 i8048 oisc; do + myeconfargs+=( --enable-$i-sim ) + done + fi + econf "${myeconfargs[@]}" } @@ -157,6 +211,9 @@ src_install() { dodoc doc/*.txt find "${ED}" -type d -name .deps -exec rm -vr {} + || die + # make install does not install this + use ucsim && dobin sim/ucsim/src/apps/serio.src/serialview + if use doc && [[ ${PV} != "9999" ]]; then cd "${WORKDIR}"/doc dodoc -r *