From de3448c93b9d886699b770b09445840de5d89165 Mon Sep 17 00:00:00 2001 From: Hoildkv <42310255+xq114@users.noreply.github.com> Date: Tue, 21 Sep 2021 16:47:14 +0800 Subject: [PATCH] add cyrus-sasl and openldap (#643) * add cyrus-sasl * add openldap --- packages/c/cyrus-sasl/xmake.lua | 21 +++++++++++++ packages/o/openldap/xmake.lua | 52 +++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 packages/c/cyrus-sasl/xmake.lua create mode 100644 packages/o/openldap/xmake.lua diff --git a/packages/c/cyrus-sasl/xmake.lua b/packages/c/cyrus-sasl/xmake.lua new file mode 100644 index 000000000..cc706834a --- /dev/null +++ b/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) diff --git a/packages/o/openldap/xmake.lua b/packages/o/openldap/xmake.lua new file mode 100644 index 000000000..8fd296978 --- /dev/null +++ b/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)