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
2 changes: 1 addition & 1 deletion .github/workflows/PS5.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
sudo apt install cmake pkg-config clang-15 lld-15
sudo apt install build-essential autoconf libtool yasm nasm
sudo apt install smpq gperf pkgconf libarchive-tools autopoint po4a git curl doxygen wget
wget https://github.com/ps5-payload-dev/pacbrew-repo/releases/download/v0.18/ps5-payload-dev.tar.gz
wget https://github.com/ps5-payload-dev/pacbrew-repo/releases/download/v0.27/ps5-payload-dev.tar.gz
sudo tar -xf ps5-payload-dev.tar.gz -C /

- name: Build
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/vita.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jobs:
apk add \
gettext \
git \
samurai
samurai \
patch

- name: Configure CMake
run: |
Expand Down
7 changes: 5 additions & 2 deletions 3rdParty/Lua/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ endif()

include(FetchContent)
FetchContent_Declare_ExcludeFromAll(Lua
URL https://github.com/walterschell/Lua/archive/88246d621abf7b6fba9332f49229d507f020e450.tar.gz
URL_HASH MD5=03b76927cb5341ffc53bea12c37ddcca
URL https://github.com/walterschell/Lua/archive/3ed55a56eaa05c9221f40b3c07d0e908eb1067b0.tar.gz
URL_HASH MD5=77907b8209f77c65cb681a5012f2d804
)
FetchContent_MakeAvailable_ExcludeFromAll(Lua)

# Needed for sol2
set(LUA_VERSION_STRING "5.4.7" PARENT_SCOPE)

if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND DARWIN_MAJOR_VERSION VERSION_EQUAL 8)
# We need legacy-support from MacPorts for:
# localtime_r gmtime_r
Expand Down
28 changes: 25 additions & 3 deletions 3rdParty/sol2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
include(functions/FetchContent_ExcludeFromAll_backport)
include(FetchContent)

find_package(Patch REQUIRED)

set(SOL2_ENABLE_INSTALL OFF)
set(SOL2_BUILD_LUA OFF)
set(SOL2_LUA_VERSION "${LUA_VERSION_STRING}")

include(FetchContent)
FetchContent_Declare_ExcludeFromAll(sol2
URL https://github.com/ThePhD/sol2/archive/2b0d2fe8ba0074e16b499940c4f3126b9c7d3471.tar.gz
URL_HASH MD5=869937e96e7c739b89920d12256fef4f
URL https://github.com/ThePhD/sol2/archive/c1f95a773c6f8f4fde8ca3efe872e7286afe4444.tar.gz
URL_HASH MD5=845ce869733636632d857d8517ac3eb5
# https://github.com/ThePhD/sol2/pull/1712
PATCH_COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0001-Reduce-cmake_minimum_required-to-3.22.patch || true
# https://github.com/ThePhD/sol2/pull/1722
COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0002-Fix-array-index-out-of-bounds-in-stack_field.hpp.patch || true
# https://github.com/ThePhD/sol2/pull/1676
COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0003-Change-end-to-sen-in-usertype_container.hpp.patch || true
# https://github.com/ThePhD/sol2/pull/1704
COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0004-Fix-missing-Lua-Lua-target-when-using-system-Lua.patch || true
# https://github.com/ThePhD/sol2/pull/1705
COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0005-fix-INTERFACE_LINK_LIBRARIES-property-for-lualib.patch || true
# https://github.com/ThePhD/sol2/pull/1716
COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0006-Overload-stateless_reference_equals-and-stateless_re.patch || true
# https://github.com/ThePhD/sol2/pull/1716
COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0007-Add-Nerixyz-s-test-and-fix-for-C-17.patch || true
# https://github.com/ThePhD/sol2/pull/1674
COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0008-Faster-track-for-lightuserdata_value.patch || true
# https://github.com/ThePhD/sol2/pull/1722
COMMAND "${Patch_EXECUTABLE}" -p0 -N < ${CMAKE_CURRENT_LIST_DIR}/patches/0009-Work-around-1581.patch || true
)
FetchContent_MakeAvailable_ExcludeFromAll(sol2)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From d81d82dbea310f8491ec7a6e2cbcb78516c52b8d Mon Sep 17 00:00:00 2001
From: Gleb Mazovetskiy <[email protected]>
Date: Fri, 4 Jul 2025 18:44:27 +0100
Subject: [PATCH 1/9] Reduce `cmake_minimum_required` to 3.22

Ubuntu 22.04 CMake is 3.22.
Debian stable CMake is 3.25.
Debian oldstable (EOL in 2026) has CMake 3.25 in bullseye-backports.
---
CMakeLists.txt | 2 +-
documentation/CMakeLists.txt | 2 +-
single/CMakeLists.txt | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git CMakeLists.txt CMakeLists.txt
index b54f71a3..507d9be5 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -22,7 +22,7 @@

# # # # sol2
# # # Required minimum version statement
-cmake_minimum_required(VERSION 3.26.0)
+cmake_minimum_required(VERSION 3.22)
# # # Project Include - file that is included after project declaration is finished
set(CMAKE_PROJECT_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Includes/Project.cmake")

diff --git documentation/CMakeLists.txt documentation/CMakeLists.txt
index 1c7b6758..ba780c0f 100644
--- documentation/CMakeLists.txt
+++ documentation/CMakeLists.txt
@@ -22,7 +22,7 @@

# # # # sol2, documentation generation
# # # Required minimum version statement
-cmake_minimum_required(VERSION 3.26.0)
+cmake_minimum_required(VERSION 3.22)

find_package(Doxygen REQUIRED)
find_package(Python3 REQUIRED)
diff --git single/CMakeLists.txt single/CMakeLists.txt
index 2d55fe32..a16926de 100644
--- single/CMakeLists.txt
+++ single/CMakeLists.txt
@@ -22,7 +22,7 @@

# # # # sol3, single
# # # Required minimum version statement
-cmake_minimum_required(VERSION 3.26.0)
+cmake_minimum_required(VERSION 3.22)

find_package(Python3 REQUIRED)

--
2.48.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From 24241c564783a8dc9bca24aac69e0fb9cee76949 Mon Sep 17 00:00:00 2001
From: martin nylin <[email protected]>
Date: Tue, 11 Mar 2025 21:28:44 +0100
Subject: [PATCH 2/9] Fix array index out of bounds in stack_field.hpp

---
include/sol/stack_field.hpp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git include/sol/stack_field.hpp include/sol/stack_field.hpp
index 9dd66e2e..3b815225 100644
--- include/sol/stack_field.hpp
+++ include/sol/stack_field.hpp
@@ -113,7 +113,17 @@ namespace sol { namespace stack {
lua_getglobal(L, &key[0]);
}
else {
- lua_getfield(L, tableindex, &key[0]);
+ if constexpr (std::is_same_v<std::decay_t<Key>, const char*>) {
+ // Handle const char* case
+ if (key != nullptr) {
+ lua_getfield(L, tableindex, key);
+ } else {
+ push(L, lua_nil);
+ }
+ } else {
+ // Handle std::string case
+ lua_getfield(L, tableindex, key.c_str());
+ }
}
}
else if constexpr (std::is_same_v<T, meta_function>) {
--
2.48.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 12a596d1b592acccd0ddee7df3b4e33f25550ff8 Mon Sep 17 00:00:00 2001
From: martin nylin <[email protected]>
Date: Tue, 11 Mar 2025 20:58:43 +0100
Subject: [PATCH 3/9] Change end() to sen() in usertype_container.hpp

---
include/sol/usertype_container.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git include/sol/usertype_container.hpp include/sol/usertype_container.hpp
index 6d25d2a8..3ff81724 100644
--- include/sol/usertype_container.hpp
+++ include/sol/usertype_container.hpp
@@ -1189,7 +1189,7 @@ namespace sol {
static int next_associative(std::true_type, lua_State* L_) {
iter& i = stack::unqualified_get<user<iter>>(L_, 1);
auto& it = i.it();
- auto& end = i.end();
+ auto& end = i.sen();
if (it == end) {
return stack::push(L_, lua_nil);
}
--
2.48.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From c5496869eab66dbf2ee1cb6d7f10536da809ace0 Mon Sep 17 00:00:00 2001
From: syzygial <[email protected]>
Date: Sat, 31 May 2025 22:38:52 -0400
Subject: [PATCH 4/9] Fix missing Lua::Lua target when using system Lua

---
CMakeLists.txt | 4 ++++
1 file changed, 4 insertions(+)

diff --git CMakeLists.txt CMakeLists.txt
index 507d9be5..ed1a6b59 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -276,6 +276,10 @@ if (sol2-is-top-level-project)
set(LUA_LIBRARIES ${lualib})
endif()

+ if(NOT TARGET Lua::Lua)
+ add_library(Lua::Lua ALIAS ${lualib})
+ endif()
+
if (NOT LUA_FOUND AND NOT LUABUILD_FOUND)
message(FATAL_ERROR "sol2 Lua \"${SOL2_LUA_VERSION}\" not found and could not be targeted for building")
endif()
--
2.48.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From f433abdad78bf7601563674f292ac4c96b042220 Mon Sep 17 00:00:00 2001
From: syzygial <[email protected]>
Date: Sat, 31 May 2025 12:04:26 -0400
Subject: [PATCH 5/9] fix INTERFACE_LINK_LIBRARIES property for lualib

---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git CMakeLists.txt CMakeLists.txt
index ed1a6b59..1e2edf9a 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -270,7 +270,7 @@ if (sol2-is-top-level-project)
set_target_properties(${lualib}
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${LUA_INCLUDE_DIR}
- INTERFACE_LINK_LIBRARIES "${LUA_SEARCH_DEPENDENCY_LIBS} ${CMAKE_DL_LIBS}"
+ INTERFACE_LINK_LIBRARIES "${LUA_SEARCH_DEPENDENCY_LIBS};${CMAKE_DL_LIBS}"
IMPORTED_LINK_INTERFACE_LANGUAGES C
IMPORTED_LOCATION ${lualiblocation})
set(LUA_LIBRARIES ${lualib})
--
2.48.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From ee5af5e0564d1dad7d37e9849404b5be0849142f Mon Sep 17 00:00:00 2001
From: Evil Eye <[email protected]>
Date: Thu, 10 Jul 2025 17:53:18 +0200
Subject: [PATCH 6/9] Overload stateless_reference_equals and
stateless_reference_hash to prevent implicit conversion of stack_reference to
stateless_reference

---
include/sol/reference.hpp | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git include/sol/reference.hpp include/sol/reference.hpp
index c7781552..e7be661a 100644
--- include/sol/reference.hpp
+++ include/sol/reference.hpp
@@ -828,6 +828,8 @@ namespace sol {
stateless_reference_equals(lua_State* L_) noexcept : stateless_stack_reference_equals(L_) {
}

+ using stateless_stack_reference_equals::operator();
+
bool operator()(const lua_nil_t& lhs, const stateless_reference& rhs) const noexcept {
return rhs.equals(lua_state(), lhs);
}
@@ -839,6 +841,14 @@ namespace sol {
bool operator()(const stateless_reference& lhs, const stateless_reference& rhs) const noexcept {
return lhs.equals(lua_state(), rhs);
}
+
+ bool operator()(const stateless_stack_reference& lhs, const stateless_reference& rhs) const noexcept {
+ return rhs.equals(lua_state(), lhs);
+ }
+
+ bool operator()(const stateless_reference& lhs, const stateless_stack_reference& rhs) const noexcept {
+ return lhs.equals(lua_state(), rhs);
+ }
};

struct reference_equals : public stack_reference_equals {
@@ -878,6 +888,8 @@ namespace sol {
stateless_reference_hash(lua_State* L_) noexcept : stateless_stack_reference_hash(L_) {
}

+ using stateless_stack_reference_hash::operator();
+
result_type operator()(const stateless_reference& lhs) const noexcept {
std::hash<const void*> h;
return h(lhs.pointer(lua_state()));
--
2.48.1

Loading
Loading