Skip to content

Commit

Permalink
MIYOO: Add new toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
lephilousophe committed Mar 18, 2023
1 parent 6619cfa commit 6626ed8
Show file tree
Hide file tree
Showing 6 changed files with 275 additions and 0 deletions.
19 changes: 19 additions & 0 deletions buildbot-config/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,25 @@ def macosx_i386():
register_platform(platform)
macosx_i386()

def miyoo():
platform = Platform("miyoo")
platform.compatibleBuilds = (builds.ScummVMBuild, )
platform.configureargs.append("--host=miyoo")
platform.buildconfigureargs = {
builds.ScummVMBuild: [ "--disable-detection-full", "--enable-plugins", "--default-dynamic" ],
}
platform.packaging_cmd = "sd-root"
platform.built_files = {
builds.ScummVMBuild: [ "sd-root/games", "sd-root/gmenu2x" ],
}
platform.archiveext = "tar.xz"

platform.description = "Miyoo"
platform.icon = 'miyoo'

register_platform(platform)
miyoo()

def nds():
platform = Platform("nds")
platform.workerimage = "devkitnds"
Expand Down
10 changes: 10 additions & 0 deletions check-versions/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,16 @@
# Latest crosstool-ng doesn't support uClibc anymore
('./toolchains/gcw0/packages/toolchain/build.sh', 'CT_NG'): 'ignore',

('./toolchains/miyoo/packages/toolchain/build.sh', 'MIYOO'): {
'check': 'git tag',
'repository': 'https://github.com/steward-fu/miyoo.git',
'prefix': 'v',
# There are 3 tags per version with .0 being the toolchain config
'pattern': r'.*0$',
},
# This version is set by toolchain configuration
('./toolchains/miyoo/packages/toolchain/build.sh', 'BUILDROOT'): 'ignore',

('./toolchains/mxe/Dockerfile.m4', 'MXE'): {
'check': 'git tag',
'repository': 'https://github.com/mxe/mxe.git',
Expand Down
71 changes: 71 additions & 0 deletions toolchains/miyoo/Dockerfile.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
m4_include(`paths.m4')m4_dnl
m4_include(`packages.m4')m4_dnl

m4_dnl Include Debian base preparation steps
m4_dnl This ensures all common steps are shared by all toolchains
m4_include(`debian-toolchain-base.m4')m4_dnl

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
bc \
cpio \
rsync \
g++ && \
rm -rf /var/lib/apt/lists/*

ENV MIYOO_ROOT=/opt/miyoo HOST=arm-miyoo-linux-uclibcgnueabi

local_package(toolchain)

ENV PREFIX=${MIYOO_ROOT}/${HOST}/sysroot/usr

# Use configure CFLAGS
ENV \
def_binaries(`${MIYOO_ROOT}/bin/${HOST}-', `ar, as, c++filt, ld, nm, objcopy, objdump, ranlib, readelf, strings, strip') \
def_binaries(`${MIYOO_ROOT}/bin/${HOST}-', `gcc, cpp, c++') \
CC=${MIYOO_ROOT}/bin/$HOST-gcc \
def_aclocal(`${PREFIX}') \
def_pkg_config(`${PREFIX}') \
PKG_CONFIG_SYSROOT_DIR=${MIYOO_ROOT}/${HOST}/sysroot \
PATH=$PATH:${PREFIX}/bin \
CFLAGS="-march=armv5te -mtune=arm926ej-s -ffast-math -fomit-frame-pointer -ffunction-sections -fdata-sections" \
CXXFLAGS="-march=armv5te -mtune=arm926ej-s -ffast-math -fomit-frame-pointer -ffunction-sections -fdata-sections" \
LDFLAGS="-Wl,--as-needed,--gc-sections"

# zlib is already installed in original toolchain

# libpng is already installed in original toolchain

# libjpeg is already installed in original toolchain

# giflib is already installed in original toolchain

# libmad is already installed in original toolchain

# libogg is already installed in original toolchain

# libvorbis is already installed in original toolchain

# libvorbisidec is already installed in original toolchain

# libtheora is already installed in original toolchain

# flac is already installed in original toolchain

helpers_package(faad2)

helpers_package(mpeg2dec)

helpers_package(a52dec)

# curl is already installed in original toolchain

# freetype is already installed in original toolchain

# fribidi is already installed in original toolchain

# sdl is already installed in original toolchain

# sdl_net is already installed in original toolchain

helpers_package(fluidlite)
104 changes: 104 additions & 0 deletions toolchains/miyoo/packages/toolchain/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#! /bin/sh

MIYOO_VERSION=1.0
# This version depends on Miyoo devel package
BUILDROOT_VERSION=2018.02.9

PACKAGE_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
HELPERS_DIR=$PACKAGE_DIR/../..
. $HELPERS_DIR/functions.sh

do_make_bdir

do_http_fetch devel "https://github.com/steward-fu/miyoo/releases/download/v${MIYOO_VERSION}/devel.zip" 'unzip'
cd ..

do_http_fetch buildroot- "https://buildroot.org/downloads/buildroot-${BUILDROOT_VERSION}.tar.gz" 'tar xzf'
do_patch buildroot

num_cpus=$(nproc || grep -c ^processor /proc/cpuinfo || echo 1)
MAKEOPTS="-j${num_cpus}"

# We will cleanup defconfig to have a small build just enough for us
WHITELIST=$(cat <<-"EOF"
UCLIBC
BUSYBOX.*
BZIP2
GETTEXT
MESA3D.*
SDL
SDL_FBCON
SDL_NET
SDL2
SDL2_X11
SDL2_NET
XORG7
XLIB_.*
ALSA_LIB.*
LIBMAD
LIBVORBIS
TREMOR
FREETYPE
GIFLIB
JPEG
LIBDRM.*
LIBGLU
LIBPNG
TSLIB
LIBTHEORA
LIBCURL
LIBFRIBIDI
LIBICONV
NCURSES.*
READLINE
LIBJPEG
EOF
)

lighten() {
# Update configuration
make olddefconfig

# Backup our full configuration
cp .config .config.full

# Build in our build directory
sed -i '/^BR2_HOST_DIR=.*/d' ".config"

# Remove all packages
sed -i '/^BR2_PACKAGE/d' ".config"
# Remove some other settings
sed -i 's/^BR2_TARGET_ROOTFS_TAR=y$/# BR2_TARGET_ROOTFS_TAR is not set/' ".config"
sed -i 's/^BR2_PACKAGE_HOST_PATCHELF=y$/# BR2_PACKAGE_HOST_PATCHELF is not set/' ".config"

# Add whitelisted packages which are already enabled
echo "$WHITELIST" | while read pkg; do
grep "^BR2_PACKAGE_$pkg=" ".config.full" >> ".config" || true
done

# It seems that the config file hasn't these enabled while the toolchain has
echo "BR2_PACKAGE_FLAC=y" >> ".config"
echo "BR2_PACKAGE_NCURSES_WCHAR=y" >> ".config"

# Fixup everything
make olddefconfig
}

cp ../devel/config_buildroot-${BUILDROOT_VERSION} .config

# Lighten build process by removing useless packages for us
lighten

FORCE_UNSAFE_CONFIGURE=1 make sdk

mkdir -p "$(basename "${MIYOO_ROOT}")"
mv output/host "${MIYOO_ROOT}"

cp .config "${MIYOO_ROOT}"/

"${MIYOO_ROOT}/relocate-sdk.sh"

# Cleanup the build
rm -rf output

do_clean_bdir
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From 9e2128bf5072e5f2fd69e2fc0239558782dfc677 Mon Sep 17 00:00:00 2001
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
Date: Wed, 4 Mar 2020 14:40:37 +0100
Subject: [PATCH] Makefile: work around a bug in newly released make 4.3

Several users of rolling-release distributions have been reporting on
IRC that Buildroot is broken now that they have switched to the newly
released make 4.3.

It turns out that the constructs we use to generated and include the
internal br2-external related fragments is no longer working with
make-4.3.

Indeed, an upstream bug report [0] seems to imply that it so far was
working by chance. There has been no further feedback, whether this is
really considered a fix for a previous ill-defined behaviour, or an
actual regression...

In the meantime, we add a workaround, suggested in that same bug report,
that fixes the issue for make 4.3, and that should not break on older
make versions either (verified on all relevant versions: from 3.81,
3.82, 4.0, 4.1, and 4.2).

[0] https://savannah.gnu.org/bugs/?57676

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Tested-by: Mircea Gliga <mgliga@bitdefender.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
Makefile | 3 +++
1 file changed, 3 insertions(+)

diff --git a/Makefile b/Makefile
index 31624f77a2d..09e769f6130 100644
--- a/Makefile
+++ b/Makefile
@@ -188,6 +188,9 @@ ifneq ($(BR2_EXTERNAL_ERROR),)
$(error $(BR2_EXTERNAL_ERROR))
endif

+# Workaround bug in make-4.3: https://savannah.gnu.org/bugs/?57676
+$(BASE_DIR)/.br-external.mk:;
+
# To make sure that the environment variable overrides the .config option,
# set this before including .config.
ifneq ($(BR2_DL_DIR),)
24 changes: 24 additions & 0 deletions workers/miyoo/Dockerfile.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM toolchains/miyoo AS toolchain

m4_include(`paths.m4')m4_dnl

m4_include(`debian-builder-base.m4')m4_dnl

ENV MIYOO_ROOT=/opt/miyoo HOST=arm-miyoo-linux-uclibcgnueabi

COPY --from=toolchain ${MIYOO_ROOT} ${MIYOO_ROOT}/

ENV PREFIX=${MIYOO_ROOT}/${HOST}/sysroot/usr

# We add PATH here for *-config and platform specific binaries
# *FLAGS are already set in configure script
ENV \
def_binaries(`${MIYOO_ROOT}/bin/${HOST}-', `ar, as, c++filt, ld, nm, objcopy, objdump, ranlib, readelf, strings, strip') \
def_binaries(`${MIYOO_ROOT}/bin/${HOST}-', `gcc, cpp, c++') \
CC=${MIYOO_ROOT}/bin/$HOST-gcc \
def_aclocal(`${PREFIX}') \
def_pkg_config(`${PREFIX}') \
PKG_CONFIG_SYSROOT_DIR=${MIYOO_ROOT}/${HOST}/sysroot \
PATH=$PATH:${PREFIX}/bin

m4_include(`run-buildbot.m4')m4_dnl

0 comments on commit 6626ed8

Please sign in to comment.