소스 검색

Add a whole bunch of libraries (#750)

* Add libusbmuxd

* Add xframe

* Add liburing

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

* Update xmake.lua

Co-authored-by: ruki <[email protected]>
Kelvin Zhang 3 년 전
부모
커밋
e9328bd8e3
3개의 변경된 파일102개의 추가작업 그리고 0개의 파일을 삭제
  1. 23 0
      packages/l/liburing/xmake.lua
  2. 47 0
      packages/l/libusbmuxd/xmake.lua
  3. 32 0
      packages/x/xframe/xmake.lua

+ 23 - 0
packages/l/liburing/xmake.lua

@@ -0,0 +1,23 @@
+package("liburing")
+
+    set_homepage("https://github.com/axboe/liburing")
+    set_description("liburing provides helpers to setup and teardown io_uring instances")
+
+    add_urls("https://github.com/axboe/liburing/archive/refs/tags/liburing-$(version).tar.gz",
+             "https://github.com/axboe/liburing.git")
+    add_versions("2.1", "f1e0500cb3934b0b61c5020c3999a973c9c93b618faff1eba75aadc95bb03e07")
+
+    -- liburing doesn't support building as a shared lib
+    add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
+
+    on_install("linux", function (package)
+        local cflags
+        if package:config("pic") ~= false then
+            cflags = "-fPIC"
+        end
+        import("package.tools.autoconf").install(package, {}, {makeconfigs = {CFLAGS = cflags}})
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("io_uring_submit", {includes = "liburing.h"}))
+    end)

+ 47 - 0
packages/l/libusbmuxd/xmake.lua

@@ -0,0 +1,47 @@
+package("libusbmuxd")
+
+    set_homepage("https://github.com/libimobiledevice/libusbmuxd")
+    set_description("A client library to multiplex connections from and to iOS devices")
+    set_license("LGPL-2.1")
+
+    add_urls("https://github.com/libimobiledevice/libusbmuxd/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/libimobiledevice/libusbmuxd.git")
+    add_versions("2.0.2", "8ae3e1d9340177f8f3a785be276435869363de79f491d05d8a84a59efc8a8fdc")
+
+    if is_plat("windows", "mingw") then
+        add_syslinks("ws2_32")
+    end
+
+    on_load(function (package)
+        if package:is_plat("mingw") and package:config("shared") then
+            package:add("deps", "libplist", {configs = {shared = true}})
+        else
+            package:add("deps", "libplist")
+        end
+    end)
+
+    on_install("macosx", "linux", "mingw@macosx", function (package)
+        local configs = {}
+        table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no"))
+        table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes"))
+        if package:is_plat("linux") and package:config("pic") ~= false then
+            table.insert(configs, "--with-pic")
+        end
+        local cflags
+        if package:is_plat("mingw") then
+            -- disable ifaddrs for mingw
+            cflags = {"-DWIN32", "-D_WIN32_WINNT=0x0600"}
+            io.replace("common/socket.c", "AF_INET6", "AF_INET6_")
+        end
+        -- disable tools
+        io.replace("tools/Makefile.am", "bin_PROGRAMS = iproxy inetcat", "bin_PROGRAMS =")
+        -- fix multiple definition with libplist
+        io.replace("common/thread.c", " thread_once(", " thread_once_(", {plain = true})
+        io.replace("common/thread.h", " thread_once(", " thread_once_(", {plain = true})
+        io.replace("src/libusbmuxd.c", "\tthread_once(", " thread_once_(", {plain = true})
+        import("package.tools.autoconf").install(package, configs, {cflags = cflags})
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("usbmuxd_events_subscribe", {includes = "usbmuxd.h"}))
+    end)

+ 32 - 0
packages/x/xframe/xmake.lua

@@ -0,0 +1,32 @@
+package("xframe")
+
+    set_kind("library", {headeronly = true})
+    set_homepage("https://github.com/xtensor-stack/xframe/")
+    set_description("C++ multi-dimensional labeled arrays and dataframe based on xtensor")
+    set_license("BSD-3-Clause")
+
+    add_urls("https://github.com/xtensor-stack/xframe/archive/refs/tags/$(version).tar.gz",
+             "https://github.com/xtensor-stack/xframe.git")
+    add_versions("0.3.0", "1e8755b7a8b54dd8b7c7b65d99cc896e587ebf563c937f4aae1f73ad4f4c6be1")
+    add_versions("0.2.0", "0149f8dd5f38a6783544abca8abaadba45bab321fdcc0db0dd8b11148e1d741f")
+
+    add_deps("cmake")
+    add_deps("xtensor", "xtl")
+    on_install("windows", "macosx", "linux", "mingw@windows", function (package)
+        import("package.tools.cmake").install(package)
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include "xtensor/xrandom.hpp"
+            #include "xframe/xio.hpp"
+            #include "xframe/xvariable.hpp"
+            void test() {
+                using coordinate_type = xf::xcoordinate<xf::fstring>;
+                using variable_type = xf::xvariable<double, coordinate_type>;
+                using data_type = variable_type::data_type;
+
+                data_type data = xt::eval(xt::random::rand({6, 3}, 15., 25.));
+            }
+        ]]}, {configs = {languages = "c++17"}}))
+    end)