Browse Source

Adding patch for sol2 3.3.0 (#6251)

* adding patch for sol2 3.3.0

* Disable wasm plat

---------

Co-authored-by: star9029 <[email protected]>
kbz_8 7 months ago
parent
commit
7038d6ffe4
2 changed files with 18 additions and 3 deletions
  1. 14 0
      packages/s/sol2/patches/3.3.0/optional.patch
  2. 4 3
      packages/s/sol2/xmake.lua

+ 14 - 0
packages/s/sol2/patches/3.3.0/optional.patch

@@ -0,0 +1,14 @@
+diff --git a/include/sol/optional_implementation.hpp b/include/sol/optional_implementation.hpp
+index 26f41d0c..e22226d6 100644
+--- a/include/sol/optional_implementation.hpp
++++ b/include/sol/optional_implementation.hpp
+@@ -2191,7 +2191,8 @@ namespace sol {
+ 			static_assert(std::is_constructible<T, Args&&...>::value, "T must be constructible with Args");
+ 
+ 			*this = nullopt;
+-			this->construct(std::forward<Args>(args)...);
++			new (static_cast<void*>(this)) optional(std::in_place, std::forward<Args>(args)...);
++			return **this;
+ 		}
+ 
+ 		/// Swaps this optional with the other.

+ 4 - 3
packages/s/sol2/xmake.lua

@@ -1,10 +1,9 @@
 package("sol2")
-
     set_kind("library", {headeronly = true})
     set_homepage("https://github.com/ThePhD/sol2")
     set_description("A C++ library binding to Lua.")
 
-    set_urls("https://github.com/ThePhD/sol2/archive/$(version).tar.gz",
+    set_urls("https://github.com/ThePhD/sol2/archive/refs/tags/$(version).tar.gz",
              "https://github.com/ThePhD/sol2.git")
 
     add_versions("v3.3.0", "b82c5de030e18cb2bcbcefcd5f45afd526920c517a96413f0b59b4332d752a1e")
@@ -14,6 +13,8 @@ package("sol2")
 
     add_configs("includes_lua", {description = "Should this package includes the Lua package (set to false if you're shipping a custom Lua)", default = true, type = "boolean"})
 
+    add_patches(">=3.3.0", path.join(os.scriptdir(), "patches", "3.3.0", "optional.patch"), "8440f25e5dedc29229c3def85aa6f24e0eb165d4c390fd0e1312452a569a01a6")
+
     if is_plat("mingw") and is_subhost("msys") then
         add_extsources("pacman::sol2")
     elseif is_plat("linux") then
@@ -32,7 +33,7 @@ package("sol2")
         end
     end)
 
-    on_install(function (package)
+    on_install("!wasm", function (package)
         local configs = {}
         if package:config("includes_lua") then
             if package:version() and package:version():ge("3.3") then