Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility Fix for webOS 1~3 #312

Merged
merged 7 commits into from
Sep 19, 2023
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ get_filename_component(CC_BASENAME ${CMAKE_C_COMPILER} NAME)

if (CMAKE_C_COMPILER_TARGET STREQUAL "arm-webos-linux-gnueabi")
set(TARGET_WEBOS ON)
set(TARGET_WEBOS_ARCH "arm")
elseif(CMAKE_C_COMPILER_TARGET MATCHES "(i[3-6]86)-webos-linux-gnu")
set(TARGET_WEBOS ON)
set(TARGET_WEBOS_ARCH ${CMAKE_MATCH_1})
elseif (CMAKE_C_COMPILER_TARGET STREQUAL "armv7a-cros-linux-gnueabi")
set(TARGET_STEAMLINK ON)
endif ()
Expand Down Expand Up @@ -128,6 +132,7 @@ set(BUILD_SHARED_CORE_LIBS OFF)

if (TARGET_WEBOS)
set(CMAKE_INSTALL_LIBDIR lib/backports)
set(SDL2_BACKPORT_REVISION "2876d3b86c2e3c5700003dfbf3a978be17cea078")
include(ExternalSDL2BackportForWebOS)
unset(CMAKE_INSTALL_LIBDIR)
else ()
Expand Down
1 change: 1 addition & 0 deletions cmake/AresPackage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ execute_process(COMMAND ares-package "${CPACK_TEMPORARY_DIRECTORY}" -o "${CPACK_
-e "libmbedtls[.].*"
-e "lib/static"
-e "lib/pkgconfig"
--force-arch "${CPACK_WEBOS_PACKAGE_ARCH}"
COMMAND_ERROR_IS_FATAL ANY
)

Expand Down
3 changes: 2 additions & 1 deletion cmake/CPackConfig.webOS.cmake.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
set(CPACK_WEBOS_STRIP_COMMAND "@CMAKE_STRIP@")
set(CPACK_WEBOS_STRIP_COMMAND "@CMAKE_STRIP@")
set(CPACK_WEBOS_PACKAGE_ARCH "@TARGET_WEBOS_ARCH@")
2 changes: 1 addition & 1 deletion cmake/PackageWebOS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${CMAKE_SOURCE_DIR}/cmake/AresPackage.cmake")
set(CPACK_EXTERNAL_ENABLE_STAGING TRUE)
set(CPACK_MONOLITHIC_INSTALL TRUE)
set(CPACK_PACKAGE_DIRECTORY ${CMAKE_SOURCE_DIR}/dist)
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${PROJECT_VERSION}_arm")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${PROJECT_VERSION}_${TARGET_WEBOS_ARCH}")
set(CPACK_PRE_BUILD_SCRIPTS "${CMAKE_SOURCE_DIR}/cmake/CleanupNameLink.cmake")

configure_file("${CMAKE_SOURCE_DIR}/cmake/CPackConfig.webOS.cmake.in" CPackConfig.webOS.cmake @ONLY)
Expand Down
5 changes: 2 additions & 3 deletions scripts/webos/easy_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ if [ -z "$CI" ]; then
fi

if [ -z "${TOOLCHAIN_FILE}" ]; then
echo "Setup environment"
. /opt/webos-sdk-x86_64/1.0.g/environment-setup-armv7a-neon-webos-linux-gnueabi
TOOLCHAIN_FILE=/opt/webos-sdk-x86_64/1.0.g/sysroots/x86_64-webossdk-linux/usr/share/cmake/OEToolchainConfig.cmake
echo "Use buildroot-nc4 toolchain installed in /opt"
TOOLCHAIN_FILE=/opt/arm-webos-linux-gnueabi_sdk-buildroot/share/buildroot/toolchainfile.cmake
fi

echo "Configure project"
Expand Down
5 changes: 4 additions & 1 deletion src/app/app.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ int app_init(app_t *app, app_settings_loader *settings_loader, int argc, char *a
SDL_SetHint(SDL_HINT_WEBOS_CURSOR_CALIBRATION_DISABLE, "true");
#endif
// DO not init video subsystem before NDL/LGNC initialization
SDL_InitSubSystem(SDL_INIT_VIDEO);
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) {
commons_log_fatal("APP", "Failed to initialize SDL video subsystem: %s", SDL_GetError());
return -1;
}
// This will occupy SDL_USEREVENT
SDL_RegisterEvents(1);
commons_log_info("APP", "UI locale: %s (%s)", i18n_locale(), locstr("[Localized Language]"));
Expand Down
4 changes: 3 additions & 1 deletion src/app/input/app_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ void app_input_init(app_input_t *input, app_t *app) {

void app_input_deinit(app_input_t *input) {
app_input_deinit_gamepad_mapping(input);
SDL_FreeCursor(input->blank_cursor_surface->userdata);
if (input->blank_cursor_surface->userdata != NULL) {
SDL_FreeCursor(input->blank_cursor_surface->userdata);
}
SDL_FreeSurface(input->blank_cursor_surface);
SDL_QuitSubSystem(SDL_INIT_GAMECONTROLLER | SDL_INIT_HAPTIC);
}
Expand Down