mpiserial: rework installation (#40762)

This commit is contained in:
Jim Edwards 2023-12-06 01:39:08 -07:00 committed by GitHub
parent b0f193071d
commit 84999b6996
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 38 deletions

View file

@ -1,34 +0,0 @@
--- old/Makefile
+++ new/Makefile
@@ -76,6 +76,9 @@
.PHONY: clean tests install
+includedir = $(PREFIX)/include
+libdir = $(PREFIX)/lib
+
clean:
/bin/rm -f *.o ctest ftest $(LIB) mpi.mod config.log config.status
cd tests ; $(MAKE) clean
@@ -83,7 +86,7 @@
tests:
cd tests; make
-install: lib
+install: $(LIB)
$(MKINSTALLDIRS) $(libdir) $(includedir)
$(INSTALL) lib$(MODULE).a -m 644 $(libdir)
$(INSTALL) mpi.h -m 644 $(includedir)
--- old/Makefile.conf.in
+++ new/Makefile.conf.in
@@ -10,7 +10,8 @@
LIBS = @LIBS@
CRULE = .c.o
F90RULE = .F90.o
-
+MKINSTALLDIRS = mkdir
SHELL = /bin/sh
-
+INSTALL = install
MODULE = mpi-serial
+PREFIX = @prefix@

View file

@ -3,6 +3,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack.package import *
@ -31,8 +33,6 @@ class MpiSerial(AutotoolsPackage):
description="Specify the size of Fortran double precision variables",
)
patch("install.patch")
provides("mpi")
def flag_handler(self, name, flags):
@ -41,8 +41,7 @@ def flag_handler(self, name, flags):
if name == "cflags":
config_flags.append(self.compiler.cc_pic_flag)
if spec.compiler.name in ["oneapi"]:
if spec.satisfies("%oneapi"):
# OneAPI fails due to these standards checks
config_flags.append("-Wno-error=implicit-int")
config_flags.append("-Wno-error=implicit-function-declaration")
@ -62,3 +61,14 @@ def configure_args(self):
args.extend(["--enable-fort-double={0}".format(doublesize)])
return args
def install(self, spec, prefix):
mkdir(prefix.lib)
mkdir(prefix.include)
install("libmpi-serial.a", prefix.lib)
install("mpi.h", prefix.include)
install("mpif.h", prefix.include)
if os.path.isfile("mpi.mod"):
install("mpi.mod", prefix.include)
if os.path.isfile("MPI.mod"):
install("MPI.mod", prefix.include)