From 5d2bd37b5c09ece971f23af76055f002bea8282a Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Mon, 30 Sep 2024 14:17:34 +0200
Subject: [PATCH] testing/lua-xml: fix build

patch from: https://github.com/lubyk/xml/pull/20
---
 testing/lua-xml/APKBUILD                      |  10 +-
 ...te-to-C++17-style-exception-notation.patch | 116 ++++++++++++++++++
 2 files changed, 123 insertions(+), 3 deletions(-)
 create mode 100644 testing/lua-xml/dub-update-to-C++17-style-exception-notation.patch

diff --git a/testing/lua-xml/APKBUILD b/testing/lua-xml/APKBUILD
index 38887c7de0ce..752baac424ae 100644
--- a/testing/lua-xml/APKBUILD
+++ b/testing/lua-xml/APKBUILD
@@ -3,14 +3,15 @@
 pkgname=lua-xml
 _rockname=xml
 pkgver=1.1.3
-pkgrel=1
+pkgrel=2
 pkgdesc="Very fast XML parser for Lua based on RapidXML"
 url="https://github.com/lubyk/xml"
 arch="all"
 license="MIT"
 depends="lua-lub"
 checkdepends="lua-lut luajit"
-source="https://github.com/lubyk/$_rockname/archive/REL-$pkgver/lua-xml-$pkgver.tar.gz"
+source="https://github.com/lubyk/$_rockname/archive/REL-$pkgver/lua-xml-$pkgver.tar.gz
+	dub-update-to-C++17-style-exception-notation.patch"
 builddir="$srcdir/$_rockname-REL-$pkgver"
 
 case "$CARCH" in
@@ -66,4 +67,7 @@ _subpackage() {
 	rm -r "$rocksdir"/manifest "$rocksdir"/$_rockname/*/doc
 }
 
-sha512sums="fdbfab6aaf46e71a02a2ac6dd0b3f708ee7e712f9704a2b834c2240696519dbcbb28fcee555bd6f12f992ee8713597aaee4b7057efcc1c004303bbe0f2223776  lua-xml-1.1.3.tar.gz"
+sha512sums="
+fdbfab6aaf46e71a02a2ac6dd0b3f708ee7e712f9704a2b834c2240696519dbcbb28fcee555bd6f12f992ee8713597aaee4b7057efcc1c004303bbe0f2223776  lua-xml-1.1.3.tar.gz
+a7e83866c7af7d1e6c08c32891b5749f816d8024036de1976c0d5dd9cea09e619c07176f066066a837f984f3a2cdd245ffb9d55d57879eb98d5cd130f71a9370  dub-update-to-C++17-style-exception-notation.patch
+"
diff --git a/testing/lua-xml/dub-update-to-C++17-style-exception-notation.patch b/testing/lua-xml/dub-update-to-C++17-style-exception-notation.patch
new file mode 100644
index 000000000000..eb6a95ebc087
--- /dev/null
+++ b/testing/lua-xml/dub-update-to-C++17-style-exception-notation.patch
@@ -0,0 +1,116 @@
+From 8b9cde4bbb4badcebfeb67a29c481e97fc539991 Mon Sep 17 00:00:00 2001
+From: larkwiot <larkwiot@protonmail.com>
+Date: Sun, 29 Jan 2023 16:29:05 -0600
+Subject: [PATCH] fix(dub): update dub to C++17 style exception notation
+
+---
+ src/bind/dub/dub.cpp | 14 +++++++-------
+ src/bind/dub/dub.h   | 16 ++++++++--------
+ 2 files changed, 15 insertions(+), 15 deletions(-)
+
+diff --git a/src/bind/dub/dub.cpp b/src/bind/dub/dub.cpp
+index ad1cb6d..97ecf1f 100644
+--- a/src/bind/dub/dub.cpp
++++ b/src/bind/dub/dub.cpp
+@@ -413,7 +413,7 @@ void dub::pushudata(lua_State *L, const void *cptr, const char *tname, bool gc)
+ // These methods are slight adaptations from luaxlib.c
+ // Copyright (C) 1994-2008 Lua.org, PUC-Rio.
+ 
+-lua_Number dub::checknumber(lua_State *L, int narg) throw(TypeException) {
++lua_Number dub::checknumber(lua_State *L, int narg) noexcept(false) {
+ #ifdef DUB_LUA_FIVE_ONE
+   lua_Number d = lua_tonumber(L, narg);
+   if (d == 0 && !lua_isnumber(L, narg))  /* avoid extra test when d is not 0 */
+@@ -428,7 +428,7 @@ lua_Number dub::checknumber(lua_State *L, int narg) throw(TypeException) {
+ #endif
+ }
+ 
+-lua_Integer dub::checkinteger(lua_State *L, int narg) throw(TypeException) {
++lua_Integer dub::checkinteger(lua_State *L, int narg) noexcept(false) {
+ #ifdef DUB_LUA_FIVE_ONE
+   lua_Integer d = lua_tointeger(L, narg);
+   if (d == 0 && !lua_isnumber(L, narg))  /* avoid extra test when d is not 0 */
+@@ -443,13 +443,13 @@ lua_Integer dub::checkinteger(lua_State *L, int narg) throw(TypeException) {
+ #endif
+ }
+ 
+-const char *dub::checklstring(lua_State *L, int narg, size_t *len) throw(TypeException) {
++const char *dub::checklstring(lua_State *L, int narg, size_t *len) noexcept(false) {
+   const char *s = lua_tolstring(L, narg, len);
+   if (!s) throw TypeException(L, narg, lua_typename(L, LUA_TSTRING));
+   return s;
+ }
+ 
+-void **dub::checkudata(lua_State *L, int ud, const char *tname, bool keep_mt) throw(dub::Exception) {
++void **dub::checkudata(lua_State *L, int ud, const char *tname, bool keep_mt) noexcept(false) {
+   void **p = (void**)lua_touserdata(L, ud);
+   if (p != NULL) {  /* value is a userdata? */
+     if (lua_getmetatable(L, ud)) {  /* does it have a metatable? */
+@@ -500,7 +500,7 @@ static inline void **dub_cast_ud(lua_State *L, int ud, const char *tname) {
+   return NULL;
+ }
+ 
+-static inline void **getsdata(lua_State *L, int ud, const char *tname, bool keep_mt) throw() {
++static inline void **getsdata(lua_State *L, int ud, const char *tname, bool keep_mt) noexcept(false) {
+   void **p = (void**)lua_touserdata(L, ud);
+   if (p != NULL) {  /* value is a userdata? */
+     if (lua_getmetatable(L, ud)) {  /* does it have a metatable? */
+@@ -593,7 +593,7 @@ void **dub::issdata(lua_State *L, int ud, const char *tname, int type) {
+   }
+ }
+ 
+-void **dub::checksdata(lua_State *L, int ud, const char *tname, bool keep_mt) throw(dub::Exception) {
++void **dub::checksdata(lua_State *L, int ud, const char *tname, bool keep_mt) noexcept(false) {
+   void **p = getsdata(L, ud, tname, keep_mt);
+   if (!p) {
+     throw dub::TypeException(L, ud, tname);
+@@ -604,7 +604,7 @@ void **dub::checksdata(lua_State *L, int ud, const char *tname, bool keep_mt) th
+   return p;
+ }
+ 
+-void **dub::checksdata_d(lua_State *L, int ud, const char *tname) throw(dub::Exception) {
++void **dub::checksdata_d(lua_State *L, int ud, const char *tname) noexcept(false) {
+   void **p = getsdata(L, ud, tname, false);
+   if (!p) {
+     throw dub::TypeException(L, ud, tname);
+diff --git a/src/bind/dub/dub.h b/src/bind/dub/dub.h
+index f1be483..4d0fbb6 100644
+--- a/src/bind/dub/dub.h
++++ b/src/bind/dub/dub.h
+@@ -295,16 +295,16 @@ void register_const(lua_State *L, const const_Reg *l);
+ 
+ // These provide the same funcionality as their equivalent luaL_check... but they
+ // throw std::exception which can be caught (eventually to call lua_error).
+-lua_Number checknumber(lua_State *L, int narg) throw(dub::TypeException);
+-lua_Integer checkinteger(lua_State *L, int narg) throw(dub::TypeException);
+-const char *checklstring(lua_State *L, int narg, size_t *len) throw(dub::TypeException);
+-void **checkudata(lua_State *L, int ud, const char *tname, bool keep_mt = false) throw(dub::Exception);
++lua_Number checknumber(lua_State *L, int narg) noexcept(false);
++lua_Integer checkinteger(lua_State *L, int narg) noexcept(false);
++const char *checklstring(lua_State *L, int narg, size_t *len) noexcept(false);
++void **checkudata(lua_State *L, int ud, const char *tname, bool keep_mt = false) noexcept(false);
+ 
+ // Super aware userdata calls (finds userdata inside provided table with table.super).
+-void **checksdata(lua_State *L, int ud, const char *tname, bool keep_mt = false) throw(dub::Exception);
++void **checksdata(lua_State *L, int ud, const char *tname, bool keep_mt = false) noexcept(false);
+ // Super aware userdata calls that DOES NOT check for dangling pointers (used in 
+ // __gc binding).
+-void **checksdata_d(lua_State *L, int ud, const char *tname) throw(dub::Exception);
++void **checksdata_d(lua_State *L, int ud, const char *tname) noexcept(false);
+ // Return pointer if the type is correct. Used to resolve overloaded functions when there
+ // is no other alternative (arg count, native types). We return the pointer so that we can
+ // optimize away the corresponding 'dub_checksdata'.
+@@ -314,11 +314,11 @@ void **issdata(lua_State *L, int ud, const char *tname, int type);
+ // implementations for luaL_error (luajit throws an exception on luaL_error).
+ void **checksdata_n(lua_State *L, int ud, const char *tname, bool keep_mt = false);
+ 
+-inline const char *checkstring(lua_State *L, int narg) throw(dub::TypeException) {
++inline const char *checkstring(lua_State *L, int narg) noexcept(false) {
+   return checklstring(L, narg, NULL);
+ }
+ 
+-inline int checkboolean(lua_State *L, int narg) throw() {
++inline int checkboolean(lua_State *L, int narg) noexcept {
+   return lua_toboolean(L, narg);
+ }
+ 
-- 
GitLab