From be13935401926b51e7a99a545fb466e7d9912c89 Mon Sep 17 00:00:00 2001 From: Inari0 <42310255+xq114@users.noreply.github.com> Date: Sat, 21 Sep 2024 15:46:21 +0800 Subject: [PATCH] update mumps (#5300) * update mumps * insert libomp * use librarydeps --- packages/m/mumps/xmake.lua | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/m/mumps/xmake.lua b/packages/m/mumps/xmake.lua index 2d40fde02..cb8dacd23 100644 --- a/packages/m/mumps/xmake.lua +++ b/packages/m/mumps/xmake.lua @@ -1,10 +1,11 @@ package("mumps") - set_homepage("http://mumps.enseeiht.fr/") + set_homepage("https://mumps-solver.org/index.php") set_description("MUMPS: MUltifrontal Massively Parallel sparse direct Solver") - add_urls("http://mumps.enseeiht.fr/MUMPS_$(version).tar.gz") + add_urls("https://mumps-solver.org/MUMPS_$(version).tar.gz") add_versions("5.4.1", "93034a1a9fe0876307136dcde7e98e9086e199de76f1c47da822e7d4de987fa8") + add_versions("5.7.3", "84a47f7c4231b9efdf4d4f631a2cae2bdd9adeaabc088261d15af040143ed112") add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) @@ -13,22 +14,27 @@ package("mumps") add_syslinks("pthread") end add_links("smumps", "dmumps", "cmumps", "zmumps", "mumps_common", "pord", "mpiseq") + on_install("linux", function (package) import("lib.detect.find_tool") - local fortranc = find_tool("gfortran") - if not fortranc then - raise("gfortran not found!") - end + local fortranc = assert(find_tool("gfortran"), "gfortran not found!") os.cp("Make.inc/Makefile.inc.generic.SEQ", "Makefile.inc") io.replace("Makefile.inc", "ORDERINGSF = -Dpord", "ORDERINGSF = -Dscotch -Dpord", {plain = true}) - io.replace("Makefile.inc", "LAPACK = -llapack", "LAPACK = -lopenblas", {plain = true}) - io.replace("Makefile.inc", "LIBBLAS = -lblas", "LIBBLAS = -lopenblas", {plain = true}) + local links = "-lopenblas" + if package:dep("openblas"):config("openmp") then + links = "-fopenmp " .. links + if package:dep("openblas"):dep("openmp"):dep("libomp") then + links = links .. " -lomp" + end + end + io.replace("Makefile.inc", "LAPACK = -llapack", "LAPACK = " .. links, {plain = true}) + io.replace("Makefile.inc", "LIBBLAS = -lblas", "LIBBLAS = " .. links, {plain = true}) io.replace("Makefile.inc", "f90", fortranc.program, {plain = true}) io.replace("Makefile.inc", "OPTF = -O", "OPTF = -O -std=legacy", {plain = true}) local envs = import("package.tools.make").buildenvs(package) local cflags, ldflags - for _, dep in ipairs(package:orderdeps()) do + for _, dep in ipairs(package:librarydeps()) do local fetchinfo = dep:fetch() if fetchinfo then for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do