Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions Formula/brewsci-mumps.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
class BrewsciMumps < Formula
desc "Parallel Sparse Direct Solver"
homepage "http://mumps-solver.org"
url "http://mumps.enseeiht.fr/MUMPS_5.3.5.tar.gz"
homepage "https://mumps-solver.org"
# The old mumps.enseeiht.fr mirror no longer responds; the official
# mumps-solver.org host serves the identical tarball (same sha256).
url "https://mumps-solver.org/MUMPS_5.3.5.tar.gz"
sha256 "e5d665fdb7043043f0799ae3dbe3b37e5b200d1ab7a6f7b2a4e463fd89507fa4"

bottle do
Expand Down Expand Up @@ -129,33 +131,39 @@ def install

# make shared lib
so = OS.mac? ? "dylib" : "so"
all_load = OS.mac? ? "-all_load" : "--whole-archive"
noall_load = OS.mac? ? "-noall_load" : "--no-whole-archive"
# Force-load the static archive into the shared lib. The macOS branch used
# "-all_load <archive> ... -noall_load", but the linker in Xcode 16+ removed
# -noall_load ("ld: unknown options: -noall_load"). -force_load,<archive>
# targets a single archive and needs no matching "undo" flag; Linux keeps the
# --whole-archive / --no-whole-archive wrap around the .a.
force_load = lambda do |archive|
OS.mac? ? ["-Wl,-force_load,#{archive}"] : ["-Wl,--whole-archive", archive, "-Wl,--no-whole-archive"]
end
compiler = OS.mac? ? "gfortran" : "mpif90" # mpif90 causes segfaults on macOS
shopts = OS.mac? ? ["-undefined", "dynamic_lookup"] : []
install_name = ->(libname) { OS.mac? ? ["-Wl,-install_name", "-Wl,#{lib}/#{libname}.#{so}"] : [] }
cd "lib" do
libpord_install_name = install_name.call("libpord")
system compiler, "-fPIC", "-shared", "-Wl,#{all_load}", "libpord.a", *lib_args, \
"-Wl,#{noall_load}", *libpord_install_name, *shopts, "-o", "libpord.#{so}"
system compiler, "-fPIC", "-shared", *force_load.call("libpord.a"), *lib_args, \
*libpord_install_name, *shopts, "-o", "libpord.#{so}"
lib.install "libpord.#{so}"
libmumps_common_install_name = install_name.call("libmumps_common")
system compiler, "-fPIC", "-shared", "-Wl,#{all_load}", "libmumps_common.a", *lib_args, \
"-L#{lib}", "-lpord", "-Wl,#{noall_load}", *libmumps_common_install_name, \
system compiler, "-fPIC", "-shared", *force_load.call("libmumps_common.a"), *lib_args, \
"-L#{lib}", "-lpord", *libmumps_common_install_name, \
*shopts, "-o", "libmumps_common.#{so}"
lib.install "libmumps_common.#{so}"
%w[libsmumps libdmumps libcmumps libzmumps].each do |l|
libinstall_name = install_name.call(l)
system compiler, "-fPIC", "-shared", "-Wl,#{all_load}", "#{l}.a", *lib_args, \
"-L#{lib}", "-lpord", "-lmumps_common", "-Wl,#{noall_load}", *libinstall_name, \
system compiler, "-fPIC", "-shared", *force_load.call("#{l}.a"), *lib_args, \
"-L#{lib}", "-lpord", "-lmumps_common", *libinstall_name, \
*shopts, "-o", "#{l}.#{so}"
end
end
if build.without? "open-mpi"
cd "libseq" do
libmpiseq_install_name = install_name.call("libmpiseq")
system compiler, "-fPIC", "-shared", "-Wl,#{all_load}", "libmpiseq.a", *lib_args, \
"-Wl,#{noall_load}", *libmpiseq_install_name, *shopts, "-o", "libmpiseq.#{so}"
system compiler, "-fPIC", "-shared", *force_load.call("libmpiseq.a"), *lib_args, \
*libmpiseq_install_name, *shopts, "-o", "libmpiseq.#{so}"
end
end

Expand Down