Skip to content

Commit 937f13b

Browse files
authored
webOS: build wayland by default for GLES 3 version, add webOS TV version to logs (libretro#18571)
* webOS: enable wayland by default for GLES 3 binary, keep GLES 2 without wayland * webOS: add webOS TV version to log and system information screen
1 parent 039c919 commit 937f13b

File tree

3 files changed

+136
-7
lines changed

3 files changed

+136
-7
lines changed

.github/workflows/webOS.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,28 +68,32 @@ jobs:
6868
RARCH_VERSION=$(grep -Po '(?<=#define PACKAGE_VERSION ")[^"]+' version.all)
6969
echo "RARCH_VERSION=$RARCH_VERSION" >> "$GITHUB_ENV"
7070
71-
- name: Compile RA (GLES3 variant)
71+
- name: Compile RA (GLES3 and Wayland variant)
7272
shell: bash
7373
run: |
7474
. /tmp/arm-webos-linux-gnueabi_sdk-buildroot/environment-setup
75+
export SDK_PATH=/tmp/arm-webos-linux-gnueabi_sdk-buildroot
7576
make -f Makefile.webos clean
77+
bash gfx/common/wayland/generate_wayland_protos.sh
7678
make -f Makefile.webos ipk PACKAGE_NAME=${PACKAGE_NAME} ADD_SDL2_LIB=1 \
79+
HAVE_XKBCOMMON=1 HAVE_USERLAND=1 HAVE_EGL=1 HAVE_WAYLAND=1 \
7780
HAVE_OPENGLES3=1 HAVE_OPENGLES3_1=1 HAVE_OPENGLES3_2=1 -j"$(getconf _NPROCESSORS_ONLN)"
7881
mv webos/com.retroarch.webos_${RARCH_VERSION}_arm.ipk \
79-
webos/com.retroarch.webos.gles3_${RARCH_VERSION}_arm.ipk
82+
webos/com.retroarch.webos.gles3w_${RARCH_VERSION}_arm.ipk
8083
env:
8184
DEBUG: ${{ github.event_name == 'release' && '0' || '1' }}
8285

83-
- name: Upload GLES3 artifact
86+
- name: Upload GLES3 and Wayland artifact
8487
uses: actions/upload-artifact@v4
8588
with:
86-
name: com.retroarch.webos.gles3_${{ env.RARCH_VERSION }}_${{ github.sha }}_arm.ipk
87-
path: webos/com.retroarch.webos.gles3_${{ env.RARCH_VERSION }}_arm.ipk
89+
name: com.retroarch.webos.gles3w_${{ env.RARCH_VERSION }}_${{ github.sha }}_arm.ipk
90+
path: webos/com.retroarch.webos.gles3w_${{ env.RARCH_VERSION }}_arm.ipk
8891

8992
- name: Compile RA (default)
9093
shell: bash
9194
run: |
9295
. /tmp/arm-webos-linux-gnueabi_sdk-buildroot/environment-setup
96+
make -f Makefile.webos clean
9397
make -f Makefile.webos ipk PACKAGE_NAME=${PACKAGE_NAME} ADD_SDL2_LIB=1 -j"$(getconf _NPROCESSORS_ONLN)"
9498
env:
9599
DEBUG: ${{ github.event_name == 'release' && '0' || '1' }}
@@ -121,5 +125,5 @@ jobs:
121125
omitPrereleaseDuringUpdate: true
122126
artifacts: |
123127
webos/com.retroarch.webos_${{ env.RARCH_VERSION }}_arm.ipk
124-
webos/com.retroarch.webos.gles3_${{ env.RARCH_VERSION }}_arm.ipk
128+
webos/com.retroarch.webos.gles3w_${{ env.RARCH_VERSION }}_arm.ipk
125129
webos/${{ env.PACKAGE_NAME }}.manifest.json

frontend/drivers/platform_unix.c

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,110 @@ static enum frontend_architecture frontend_unix_get_arch(void)
12991299
return FRONTEND_ARCH_NONE;
13001300
}
13011301

1302+
#ifdef WEBOS
1303+
const char *retroarch_get_webos_version(char *s, size_t len,
1304+
int *major, int *minor)
1305+
{
1306+
static char pretty[128];
1307+
1308+
FILE *f = fopen("/usr/lib/os-release", "r");
1309+
if (!f)
1310+
{
1311+
/* fallback to starfish-release */
1312+
f = fopen("/etc/starfish-release", "r");
1313+
if (!f)
1314+
return strlcpy(s, "webOS (unknown)", len), "webOS (unknown)";
1315+
1316+
/* Example content:
1317+
Rockhopper release 3.9.0-62709 (dreadlocks2-dudhwa) */
1318+
char line[256];
1319+
if (fgets(line, sizeof(line), f))
1320+
{
1321+
char *nl = strchr(line, '\n');
1322+
if (nl) *nl = '\0';
1323+
snprintf(pretty, sizeof(pretty), "webOS - %s", line);
1324+
1325+
/* Try parse after the word "release", else first digit run in the line */
1326+
char *ver = strstr(line, "release");
1327+
if (ver)
1328+
{
1329+
ver += strlen("release");
1330+
while (*ver == ' ') ver++;
1331+
}
1332+
else
1333+
{
1334+
/* find first digit in the line */
1335+
ver = line;
1336+
while (*ver && ((*ver < '0') || (*ver > '9'))) ver++;
1337+
if (!*ver) ver = NULL;
1338+
}
1339+
1340+
if (ver)
1341+
{
1342+
char *endptr = NULL;
1343+
long maj = strtol(ver, &endptr, 10);
1344+
if (endptr != ver)
1345+
{
1346+
if (major) *major = (int)maj;
1347+
if (endptr && *endptr == '.' && minor)
1348+
{
1349+
long min = strtol(endptr + 1, NULL, 10);
1350+
/* only set minor if a number was present */
1351+
const char *p = endptr + 1;
1352+
if (p && (*p >= '0' && *p <= '9'))
1353+
*minor = (int)min;
1354+
}
1355+
}
1356+
}
1357+
}
1358+
fclose(f);
1359+
1360+
if (pretty[0] == '\0')
1361+
strlcpy(pretty, "webOS (unknown)", sizeof(pretty));
1362+
1363+
return strlcpy(s, pretty, len), pretty;
1364+
}
1365+
1366+
char line[256];
1367+
while (fgets(line, sizeof(line), f))
1368+
{
1369+
if (strncmp(line, "PRETTY_NAME=", 12) == 0)
1370+
{
1371+
char *val = line + 12;
1372+
char *nl = strchr(val, '\n');
1373+
if (nl) *nl = '\0';
1374+
if ((val[0] == '"' || val[0] == '\'')) {
1375+
size_t l = strlen(val);
1376+
if (l > 1 && val[l-1] == val[0]) {
1377+
val[l-1] = '\0';
1378+
val++;
1379+
}
1380+
}
1381+
strlcpy(pretty, val, sizeof(pretty));
1382+
}
1383+
else if (strncmp(line, "VERSION_ID=", 11) == 0)
1384+
{
1385+
char *val = line + 11;
1386+
char *nl = strchr(val, '\n');
1387+
if (nl) *nl = '\0';
1388+
char *endptr = NULL;
1389+
long maj = strtol(val, &endptr, 10);
1390+
if (major) *major = (int)maj;
1391+
if (endptr && *endptr == '.' && minor)
1392+
*minor = (int)strtol(endptr+1, NULL, 10);
1393+
else if (minor)
1394+
*minor = 0;
1395+
}
1396+
}
1397+
fclose(f);
1398+
1399+
if (pretty[0] == '\0')
1400+
strlcpy(pretty, "webOS (unknown)", sizeof(pretty));
1401+
1402+
return strlcpy(s, pretty, len), pretty;
1403+
}
1404+
#endif
1405+
13021406
static size_t frontend_unix_get_os(char *s,
13031407
size_t len, int *major, int *minor)
13041408
{
@@ -1326,6 +1430,8 @@ static size_t frontend_unix_get_os(char *s,
13261430
_len = strlcpy(s, "BSD", len);
13271431
#elif defined(__HAIKU__)
13281432
_len = strlcpy(s, "Haiku", len);
1433+
#elif defined(WEBOS)
1434+
_len = strlcpy(s, retroarch_get_webos_version(s, len, major, minor), len);
13291435
#else
13301436
_len = strlcpy(s, "Linux", len);
13311437
#endif

retroarch.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7876,12 +7876,31 @@ bool retroarch_main_init(int argc, char *argv[])
78767876
if (verbosity_enabled)
78777877
{
78787878
{
7879-
char str_output[256];
7879+
char str_output[384];
78807880
const char *cpu_model = frontend_driver_get_cpu_model_name();
78817881
size_t _len = strlcpy(str_output,
78827882
"=== Build =======================================\n",
78837883
sizeof(str_output));
78847884

7885+
#ifdef WEBOS
7886+
{
7887+
char osbuf[128];
7888+
int major = 0, minor = 0;
7889+
frontend_state_t *frontend_st = frontend_state_get_ptr();
7890+
if (frontend_st)
7891+
{
7892+
frontend_ctx_driver_t *frontend = frontend_st->current_frontend_ctx;
7893+
if (frontend && frontend->get_os)
7894+
{
7895+
frontend->get_os(osbuf, sizeof(osbuf), &major, &minor);
7896+
_len += snprintf(str_output + _len, sizeof(str_output) - _len,
7897+
FILE_PATH_LOG_INFO " Running on: %s\n",
7898+
osbuf);
7899+
}
7900+
}
7901+
}
7902+
#endif
7903+
78857904
if (!string_is_empty(cpu_model))
78867905
{
78877906
/* TODO/FIXME - localize */

0 commit comments

Comments
 (0)