#!/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 ==="