Skip to content

Commit 502cc28

Browse files
committed
GALAHAD: build against MUMPS
1 parent 500b8c2 commit 502cc28

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

galahad.rb

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ class Galahad < Formula
33
homepage "https://github.com/ralna/GALAHAD"
44
url "https://github.com/ralna/GALAHAD/archive/refs/tags/v5.3.0.tar.gz"
55
sha256 "132be2493829afa4b8d0dc60f8e8dd5f9ceaf30a4df58db49e5efade5ffc7ce5"
6+
revision 1
67

78
head "https://github.com/ralna/GALAHAD.git", branch: "master"
89

@@ -17,13 +18,62 @@ class Galahad < Formula
1718
depends_on "ninja" => :build
1819
depends_on "gcc"
1920
depends_on "hwloc"
21+
depends_on "metis"
2022
depends_on "openblas"
2123

2224
depends_on "optimizers/cutest/cutest"
2325

2426
fails_with :clang
2527

28+
resource "mumps" do
29+
url "https://mumps-solver.org/MUMPS_5.8.1.tar.gz"
30+
sha256 "e91b6dcd93597a34c0d433b862cf303835e1ea05f12af073b06c32f652f3edd8"
31+
end
32+
2633
def install
34+
ENV.delete("MPICC")
35+
ENV.delete("MPICXX")
36+
ENV.delete("MPIFC")
37+
38+
resource("mumps").stage do
39+
cp "Make.inc/Makefile.inc.generic.SEQ", "Makefile.inc"
40+
make_args = ["RANLIB=echo", "FC=gfortran", "FL=gfortran"]
41+
if OS.mac?
42+
make_args << "AR = gfortran -dynamiclib -undefined dynamic_lookup -Wl,-install_name,#{lib}/$(notdir $@) -o"
43+
end
44+
45+
make_args << "LIBEXT=.so" if OS.linux?
46+
make_args << "LIBEXT=.dylib" if OS.mac?
47+
48+
optf = ["OPTF=-O -fPIC"]
49+
gcc_major_ver = Formula["gcc"].any_installed_version.major
50+
optf << "-fallow-argument-mismatch" if gcc_major_ver >= 10
51+
make_args << optf.join(" ")
52+
make_args << "OPTC=-O -fPIC -I."
53+
orderingsf = "-Dpord"
54+
55+
metis_libs = ["-L#{Formula["metis"].opt_lib}", "-lmetis"]
56+
make_args += ["LMETISDIR=#{Formula["metis"].opt_lib}",
57+
"IMETIS=#{Formula["metis"].opt_include}",
58+
"LMETIS=#{metis_libs.join(" ")}"]
59+
orderingsf << " -Dmetis"
60+
61+
make_args << "ORDERINGSF=#{orderingsf}"
62+
63+
blas_lib = ["-L#{Formula["openblas"].opt_lib}", "-lopenblas"]
64+
make_args << "LIBBLAS=#{blas_lib.join(" ")}"
65+
make_args << "LAPACK=#{blas_lib.join(" ")}"
66+
67+
ENV.deparallelize { system "make", "all", *make_args }
68+
69+
(buildpath/"mumps_include").install Dir["include/*.h", "libseq/mpi.h"]
70+
lib.install Dir[
71+
"lib/#{shared_library("*")}",
72+
"libseq/#{shared_library("*")}",
73+
"PORD/lib/#{shared_library("*")}",
74+
]
75+
end
76+
2777
# Environment variables for the unit tests
2878
ENV["OMP_CANCELLATION"] = "TRUE"
2979
ENV["OMP_PROC_BIND"] = "TRUE"
@@ -35,6 +85,7 @@ def install
3585
"-Dbinaries=true",
3686
"-Dlibcutest_path=#{Formula["cutest"].opt_lib}",
3787
"-Dlibcutest_modules=#{Formula["cutest"].opt_prefix}/modules",
88+
"-Dlibmumps_path=#{lib}",
3889
"-Dciface=true",
3990
"-Dquadruple=true",
4091
"-Db_sanitize=none", # https://github.com/ralna/GALAHAD/pull/386

0 commit comments

Comments
 (0)