Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/webOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,32 @@ jobs:
RARCH_VERSION=$(grep -Po '(?<=#define PACKAGE_VERSION ")[^"]+' version.all)
echo "RARCH_VERSION=$RARCH_VERSION" >> "$GITHUB_ENV"

- name: Compile RA (GLES3 variant)
- name: Compile RA (GLES3 and Wayland variant)
shell: bash
run: |
. /tmp/arm-webos-linux-gnueabi_sdk-buildroot/environment-setup
export SDK_PATH=/tmp/arm-webos-linux-gnueabi_sdk-buildroot
make -f Makefile.webos clean
bash gfx/common/wayland/generate_wayland_protos.sh
make -f Makefile.webos ipk PACKAGE_NAME=${PACKAGE_NAME} ADD_SDL2_LIB=1 \
HAVE_XKBCOMMON=1 HAVE_USERLAND=1 HAVE_EGL=1 HAVE_WAYLAND=1 \
HAVE_OPENGLES3=1 HAVE_OPENGLES3_1=1 HAVE_OPENGLES3_2=1 -j"$(getconf _NPROCESSORS_ONLN)"
mv webos/com.retroarch.webos_${RARCH_VERSION}_arm.ipk \
webos/com.retroarch.webos.gles3_${RARCH_VERSION}_arm.ipk
webos/com.retroarch.webos.gles3w_${RARCH_VERSION}_arm.ipk
env:
DEBUG: ${{ github.event_name == 'release' && '0' || '1' }}

- name: Upload GLES3 artifact
- name: Upload GLES3 and Wayland artifact
uses: actions/upload-artifact@v4
with:
name: com.retroarch.webos.gles3_${{ env.RARCH_VERSION }}_${{ github.sha }}_arm.ipk
path: webos/com.retroarch.webos.gles3_${{ env.RARCH_VERSION }}_arm.ipk
name: com.retroarch.webos.gles3w_${{ env.RARCH_VERSION }}_${{ github.sha }}_arm.ipk
path: webos/com.retroarch.webos.gles3w_${{ env.RARCH_VERSION }}_arm.ipk

- name: Compile RA (default)
shell: bash
run: |
. /tmp/arm-webos-linux-gnueabi_sdk-buildroot/environment-setup
make -f Makefile.webos clean
make -f Makefile.webos ipk PACKAGE_NAME=${PACKAGE_NAME} ADD_SDL2_LIB=1 -j"$(getconf _NPROCESSORS_ONLN)"
env:
DEBUG: ${{ github.event_name == 'release' && '0' || '1' }}
Expand Down Expand Up @@ -121,5 +125,5 @@ jobs:
omitPrereleaseDuringUpdate: true
artifacts: |
webos/com.retroarch.webos_${{ env.RARCH_VERSION }}_arm.ipk
webos/com.retroarch.webos.gles3_${{ env.RARCH_VERSION }}_arm.ipk
webos/com.retroarch.webos.gles3w_${{ env.RARCH_VERSION }}_arm.ipk
webos/${{ env.PACKAGE_NAME }}.manifest.json
106 changes: 106 additions & 0 deletions frontend/drivers/platform_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,110 @@ static enum frontend_architecture frontend_unix_get_arch(void)
return FRONTEND_ARCH_NONE;
}

#ifdef WEBOS
const char *retroarch_get_webos_version(char *s, size_t len,
int *major, int *minor)
{
static char pretty[128];

FILE *f = fopen("/usr/lib/os-release", "r");
if (!f)
{
/* fallback to starfish-release */
f = fopen("/etc/starfish-release", "r");
if (!f)
return strlcpy(s, "webOS (unknown)", len), "webOS (unknown)";

/* Example content:
Rockhopper release 3.9.0-62709 (dreadlocks2-dudhwa) */
char line[256];
if (fgets(line, sizeof(line), f))
{
char *nl = strchr(line, '\n');
if (nl) *nl = '\0';
snprintf(pretty, sizeof(pretty), "webOS - %s", line);

/* Try parse after the word "release", else first digit run in the line */
char *ver = strstr(line, "release");
if (ver)
{
ver += strlen("release");
while (*ver == ' ') ver++;
}
else
{
/* find first digit in the line */
ver = line;
while (*ver && ((*ver < '0') || (*ver > '9'))) ver++;
if (!*ver) ver = NULL;
}

if (ver)
{
char *endptr = NULL;
long maj = strtol(ver, &endptr, 10);
if (endptr != ver)
{
if (major) *major = (int)maj;
if (endptr && *endptr == '.' && minor)
{
long min = strtol(endptr + 1, NULL, 10);
/* only set minor if a number was present */
const char *p = endptr + 1;
if (p && (*p >= '0' && *p <= '9'))
*minor = (int)min;
}
}
}
}
fclose(f);

if (pretty[0] == '\0')
strlcpy(pretty, "webOS (unknown)", sizeof(pretty));

return strlcpy(s, pretty, len), pretty;
}

char line[256];
while (fgets(line, sizeof(line), f))
{
if (strncmp(line, "PRETTY_NAME=", 12) == 0)
{
char *val = line + 12;
char *nl = strchr(val, '\n');
if (nl) *nl = '\0';
if ((val[0] == '"' || val[0] == '\'')) {
size_t l = strlen(val);
if (l > 1 && val[l-1] == val[0]) {
val[l-1] = '\0';
val++;
}
}
strlcpy(pretty, val, sizeof(pretty));
}
else if (strncmp(line, "VERSION_ID=", 11) == 0)
{
char *val = line + 11;
char *nl = strchr(val, '\n');
if (nl) *nl = '\0';
char *endptr = NULL;
long maj = strtol(val, &endptr, 10);
if (major) *major = (int)maj;
if (endptr && *endptr == '.' && minor)
*minor = (int)strtol(endptr+1, NULL, 10);
else if (minor)
*minor = 0;
}
}
fclose(f);

if (pretty[0] == '\0')
strlcpy(pretty, "webOS (unknown)", sizeof(pretty));

return strlcpy(s, pretty, len), pretty;
}
#endif

static size_t frontend_unix_get_os(char *s,
size_t len, int *major, int *minor)
{
Expand Down Expand Up @@ -1326,6 +1430,8 @@ static size_t frontend_unix_get_os(char *s,
_len = strlcpy(s, "BSD", len);
#elif defined(__HAIKU__)
_len = strlcpy(s, "Haiku", len);
#elif defined(WEBOS)
_len = strlcpy(s, retroarch_get_webos_version(s, len, major, minor), len);
#else
_len = strlcpy(s, "Linux", len);
#endif
Expand Down
21 changes: 20 additions & 1 deletion retroarch.c
Original file line number Diff line number Diff line change
Expand Up @@ -7876,12 +7876,31 @@ bool retroarch_main_init(int argc, char *argv[])
if (verbosity_enabled)
{
{
char str_output[256];
char str_output[384];
const char *cpu_model = frontend_driver_get_cpu_model_name();
size_t _len = strlcpy(str_output,
"=== Build =======================================\n",
sizeof(str_output));

#ifdef WEBOS
{
char osbuf[128];
int major = 0, minor = 0;
frontend_state_t *frontend_st = frontend_state_get_ptr();
if (frontend_st)
{
frontend_ctx_driver_t *frontend = frontend_st->current_frontend_ctx;
if (frontend && frontend->get_os)
{
frontend->get_os(osbuf, sizeof(osbuf), &major, &minor);
_len += snprintf(str_output + _len, sizeof(str_output) - _len,
FILE_PATH_LOG_INFO " Running on: %s\n",
osbuf);
}
}
}
#endif

if (!string_is_empty(cpu_model))
{
/* TODO/FIXME - localize */
Expand Down
Loading