Browse Source

update stringzilla to 4.0.14 (#8245)

* stringzilla: fix build error for old version

* stringzilla: update version to 4.0.14

* stringzilla: add patch to fix odr for 4.0.0

* stringzilla: fix build error
45degree 2 months ago
parent
commit
140bef6c25

+ 24 - 0
packages/s/stringzilla/patches/4.0.0/fix_odr_violation_for_raise.patch

@@ -0,0 +1,24 @@
+From 6e826d74054387b2a19a0d1645bb549f4219c149 Mon Sep 17 00:00:00 2001
+From: Jason <[email protected]>
+Date: Mon, 22 Sep 2025 06:36:34 -0500
+Subject: [PATCH] Fix: ODR violation for `raise` in C++ (#238)
+
+Co-authored-by: Jason Holmes <[email protected]>
+Co-authored-by: Jason Holmes <[email protected]>
+---
+ include/stringzilla/stringzilla.hpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/stringzilla/stringzilla.hpp b/include/stringzilla/stringzilla.hpp
+index 7b211b66..657ff530 100644
+--- a/include/stringzilla/stringzilla.hpp
++++ b/include/stringzilla/stringzilla.hpp
+@@ -1020,7 +1020,7 @@ std::size_t range_length(iterator_type first, iterator_type last) {
+ #pragma region Helper Types
+ 
+ #if !SZ_AVOID_STL
+-void raise(status_t status) noexcept(false) {
++inline void raise(status_t status) noexcept(false) {
+     switch (status) {
+     case status_t::bad_alloc_k: throw std::bad_alloc();
+     case status_t::invalid_utf8_k: throw std::invalid_argument("Invalid UTF-8 string");

+ 9 - 2
packages/s/stringzilla/xmake.lua

@@ -10,6 +10,7 @@ package("stringzilla")
     add_configs("cpp", {description = "Enable C++ support.", default = true, type = "boolean"})
     add_configs("stringzillas", {description = "Enable advanced API support.", default = false, type = "boolean"})
 
+    add_versions("v4.0.14", "a8485e26057725910dded847a2f21f64397dcd7a2b25df79a42759e304bdcf22")
     add_versions("v4.0.0", "17589e9c4b1e21caaec02305a68b03f11c4aec8d3edeb300808f6b4b4b3d725b")
     add_versions("v3.12.6", "1255cac3aced48b4b73e045829a80e3122c54eca5621274073839c9036f48fe8")
     add_versions("v3.12.5", "52d107322b59c15b653d1eab3732c575b82eb44a9d5e3ff752b1f2902b71e8ee")
@@ -63,6 +64,8 @@ package("stringzilla")
     add_versions("v2.0.3", "6b52a7b4eb8383cbcf83608eaa08e5ba588a378449439b73584713a16d8920e3")
     add_versions("v1.2.2", "2e17c49965841647a1c371247f53b2f576e5fb32fe4b84a080d425b12f17703c")
 
+    add_patches("v4.0.0", path.join(os.scriptdir(), "patches", "4.0.0", "fix_odr_violation_for_raise.patch"), "f8add457114b63ed846ee9ca7568d623eb70af5461a7b62a6f2c6a9c62488dc8")
+
     on_install("android|!armeabi-v7a or (!android and !cross)", function (package)
         if package:version():ge("4.0.0") then
             os.cp("include/stringzilla/*.h", package:installdir("include/stringzilla"))
@@ -74,7 +77,9 @@ package("stringzilla")
                 os.cp("include/stringzillas", package:installdir("include/stringzillas"))
             end
             return
-        elseif package:version():gt("3.0.0") then
+        end
+
+        if package:version():gt("3.0.0") then
             if package:version():gt("3.9.0") then
                 os.cp("include/stringzilla/drafts.h", package:installdir("include/stringzilla"))
             else
@@ -83,7 +88,9 @@ package("stringzilla")
             if package:config("cpp") then
                 os.cp("include/stringzilla/stringzilla.hpp", package:installdir("include/stringzilla"))
             end
-        elseif package:version():gt("2.0.4") then
+        end
+
+        if package:version():gt("2.0.4") then
             os.cp("include/stringzilla/stringzilla.h", package:installdir("include/stringzilla"))
         else
             os.cp("stringzilla/stringzilla.h", package:installdir("include/stringzilla"))