Add Docker cross-compilation for webOS ARM (glibc 2.28)
Debian buster base matches the TV's glibc version. Includes fake WEBOS_NDK wrapping standard cross-compiler, stub shared libraries for luna-service2 and glib-2.0, and a build script that produces a deployable ARM soft-float binary. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
dce4f172ca
commit
df271d738c
2 files changed
+82
No files matched your search
@@ -0,0 +1,36 @@
|
|||||||
|
FROM debian:buster-slim
|
||||||
|
|
||||||
|
# Buster is archived — point sources at archive.debian.org
|
||||||
|
RUN sed -i 's|deb.debian.org|archive.debian.org|g; s|security.debian.org|archive.debian.org|g; /buster-updates/d' /etc/apt/sources.list && \
|
||||||
|
apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
curl ca-certificates pkg-config cmake git \
|
||||||
|
gcc libc6-dev gcc-arm-linux-gnueabi binutils-arm-linux-gnueabi libc6-dev-armel-cross \
|
||||||
|
python3 \
|
||||||
|
xz-utils && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Node.js 20 binary (supports glibc 2.28+, has import.meta.dirname)
|
||||||
|
RUN curl -fsSL https://nodejs.org/dist/v20.18.1/node-v20.18.1-linux-x64.tar.xz | \
|
||||||
|
tar -xJ --strip-components=1 -C /usr/local && \
|
||||||
|
npm install -g pnpm@9
|
||||||
|
|
||||||
|
# Rust with ARM soft-float target
|
||||||
|
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
|
||||||
|
sh -s -- -y --default-toolchain stable --profile minimal && \
|
||||||
|
. /root/.cargo/env && \
|
||||||
|
rustup target add armv7-unknown-linux-gnueabi
|
||||||
|
|
||||||
|
# Create a fake WEBOS_NDK that wraps the standard cross-compiler
|
||||||
|
RUN mkdir -p /opt/webos-ndk/bin && \
|
||||||
|
ln -s /usr/bin/arm-linux-gnueabi-gcc /opt/webos-ndk/bin/arm-webos-linux-gnueabi-gcc && \
|
||||||
|
ln -s /usr/bin/arm-linux-gnueabi-ar /opt/webos-ndk/bin/arm-webos-linux-gnueabi-ar && \
|
||||||
|
ln -s /usr/bin/arm-linux-gnueabi-strip /opt/webos-ndk/bin/arm-webos-linux-gnueabi-strip && \
|
||||||
|
mkdir -p /opt/webos-ndk/arm-webos-linux-gnueabi/sysroot/usr/include && \
|
||||||
|
cp -a /usr/arm-linux-gnueabi/include/* /opt/webos-ndk/arm-webos-linux-gnueabi/sysroot/usr/include/ && \
|
||||||
|
mkdir -p /opt/webos-ndk/arm-webos-linux-gnueabi/sysroot/usr/lib && \
|
||||||
|
cp -a /usr/arm-linux-gnueabi/lib/* /opt/webos-ndk/arm-webos-linux-gnueabi/sysroot/usr/lib/
|
||||||
|
|
||||||
|
ENV WEBOS_NDK=/opt/webos-ndk
|
||||||
|
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
Executable
+46
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
CC=/usr/bin/arm-linux-gnueabi-gcc
|
||||||
|
STUBDIR=/usr/arm-linux-gnueabi/lib
|
||||||
|
|
||||||
|
echo "=== Creating webOS stub libraries ==="
|
||||||
|
|
||||||
|
cat > /tmp/luna-stub.c << 'STUBEOF'
|
||||||
|
typedef int gint;
|
||||||
|
typedef unsigned int guint;
|
||||||
|
typedef void* gpointer;
|
||||||
|
int LSErrorInit(void *e) { return 1; }
|
||||||
|
void LSErrorFree(void *e) {}
|
||||||
|
int LSRegister(const char *n, void **h, void *e) { return 1; }
|
||||||
|
int LSUnregister(void *h, void *e) { return 1; }
|
||||||
|
int LSGmainContextAttach(void *h, void *c, void *e) { return 1; }
|
||||||
|
int LSCallOneReply(void *h, const char *u, const char *p, void *cb, void *ud, unsigned long *t, void *e) { return 1; }
|
||||||
|
int LSCallCancel(void *h, unsigned long t, void *e) { return 1; }
|
||||||
|
const char* LSMessageGetPayload(void *m) { return "{}"; }
|
||||||
|
STUBEOF
|
||||||
|
$CC -shared -o $STUBDIR/libluna-service2.so /tmp/luna-stub.c
|
||||||
|
echo " Created libluna-service2.so stub"
|
||||||
|
|
||||||
|
cat > /tmp/glib-stub.c << 'STUBEOF'
|
||||||
|
void* g_main_context_new(void) { return (void*)0; }
|
||||||
|
int g_main_context_iteration(void *ctx, int may_block) { return 0; }
|
||||||
|
void g_main_context_unref(void *ctx) {}
|
||||||
|
STUBEOF
|
||||||
|
$CC -shared -o $STUBDIR/libglib-2.0.so /tmp/glib-stub.c
|
||||||
|
echo " Created libglib-2.0.so stub"
|
||||||
|
|
||||||
|
echo "=== Installing npm deps ==="
|
||||||
|
pnpm install --frozen-lockfile 2>&1 | tail -5 || true
|
||||||
|
|
||||||
|
echo "=== Preparing SDL-webOS runtime ==="
|
||||||
|
node tools/webos-runtime.mjs 2>&1 | tail -5
|
||||||
|
|
||||||
|
echo "=== Building for webOS ARM ==="
|
||||||
|
sh tools/build-webos.sh 2>&1 | tail -30
|
||||||
|
|
||||||
|
echo "=== Build result ==="
|
||||||
|
ls -la target/armv7-unknown-linux-gnueabi/release/luma
|
||||||
|
arm-linux-gnueabi-strip target/armv7-unknown-linux-gnueabi/release/luma
|
||||||
|
ls -la target/armv7-unknown-linux-gnueabi/release/luma
|
||||||
|
echo "=== Done ==="
|
||||||
Reference in new issue
Block a user