Przeglądaj źródła

add cyrus-sasl and openldap (#643)

* add cyrus-sasl

* add openldap
Hoildkv 4 lat temu
rodzic
commit
de3448c93b
2 zmienionych plików z 73 dodań i 0 usunięć
  1. 21 0
      packages/c/cyrus-sasl/xmake.lua
  2. 52 0
      packages/o/openldap/xmake.lua

+ 21 - 0
packages/c/cyrus-sasl/xmake.lua

@@ -0,0 +1,21 @@
+package("cyrus-sasl")
+
+    set_homepage("https://www.cyrusimap.org/sasl/")
+    set_description("Cyrus SASL is an implementation of SASL that makes it easy for application developers to integrate authentication mechanisms into their application in a generic way.")
+
+    add_urls("https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-$(version)/cyrus-sasl-$(version).tar.gz")
+    add_versions("2.1.27", "26866b1549b00ffd020f188a43c258017fa1c382b3ddadd8201536f72efb05d5")
+
+    on_install("linux", "macosx", function (package)
+        local configs = {"--disable-macos-framework", "--disable-sample"}
+        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:config("pic") ~= false then
+            table.insert(configs, "--with-pic")
+        end
+        import("package.tools.autoconf").install(package, configs)
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("sasl_version", {includes = "sasl/sasl.h"}))
+    end)

+ 52 - 0
packages/o/openldap/xmake.lua

@@ -0,0 +1,52 @@
+package("openldap")
+
+    set_homepage("https://www.openldap.org/")
+    set_description("OpenLDAP Software is an open source implementation of the Lightweight Directory Access Protocol.")
+
+    add_urls("https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-$(version).tgz")
+    add_versions("2.5.7", "ea9757001bc36295037f0030ede16810a1bb7438bbe8f871a35cc2a2b439d9ab")
+
+    add_configs("tls", {description = "Set TLS/SSL support library.", default = "openssl", type = "string", values = {"openssl", "gnutls"}})
+    add_configs("sasl", {description = "Enable Cyrus SASL support.", default = false, type = "boolean"})
+
+    if is_plat("linux") then
+        add_syslinks("pthread")
+    end
+    on_load("linux", "macosx", function (package)
+        package:add("deps", package:config("tls"))
+        if package:config("sasl") then
+            package:add("deps", "cyrus-sasl")
+        end
+    end)
+
+    on_install("linux", "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"))
+        table.insert(configs, "--with-tls=" .. package:config("tls"))
+        table.insert(configs, "--with-cyrus-sasl=" .. (package:config("sasl") and "yes" or "no"))
+        if package:config("pic") ~= false then
+            table.insert(configs, "--with-pic")
+        end
+        local cppflags = {}
+        local ldflags = {}
+        for _, dep in ipairs(package:orderdeps()) do
+            local fetchinfo = dep:fetch()
+            if fetchinfo then
+                for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do
+                    table.insert(cppflags, "-I" .. includedir)
+                end
+                for _, linkdir in ipairs(fetchinfo.linkdirs) do
+                    table.insert(ldflags, "-L" .. linkdir)
+                end
+                for _, link in ipairs(fetchinfo.links) do
+                    table.insert(ldflags, "-l" .. link)
+                end
+            end
+        end
+        import("package.tools.autoconf").install(package, configs, {cppflags = cppflags, ldflags = ldflags})
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("ldap_get_option", {includes = "ldap.h"}))
+    end)