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 04e7c1e6e07..23f1c8051b3 100644 --- a/packages/s/scotch/xmake.lua +++ b/packages/s/scotch/xmake.lua @@ -6,43 +6,82 @@ 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("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 + 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 + import("package.tools.make") + + 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 = 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 + 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!") 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)