From fa31665768194f1429a21e790009d6e059ccadce Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Sat, 22 Feb 2025 22:43:05 +0100 Subject: [PATCH] Add m68k binutils and gcc and add dbztool --- .../dbztool/dbztool-2025.02.22.recipe | 46 ++++++ .../patches/dbztool-2025.02.22.patchset | 45 ++++++ .../m68k_elf_binutils-2.44.recipe | 153 ++++++++++++++++++ .../m68k_elf_gcc/m68k_elf_gcc-13.1.0.recipe | 123 ++++++++++++++ 4 files changed, 367 insertions(+) create mode 100644 dev-embedded/dbztool/dbztool-2025.02.22.recipe create mode 100644 dev-embedded/dbztool/patches/dbztool-2025.02.22.patchset create mode 100644 sys-devel/m68k_elf_binutils/m68k_elf_binutils-2.44.recipe create mode 100644 sys-devel/m68k_elf_gcc/m68k_elf_gcc-13.1.0.recipe diff --git a/dev-embedded/dbztool/dbztool-2025.02.22.recipe b/dev-embedded/dbztool/dbztool-2025.02.22.recipe new file mode 100644 index 000000000..2b5ec471b --- /dev/null +++ b/dev-embedded/dbztool/dbztool-2025.02.22.recipe @@ -0,0 +1,46 @@ +SUMMARY="Motorola Dragonball bootstrap tool" +DESCRIPTION="Command-line tool for manipulating the bootstrap interface of a Dragonball VZ \ +processor. It allows you to upload and download data, run programs, examine and modify the \ +system registers, etc. Currently it's only been tested on the Alphasmart Dana but it should \ +work on other machines too (although a number of places in the code assume you're using UART1, \ +which need to be fixed)." +HOMEPAGE="https://github.com/davidgiven/dbztool" +COPYRIGHT="2021 David Given" +LICENSE="BSD (2-clause)" +SOURCE_URI="https://github.com/davidgiven/dbztool/archive/742153af9333afdcee1d47b554afa56d5791dbfb.tar.gz" +SOURCE_DIR="dbztool-742153af9333afdcee1d47b554afa56d5791dbfb" +CHECKSUM_SHA256="e33526550ece3a0d0231d0dccb1d9ecf1a4bc9cd531d8096bac0d102159a6947" +REVISION="1" +PATCHES="dbztool-$portVersion.patchset" + +ARCHITECTURES="all" + +PROVIDES=" + dbztool$secondaryArchSuffix = $portVersion + cmd:dbztool$secondaryArchSuffix = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + " +BUILD_PREREQUIRES=" + cmd:gcc$secondaryArchSuffix + cmd:m68k_elf_gcc + cmd:make + cmd:ninja + cmd:xxd + " + +BUILD() +{ + make $jobArgs +} + +INSTALL() +{ + mkdir -p $binDir + cp dbztool $binDir +} diff --git a/dev-embedded/dbztool/patches/dbztool-2025.02.22.patchset b/dev-embedded/dbztool/patches/dbztool-2025.02.22.patchset new file mode 100644 index 000000000..ffaf5b65a --- /dev/null +++ b/dev-embedded/dbztool/patches/dbztool-2025.02.22.patchset @@ -0,0 +1,45 @@ +From 5520861ac4bb11bf683309cc7d07c5722774187e Mon Sep 17 00:00:00 2001 +From: PulkoMandy +Date: Sat, 22 Feb 2025 22:39:29 +0100 +Subject: Adjust for Haiku + +- Link against libbsd for cfsetspeed +- Remove FNM_EXTMATCH (unsupported in Haiku) +- Adjust name of m68k C compiler + +diff --git a/Makefile b/Makefile +index 4111755..7daa2b5 100644 +--- a/Makefile ++++ b/Makefile +@@ -4,11 +4,11 @@ export CXX = g++ + export AR = ar rc + export RANLIB = ranlib + export STRIP = strip +-export LIBS = ++export LIBS = -lbsd + +-export CC68K = m68k-linux-gnu-gcc +-export LD68K = m68k-linux-gnu-ld +-export OBJCOPY68K = m68k-linux-gnu-objcopy ++export CC68K = m68k-elf-gcc ++export LD68K = m68k-elf-ld ++export OBJCOPY68K = m68k-elf-objcopy + + export C68KFLAGS = -g -Os -fomit-frame-pointer -march=68000 + export OBJDIR = .obj +diff --git a/src/mc68328.cc b/src/mc68328.cc +index 77f7ae8..e4cd165 100644 +--- a/src/mc68328.cc ++++ b/src/mc68328.cc +@@ -173,7 +173,7 @@ bool foreach_register(const char* glob, std::function haiku_host.h + + CXXFLAGS="-O2 -include $objectsDir/haiku_host.h -fPIC" \ + CFLAGS="-O2 -U_FORTIFY_SOURCE -fPIC" "$sourceDir/configure" \ + --build=$effectiveTargetMachineTriple \ + --prefix=$installDir --libexecdir=$installDir/lib --mandir=$manDir \ + --docdir=$docDir --disable-nls --with-gnu-ld \ + --enable-languages=c,c++ --enable-lto --enable-frame-pointer \ + --enable-multilib --disable-shared \ + --without-headers --with-newlib \ + --with-sysroot=$installDir \ + --with-native-system-header-dir=/include \ + --with-pkgversion=$(echo $portVersion | cut -c 7-) --target=$targetArch + + echo "configure done, start build" + make $jobArgs all-gcc all-target-libgcc +} + +INSTALL() +{ + cd $objectsDir + + make install-gcc install-target-libgcc + + ### Symlinks ############################################## + + echo "Creating required symlinks" + + # make all tools available via default paths + mkdir -p $prefix/bin + for f in c++ cc cpp g++ gcc gcov; do + symlinkRelative -sfn $installDir/bin/$targetArch-$f $prefix/bin + done + + ### Cleanup ############################################### + + echo "Cleanup" + rm -rf $installDir/info + rm -rf $installDir/share +}