From 48033cf732fcc3eb70f5e88de393d2c195081175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Wed, 1 May 2024 16:43:35 +0200 Subject: [PATCH] Python: Add a way to find brew openssl (#3927) --- packages/p/python/xmake.lua | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/packages/p/python/xmake.lua b/packages/p/python/xmake.lua index 50d6d5a8d..065cf1f1b 100644 --- a/packages/p/python/xmake.lua +++ b/packages/p/python/xmake.lua @@ -1,7 +1,7 @@ package("python") - set_homepage("https://www.python.org/") set_description("The python programming language.") + set_license("PSF") if is_host("windows") then if is_arch("x86", "i386") or os.arch() == "x86" then @@ -129,24 +129,30 @@ package("python") table.insert(configs, "--datarootdir=" .. package:installdir("share")) table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) - -- add openssl libs path for detecting - local openssl_dir + -- add openssl libs path local openssl = package:dep("openssl"):fetch() if openssl then + local openssl_dir for _, linkdir in ipairs(openssl.linkdirs) do if path.filename(linkdir) == "lib" then openssl_dir = path.directory(linkdir) - if openssl_dir then - break + else + -- try to find if linkdir is root (brew has linkdir as root and includedirs inside) + for _, includedir in ipairs(openssl.sysincludedirs or openssl.includedirs) do + if includedir:startswith(linkdir) then + openssl_dir = linkdir + break + end end end - end - end - if openssl_dir then - if package:version():ge("3.0") then - table.insert(configs, "--with-openssl=" .. openssl_dir) - else - io.gsub("setup.py", "/usr/local/ssl", openssl_dir) + if openssl_dir then + if package:version():ge("3.0") then + table.insert(configs, "--with-openssl=" .. openssl_dir) + else + io.gsub("setup.py", "/usr/local/ssl", openssl_dir) + end + break + end end end