Skip to content
Merged
Show file tree
Hide file tree
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
111 changes: 111 additions & 0 deletions M/MUMPS/MUMPS_seq_MKL/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
using BinaryBuilder

name = "MUMPS_seq_MKL"
version = v"5.3.5"

sources = [
ArchiveSource("http://mumps.enseeiht.fr/MUMPS_$version.tar.gz",
"e5d665fdb7043043f0799ae3dbe3b37e5b200d1ab7a6f7b2a4e463fd89507fa4"),
DirectorySource("./bundled"),
]

# Bash recipe for building across all platforms
script = raw"""
mkdir -p ${libdir}
cd $WORKSPACE/srcdir/MUMPS*
atomic_patch -p1 ${WORKSPACE}/srcdir/patches/mumps_int32.patch

makefile="Makefile.INTEL.SEQ"
cp Make.inc/${makefile} Makefile.inc

libmkl=(-lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -liomp5 -lpthread -lm -ldl)
if [[ ${target} == *mingw* ]]; then
libmkl=(${libdir}/mkl_rt.dll ${libdir}/mkl_intel_thread.dll ${libdir}/libiomp5md.dll ${libdir}/libwinpthread-1.dll)
fi

optf=(-O -DGEMMT_AVAILABLE)
optl=(-O)
optc=(-O)

make_args+=(OPTF=-O3
CDEFS=-DAdd_
LMETISDIR=${libdir}
IMETIS=-I${prefix}/include
LMETIS='-L$(LMETISDIR) -lmetis'
ORDERINGSF="-Dpord -Dmetis"
CC="$CC -fPIC ${CFLAGS[@]}"
FC="gfortran -fPIC ${FFLAGS[@]}"
FL="gfortran -fPIC"
OPTF="${optf[@]}"
OPTL="${optl[@]}"
OPTC="${optc[@]}"
LIBBLAS="${libmkl[@]}")

if [[ "${target}" == *-apple* ]]; then
make_args+=(RANLIB=echo)
fi

# NB: parallel build fails
make alllib "${make_args[@]}"

# build shared libs
all_load="--whole-archive"
noall_load="--no-whole-archive"
extra=""
if [[ "${target}" == *-apple-* ]]; then
all_load="-all_load"
noall_load="-noall_load"
extra="-Wl,-undefined -Wl,dynamic_lookup -headerpad_max_install_names"
fi

cd libseq
gfortran -fPIC -shared -Wl,${all_load} libmpiseq.a ${libs[@]} -Wl,${noall_load} ${extra[@]} -o libmpiseq.${dlext}
cp libmpiseq.${dlext} ${libdir}

cd ../lib
libs=(-L${libdir} -lmetis -lmpiseq)
gfortran -fPIC -shared -Wl,${all_load} libpord.a ${libs[@]} ${libmkl[@]} -Wl,${noall_load} ${extra[@]} -o libpord.${dlext}
cp libpord.${dlext} ${libdir}

libs+=(-lpord)
gfortran -fPIC -shared -Wl,${all_load} libmumps_common.a ${libs[@]} ${libmkl[@]} -Wl,${noall_load} ${extra[@]} -o libmumps_common.${dlext}
cp libmumps_common.${dlext} ${libdir}

libs+=(-lmumps_common)
for libname in cmumps dmumps smumps zmumps
do
gfortran -fPIC -shared -Wl,${all_load} lib${libname}.a ${libs[@]} ${libmkl[@]} -Wl,${noall_load} ${extra[@]} -o lib${libname}.${dlext}
done
cp *.${dlext} ${libdir}
cd ..

mkdir -p ${prefix}/include/mumps_seq
cp include/* ${prefix}/include/mumps_seq
cp libseq/*.h ${prefix}/include/mumps_seq
"""

platforms = [
Platform("x86_64", "linux"; libc="glibc"),
Platform("x86_64", "macos"),
Platform("i686", "windows"),
Platform("x86_64", "windows"),
]
platforms = expand_gfortran_versions(expand_cxxstring_abis(platforms))

# The products that we will ensure are always built
products = [
LibraryProduct("libsmumps", :libsmumps),
LibraryProduct("libdmumps", :libdmumps),
LibraryProduct("libcmumps", :libcmumps),
LibraryProduct("libzmumps", :libzmumps),
]

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency("CompilerSupportLibraries_jll"),
Dependency("METIS_jll"),
Dependency("MKL_jll"),
]

# Build the tarballs
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)
16 changes: 16 additions & 0 deletions M/MUMPS/MUMPS_seq_MKL/bundled/patches/mumps_int32.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/src/Makefile b/src/Makefile
index cf7c705..94562c8 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -28,7 +28,10 @@ mumps_lib: $(incdir)/mumps_int_def.h \

# Build $(incdir)/mumps_int_def.h, needed by mumps_c_types.h
$(incdir)/mumps_int_def.h: build_mumps_int_def
- ./build_mumps_int_def > $(incdir)/mumps_int_def.h
+ echo "#if ! defined(MUMPS_INT_H)" > $(incdir)/mumps_int_def.h
+ echo "# define MUMPS_INT_H" >> $(incdir)/mumps_int_def.h
+ echo "# define MUMPS_INTSIZE32" >> $(incdir)/mumps_int_def.h
+ echo "#endif" >> $(incdir)/mumps_int_def.h
build_mumps_int_def:build_mumps_int_def.o
$(CC) $(OPTL) build_mumps_int_def.o -o build_mumps_int_def