From 8794f1b4c2188cf9f0bbdff0e726ad92f7ca4247 Mon Sep 17 00:00:00 2001 From: xq114 <1140735506@qq.com> Date: Sun, 25 Aug 2024 22:46:13 +0800 Subject: [PATCH 1/3] update scotch --- packages/s/scotch/xmake.lua | 92 ++++++++++++++++++++++++++----------- 1 file changed, 64 insertions(+), 28 deletions(-) diff --git a/packages/s/scotch/xmake.lua b/packages/s/scotch/xmake.lua index 04e7c1e6e07..957a94cfaf1 100644 --- a/packages/s/scotch/xmake.lua +++ b/packages/s/scotch/xmake.lua @@ -6,43 +6,79 @@ package("scotch") add_urls("https://gitlab.inria.fr/scotch/scotch/-/archive/$(version)/scotch-$(version).zip", "https://gitlab.inria.fr/scotch/scotch.git") add_versions("v6.1.1", "21d001c390ec63ac60f987b9921f33cc1967b41cf07567e22cbf3253cda8962a") + add_versions("v7.0.5", "fd52e97844115dce069220bacbfb45fccdf83d425614b02b67b44cedf9d72640") + + add_configs("zlib", {description = "Use ZLIB compression format.", default = true, type = "boolean"}) + add_configs("lzma", {description = "Use LZMA compression format.", default = false, type = "boolean"}) + add_configs("bz2", {description = "Use BZ2 compression format.", default = false, type = "boolean"}) - add_deps("zlib") if is_plat("linux") then add_syslinks("pthread") end - add_links("esmumps", "scotch", "scotcherr", "scotcherrexit", "scotchmetis") - on_install("macosx|x86_64", "linux", function (package) - os.cd("src") - if package:is_plat("macosx") then - os.cp("Make.inc/Makefile.inc.i686_mac_darwin10", "Makefile.inc") - elseif package:is_plat("linux") then - local basename - if package:is_arch("x86_64") then - basename = "Make.inc/Makefile.inc.x86-64_pc_linux2" - elseif package:is_arch("i386", "x86") then - basename = "Make.inc/Makefile.inc.i686_pc_linux2" + -- add_links("esmumps", "scotch", "scotcherr", "scotcherrexit", "scotchmetis") + on_load(function (package) + if package:version():ge("7.0.0") then + package:add("deps", "cmake") + package:add("deps", "flex", "bison") + if package:config("zlib") then + package:add("deps", "zlib") + end + if package:config("lzma") then + package:add("deps", "xz") end - os.cp(basename .. (package:config("shared") and ".shlib" or ""), "Makefile.inc") + if package:config("bz2") then + package:add("deps", "bzip2") + end + else + package:add("deps", "zlib") end - io.replace("Makefile.inc", "CFLAGS%s+=", "CFLAGS := $(CFLAGS)") - io.replace("Makefile.inc", "LDFLAGS%s+=", "LDFLAGS := $(LDFLAGS)") - local envs = import("package.tools.make").buildenvs(package) - local zlib = package:dep("zlib"):fetch() - if zlib then - local cflags, ldflags - for _, includedir in ipairs(zlib.sysincludedirs or zlib.includedirs) do - cflags = (cflags or "") .. " -I" .. includedir + end) + + on_install("macosx", "linux", function (package) + if package:version():ge("7.0.0") then + local configs = {"-DENABLE_TESTS=OFF", "-DBUILD_PTSCOTCH=OFF"} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release")) + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + table.insert(configs, "-DUSE_ZLIB=" .. (package:config("zlib") and "ON" or "OFF")) + table.insert(configs, "-DUSE_LZMA=" .. (package:config("lzma") and "ON" or "OFF")) + table.insert(configs, "-DUSE_BZ2=" .. (package:config("bz2") and "ON" or "OFF")) + import("package.tools.cmake").install(package, configs) + + elseif package:is_plat("macosx", "linux") then + os.cd("src") + if package:is_plat("macosx") then + os.cp("Make.inc/Makefile.inc.i686_mac_darwin10", "Makefile.inc") + elseif package:is_plat("linux") then + local basename + if package:is_arch("x86_64") then + basename = "Make.inc/Makefile.inc.x86-64_pc_linux2" + elseif package:is_arch("i386", "x86") then + basename = "Make.inc/Makefile.inc.i686_pc_linux2" + end + os.cp(basename .. (package:config("shared") and ".shlib" or ""), "Makefile.inc") end - for _, linkdir in ipairs(zlib.linkdirs) do - ldflags = (ldflags or "") .. " -L" .. linkdir + io.replace("Makefile.inc", "CFLAGS%s+=", "CFLAGS := $(CFLAGS)") + io.replace("Makefile.inc", "LDFLAGS%s+=", "LDFLAGS := $(LDFLAGS)") + local envs = import("package.tools.make").buildenvs(package) + local zlib = package:dep("zlib"):fetch() + if zlib then + local cflags, ldflags + for _, includedir in ipairs(zlib.sysincludedirs or zlib.includedirs) do + cflags = (cflags or "") .. " -I" .. includedir + end + for _, linkdir in ipairs(zlib.linkdirs) do + ldflags = (ldflags or "") .. " -L" .. linkdir + end + envs.CFLAGS = cflags + envs.LDFLAGS = ldflags end - envs.CFLAGS = cflags - envs.LDFLAGS = ldflags + os.vrunv("make", {"scotch"}, {envs = envs}) + os.vrunv("make", {"esmumps"}, {envs = envs}) + os.vrunv("make", {"prefix=" .. package:installdir(), "install"}, {envs = envs}) + + else + raise("Unsupported platform!") end - os.vrunv("make", {"scotch"}, {envs = envs}) - os.vrunv("make", {"esmumps"}, {envs = envs}) - os.vrunv("make", {"prefix=" .. package:installdir(), "install"}, {envs = envs}) end) on_test(function (package) From ffe1a12e7b1315dded26cb2abbbab8c80ecf2bfa Mon Sep 17 00:00:00 2001 From: xq114 <1140735506@qq.com> Date: Tue, 27 Aug 2024 15:55:10 +0800 Subject: [PATCH 2/3] add gfortran dep --- .github/workflows/macos_arm64.yml | 2 ++ .github/workflows/macos_x86_64.yml | 2 ++ packages/s/scotch/xmake.lua | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/macos_arm64.yml b/.github/workflows/macos_arm64.yml index a551c168742..3f728a5185b 100644 --- a/.github/workflows/macos_arm64.yml +++ b/.github/workflows/macos_arm64.yml @@ -30,4 +30,6 @@ jobs: run: | wget https://curl.haxx.se/ca/cacert.pem -O /tmp/cacert.pem export CURL_CA_BUNDLE=/tmp/cacert.pem + sudo ln /opt/homebrew/bin/gfortran-14 /opt/homebrew/bin/gfortran + export PATH="$PATH:/opt/homebrew/Cellar/gcc/14.1.0_2/libexec/gcc/aarch64-apple-darwin23/14/" xmake l ./scripts/test.lua -D -a ${{ matrix.arch }} -k ${{ matrix.kind }} diff --git a/.github/workflows/macos_x86_64.yml b/.github/workflows/macos_x86_64.yml index b04b51e0d22..bb999406812 100644 --- a/.github/workflows/macos_x86_64.yml +++ b/.github/workflows/macos_x86_64.yml @@ -30,4 +30,6 @@ jobs: run: | wget https://curl.haxx.se/ca/cacert.pem -O /tmp/cacert.pem export CURL_CA_BUNDLE=/tmp/cacert.pem + sudo ln /usr/local/bin/gfortran-14 /usr/local/bin/gfortran + export PATH="$PATH:/usr/local/Cellar/gcc/14.1.0_2/libexec/gcc/x86_64-apple-darwin21/14/" xmake l ./scripts/test.lua -D -a ${{ matrix.arch }} -k ${{ matrix.kind }} diff --git a/packages/s/scotch/xmake.lua b/packages/s/scotch/xmake.lua index 957a94cfaf1..a8a1fd782ef 100644 --- a/packages/s/scotch/xmake.lua +++ b/packages/s/scotch/xmake.lua @@ -15,11 +15,12 @@ package("scotch") if is_plat("linux") then add_syslinks("pthread") end - -- add_links("esmumps", "scotch", "scotcherr", "scotcherrexit", "scotchmetis") + add_links("ptesmumps", "esmumps", "scotch", "scotcherr", "scotcherrexit", "scotchmetis", "scotchmetisv5", "scotchmetisv3") on_load(function (package) if package:version():ge("7.0.0") then package:add("deps", "cmake") package:add("deps", "flex", "bison") + package:add("deps", "gfortran", {kind = "binary"}) if package:config("zlib") then package:add("deps", "zlib") end From d19da1e5bcc1688c0e054cf320c6ace04a927336 Mon Sep 17 00:00:00 2001 From: xq114 <1140735506@qq.com> Date: Tue, 27 Aug 2024 23:41:50 +0800 Subject: [PATCH 3/3] switch to package.tools.make --- packages/s/scotch/xmake.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/s/scotch/xmake.lua b/packages/s/scotch/xmake.lua index a8a1fd782ef..23f1c8051b3 100644 --- a/packages/s/scotch/xmake.lua +++ b/packages/s/scotch/xmake.lua @@ -46,6 +46,8 @@ package("scotch") import("package.tools.cmake").install(package, configs) elseif package:is_plat("macosx", "linux") then + import("package.tools.make") + os.cd("src") if package:is_plat("macosx") then os.cp("Make.inc/Makefile.inc.i686_mac_darwin10", "Makefile.inc") @@ -60,7 +62,7 @@ package("scotch") end io.replace("Makefile.inc", "CFLAGS%s+=", "CFLAGS := $(CFLAGS)") io.replace("Makefile.inc", "LDFLAGS%s+=", "LDFLAGS := $(LDFLAGS)") - local envs = import("package.tools.make").buildenvs(package) + local envs = make.buildenvs(package) local zlib = package:dep("zlib"):fetch() if zlib then local cflags, ldflags @@ -73,9 +75,9 @@ package("scotch") envs.CFLAGS = cflags envs.LDFLAGS = ldflags end - os.vrunv("make", {"scotch"}, {envs = envs}) - os.vrunv("make", {"esmumps"}, {envs = envs}) - os.vrunv("make", {"prefix=" .. package:installdir(), "install"}, {envs = envs}) + make.make(package, {"scotch"}, {envs = envs}) + make.make(package, {"esmumps"}, {envs = envs}) + make.make(package, {"prefix=" .. package:installdir(), "install"}, {envs = envs}) else raise("Unsupported platform!")