Explorar o código

Update flecs to v3.2.4 (#2225)

* Update flecs to v3.2.4

* Update xmake.lua

* Update xmake.lua

* flecs: Fix freebsd

* flecs: Fix freebsd link

* Update xmake.lua
Jérôme Leclercq %!s(int64=2) %!d(string=hai) anos
pai
achega
dcf450b74b

+ 14 - 0
packages/f/flecs/patches/v3.2.4/freebsd_http_include.patch

@@ -0,0 +1,14 @@
+diff --git a/src/addons/http.c b/src/addons/http.c
+index fbaab52f4..32985a554 100644
+--- a/src/addons/http.c
++++ b/src/addons/http.c
+@@ -56,6 +56,9 @@ typedef SOCKET ecs_http_socket_t;
+ #include <strings.h>
+ #include <signal.h>
+ #include <fcntl.h>
++#ifdef __FreeBSD__
++#include <netinet/in.h>
++#endif
+ typedef int ecs_http_socket_t;
+ #endif
+ 

+ 19 - 9
packages/f/flecs/xmake.lua

@@ -1,28 +1,38 @@
 package("flecs")
 package("flecs")
-
     set_homepage("https://github.com/SanderMertens/flecs")
     set_homepage("https://github.com/SanderMertens/flecs")
     set_description("A fast entity component system (ECS) for C & C++")
     set_description("A fast entity component system (ECS) for C & C++")
     set_license("MIT")
     set_license("MIT")
 
 
     add_urls("https://github.com/SanderMertens/flecs/archive/refs/tags/$(version).tar.gz",
     add_urls("https://github.com/SanderMertens/flecs/archive/refs/tags/$(version).tar.gz",
              "https://github.com/SanderMertens/flecs.git")
              "https://github.com/SanderMertens/flecs.git")
-    add_versions("v3.0.0", "ae88da6abc5612d16ab2e6aa4041b035491fc1f2")
+    add_versions("v3.2.4", "0b65426053418911cae1c3f347748fba6eb7d4ae8860ce7fcc91ef25f386d4a1")
+    add_versions("v3.0.0", "8715faf3276f0970b80c28c2a8911f4ac86633d25ebab3d3c69521942769d7d4")
     add_versions("v2.4.8", "9a8040a197e4b5e032524bc7183f68faa7b2f759c67b983b40018a7726561cac")
     add_versions("v2.4.8", "9a8040a197e4b5e032524bc7183f68faa7b2f759c67b983b40018a7726561cac")
 
 
+    add_patches("v3.2.4", path.join(os.scriptdir(), "patches", "v3.2.4", "freebsd_http_include.patch"), "39d7f2795b8c64b76d7f2aa6c3c5a10383df1234ff1bb441d62fd8fcaab8174b")
+
     add_deps("cmake")
     add_deps("cmake")
 
 
-    if is_plat("linux") then
+    if is_plat("windows", "mingw") then
+        add_syslinks("wsock32", "ws2_32")
+    elseif is_plat("linux") then
         add_syslinks("pthread")
         add_syslinks("pthread")
+    elseif is_plat("bsd") then
+        add_syslinks("execinfo", "pthread")
     end
     end
 
 
-    on_install("windows", "macosx", "linux", function (package)
-        local configs = {}
-        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
-        table.insert(configs, "-DFLECS_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
-        table.insert(configs, "-DFLECS_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
-        if package:is_plat("windows") and not package:config("shared") then
+    on_load("windows", "mingw", function (package)
+        if not package:config("shared") then
             package:add("defines", "flecs_STATIC")
             package:add("defines", "flecs_STATIC")
         end
         end
+    end)
+
+    on_install(function (package)
+        local configs = {}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DFLECS_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
+        table.insert(configs, "-DFLECS_SHARED=" .. (package:config("shared") and "ON" or "OFF"))
+        table.insert(configs, "-DFLECS_PIC=" .. (package:config("pic") and "ON" or "OFF"))
         import("package.tools.cmake").install(package, configs)
         import("package.tools.cmake").install(package, configs)
     end)
     end)