Browse Source

add davix (#2850)

* add davix

* try davix

* try fix uuid

* make nls optional for util-linux
Hoildkv 1 year ago
parent
commit
f9b7e72e6f
3 changed files with 59 additions and 0 deletions
  1. 48 0
      packages/d/davix/xmake.lua
  2. 6 0
      packages/l/libintl/xmake.lua
  3. 5 0
      packages/u/util-linux/xmake.lua

+ 48 - 0
packages/d/davix/xmake.lua

@@ -0,0 +1,48 @@
+package("davix")
+
+    set_homepage("https://davix.web.cern.ch/")
+    set_description("High-performance file management over WebDAV/HTTP")
+    set_license("LGPL-2.1")
+
+    add_urls("https://github.com/cern-fts/davix/releases/download/R_$(version).tar.gz", {version = function (version)
+        return format("%s/davix-%s", version:gsub("%.", "_"), version)
+    end})
+    add_urls("https://github.com/cern-fts/davix.git")
+    add_versions("0.8.5", "f9ce21bcc2ed248f7825059d17577876616258c35177d74fad8f854a818a87f9")
+
+    add_deps("python 3.x", {kind = "binary"})
+    add_deps("cmake", "openssl", "libcurl", "libxml2")
+    add_deps("util-linux", {configs = {libuuid = true}})
+    add_includedirs("include/davix")
+    if is_plat("linux") then
+        add_syslinks("pthread")
+    end
+    on_install("macosx", "linux", function (package)
+        local configs = {"-DDAVIX_TESTS=OFF", "-DEMBEDDED_LIBCURL=OFF", "-DLIB_SUFFIX="}
+        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
+        table.insert(configs, "-DSHARED_LIBRARY=" .. (package:config("shared") and "ON" or "OFF"))
+        table.insert(configs, "-DSTATIC_LIBRARY=" .. (package:config("shared") and "OFF" or "ON"))
+        local utlinux = package:dep("util-linux"):fetch()
+        if utlinux then
+            for _, dir in ipairs(utlinux.includedirs or utlinux.sysincludedirs) do
+                table.insert(configs, "-DUUID_INCLUDE_DIR=" .. dir)
+                break
+            end
+            for _, dir in ipairs(utlinux.linkdirs) do
+                table.insert(configs, "-DUUID_LIBRARY=" .. dir .. "/libuuid.a")
+                break
+            end
+        end
+        import("package.tools.cmake").install(package, configs, {packagedeps = "libcurl"})
+        package:addenv("PATH", "bin")
+    end)
+
+    on_test(function (package)
+        assert(package:check_cxxsnippets({test = [[
+            #include <davix.hpp>
+            void test() {
+                Davix::Context context;
+                context.loadModule("grid");
+            }
+        ]]}, {configs = {languages = "c++17"}}))
+    end)

+ 6 - 0
packages/l/libintl/xmake.lua

@@ -11,6 +11,12 @@ package("libintl")
         add_syslinks("advapi32")
     end
 
+    on_fetch(function (package, opt)
+        if opt.system then
+            return package:find_package("system::intl", {includes = "libintl.h"})
+        end
+    end)
+
     on_install("windows", "macosx", "android", function (package)
         -- on linux libintl is already a part of libc
         os.cp(path.join(os.scriptdir(), "port", package:version_str(), "xmake.lua"), "xmake.lua")

+ 5 - 0
packages/u/util-linux/xmake.lua

@@ -10,6 +10,7 @@ package("util-linux")
     add_versions("2.32.1", "86e6707a379c7ff5489c218cfaf1e3464b0b95acf7817db0bc5f179e356a67b2")
     add_versions("2.36.2", "f7516ba9d8689343594356f0e5e1a5f0da34adfbc89023437735872bb5024c5f")
     add_versions("2.39",   "32b30a336cda903182ed61feb3e9b908b762a5e66fe14e43efb88d37162075cb")
+    add_versions("2.39.2", "87abdfaa8e490f8be6dde976f7c80b9b5ff9f301e1b67e3899e1f05a59a1531f")
 
     add_patches("2.36.2", path.join(os.scriptdir(), "patches", "2.36.2", "includes.patch"), "7274762cac2810b5f0d17ecb5ac69c7069e7ff2b880df663b7072628df0867f3")
 
@@ -20,6 +21,7 @@ package("util-linux")
         add_deps("ncurses", "zlib")
     end
 
+    add_configs("nls",                {description = "Enable Native Language Support.", default = false, type = "boolean"})
     add_configs("ipcs",               {description = "Enable ipcs.", default = false, type = "boolean"})
     add_configs("ipcrm",              {description = "Enable ipcrm.", default = false, type = "boolean"})
     add_configs("wall",               {description = "Enable wall.", default = false, type = "boolean"})
@@ -41,6 +43,9 @@ package("util-linux")
     add_configs("makeinstall-setuid", {description = "Enable makeinstall-setuid.", default = false, type = "boolean"})
 
     on_load(function (package)
+        if package:is_plat("macosx") and package:config("nls") then
+            package:add("deps", "libintl")
+        end
         package:addenv("PATH", "bin")
         package:addenv("PATH", "sbin")
     end)