jenkins-core-weekly: update to 2.491
[oi-userland.git] / components / scientific / petsc / Makefile
blob161550937fe20a6cde10444135a9cbdf10fb2004
2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"). You may
4 # only use this file in accordance with the terms of the CDDL.
6 # A full copy of the text of the CDDL should have accompanied this
7 # source. A copy of the CDDL is also available via the Internet at
8 # http://www.illumos.org/license/CDDL.
12 # Copyright 2017 Aurelien Larcher
13 # Copyright 2023 Friedrich Kink
16 include ../../../make-rules/shared-macros.mk
18 COMPONENT_MPI_BUILD=mpich openmpi
19 include $(WS_MAKE_RULES)/mpi-macros.mk
21 COMPONENT_NAME= petsc
22 COMPONENT_VERSION= 3.20.0
23 COMPONENT_SUMMARY= PETSc - Portable, Extensible Toolkit for Scientific Computation
24 COMPONENT_PROJECT_URL= https://www.mcs.anl.gov/petsc/
25 COMPONENT_FMRI= library/math/petsc
26 COMPONENT_CLASSIFICATION=System/Libraries
27 COMPONENT_SRC= $(COMPONENT_NAME)-$(COMPONENT_VERSION)
28 COMPONENT_ARCHIVE= $(COMPONENT_NAME)-$(COMPONENT_VERSION).tar.gz
29 COMPONENT_ARCHIVE_URL= https://web.cels.anl.gov/projects/$(COMPONENT_NAME)/download/release-snapshots/$(COMPONENT_ARCHIVE)
30 COMPONENT_ARCHIVE_HASH= sha256:c152ccb12cb2353369d27a65470d4044a0c67e0b69814368249976f5bb232bd4
31 COMPONENT_LICENSE= 2-clause BSD license
33 include $(WS_MAKE_RULES)/common.mk
35 PATH=$(PATH.gnu)
37 PKG_MACROS+= COMPONENT_MPI=$(MPI_IMPLEMENTATION)/$(MPI_COMPILER)
39 COMPONENT_PRE_CONFIGURE_ACTION= ( \
40 $(MKDIR) $(COMPONENT_MPI_BUILD_DIR); \
41 $(CLONEY) $(SOURCE_DIR) $(COMPONENT_MPI_BUILD_DIR); \
44 CFLAGS+= -D_XOPEN_SOURCE=600 -D__EXTENSIONS__
46 CONFIG_SHELL =
47 CONFIGURE_ENV =
48 CONFIGURE_SCRIPT = ./configure
50 # Installation of external packages to destdir is not possible
51 CONFIGURE_OPTIONS = --prefix=$(PROTO_DIR)$(MPI_PREFIX)
52 CONFIGURE_OPTIONS+= --with-mpi-dir=$(MPI_PREFIX)
53 CONFIGURE_OPTIONS+= --with-pic
54 CONFIGURE_OPTIONS+= --with-debugging=0
55 CONFIGURE_OPTIONS+= --with-precision=double
56 CONFIGURE_OPTIONS+= --with-clanguage=C
57 CONFIGURE_OPTIONS+= --with-single-library=0
58 CONFIGURE_OPTIONS+= --with-shared-libraries=1
59 CONFIGURE_OPTIONS+= --with-threadsafety=0
60 CONFIGURE_OPTIONS+= --with-fortran-interfaces=1
61 # numpy package missing
62 #CONFIGURE_OPTIONS+= --with-petsc4py=1
63 CONFIGURE_OPTIONS+= --PETSC_DIR=$(COMPONENT_MPI_BUILD_DIR)
64 CONFIGURE_OPTIONS+= --CFLAGS="$(CFLAGS)"
65 CONFIGURE_OPTIONS+= --CXXFLAGS="$(CXXFLAGS)"
66 CONFIGURE_OPTIONS+= --FFLAGS="$(F77FLAGS)"
67 CONFIGURE_OPTIONS+= --LDFLAGS="$(LDFLAGS)"
68 # External packages
69 CONFIGURE_OPTIONS+= --with-gmp-lib=$(USRLIBDIR64)/libgmp.so
70 CONFIGURE_OPTIONS+= --with-gmp-include=$(USRINCDIR)
71 CONFIGURE_OPTIONS+= --with-hwloc-lib=$(USRLIBDIR64)/libhwloc.so
72 CONFIGURE_OPTIONS+= --with-hwloc-include=$(USRINCDIR)/hwloc
73 ONFIGURE_OPTIONS+= --download-blacs=1
74 CONFIGURE_OPTIONS+= --download-fblaslapack=1
75 CONFIGURE_OPTIONS+= --download-hypre=1
76 # Broken
77 CONFIGURE_OPTIONS+= --download-mumps=1
78 CONFIGURE_OPTIONS+= --download-metis=1
79 # Not redistributable
80 CONFIGURE_OPTIONS+= --download-parmetis=0
81 # Broken
82 CONFIGURE_OPTIONS+= --download-pastix=0
83 CONFIGURE_OPTIONS+= --download-ptscotch=1
84 CONFIGURE_OPTIONS+= --download-scalapack=1
85 CONFIGURE_OPTIONS+= --download-superlu=1
86 CONFIGURE_OPTIONS+= --download-suitesparse=1
87 # PETSc build depends on ParMETIS
88 CONFIGURE_OPTIONS+= --with-zoltan=0
90 COMPONENT_BUILD_ENV = PETSC_DIR=$(COMPONENT_MPI_BUILD_DIR)
91 COMPONENT_INSTALL_ENV= PETSC_DIR=$(COMPONENT_MPI_BUILD_DIR)
92 COMPONENT_TEST_ENV = PETSC_DIR=$(COMPONENT_MPI_BUILD_DIR)
94 # Set relative runpath to mpi directory
95 PETSCLIB_RUNPATH=$(shell realpath -m --relative-to=$(MPI_LIBDIR) $(USRLIBDIR.$(BITS)))
96 PETSCGCC_RUNPATH=$(shell realpath -m --relative-to=$(MPI_LIBDIR) $(MPI_COMPILER_LIBDIR))
98 # Remove destdir to generated variables
99 PETSC_FILES =include/petscconf.h
100 PETSC_FILES+=include/petscmachineinfo.h
101 PETSC_FILES+=include/petscconfiginfo.h
102 PETSC_FILES+=lib/petsc/conf/rules
103 PETSC_FILES+=lib/petsc/conf/petscrules
104 PETSC_FILES+=lib/petsc/conf/petscvariables
105 PETSC_FILES+=lib/petsc/conf/modules/petsc/$(COMPONENT_VERSION)
106 PETSC_FILES+=lib/petsc/conf/reconfigure-arch-sunos5-c-opt.py
107 PETSC_FILES+=lib/petsc/conf/uninstall.py
108 PETSC_FILES+=lib/petsc/conf/variables
109 PETSC_FILES+=lib/petsc/conf/PETScBuildInternal.cmake
110 PETSC_FILES+=lib/pkgconfig/PETSc.pc
111 PETSC_FILES+=lib/pkgconfig/superlu.pc
112 # Each external package configuration should be processed
113 PETSC_FILES+=lib/petsc/conf/pkg.conf.fblaslapack
114 PETSC_FILES+=lib/petsc/conf/pkg.conf.hypre
115 PETSC_FILES+=lib/petsc/conf/pkg.conf.metis
116 PETSC_FILES+=lib/petsc/conf/pkg.conf.mumps
117 PETSC_FILES+=lib/petsc/conf/pkg.conf.ptscotch
118 PETSC_FILES+=lib/petsc/conf/pkg.conf.scalapack
119 PETSC_FILES+=lib/petsc/conf/pkg.conf.suitesparse
120 PETSC_FILES+=lib/petsc/conf/pkg.conf.superlu
121 PETSC_FILES+=share/petsc/examples/gmakefile.test
123 # Fix runtime path
124 PETSC_LIBS =lib/libpetscdm.so.$(COMPONENT_VERSION)
125 PETSC_LIBS+=lib/libpetscksp.so.$(COMPONENT_VERSION)
126 PETSC_LIBS+=lib/libpetscmat.so.$(COMPONENT_VERSION)
127 PETSC_LIBS+=lib/libpetscsnes.so.$(COMPONENT_VERSION)
128 PETSC_LIBS+=lib/libpetscsys.so.$(COMPONENT_VERSION)
129 PETSC_LIBS+=lib/libpetsctao.so.$(COMPONENT_VERSION)
130 PETSC_LIBS+=lib/libpetscts.so.$(COMPONENT_VERSION)
131 PETSC_LIBS+=lib/libpetscvec.so.$(COMPONENT_VERSION)
132 PETSC_LIBS+=lib/libHYPRE-2.29.0.so
133 PETSC_LIBS+=lib/libamd.so
134 PETSC_LIBS+=lib/libbtf.so
135 PETSC_LIBS+=lib/libcamd.so
136 PETSC_LIBS+=lib/libccolamd.so
137 PETSC_LIBS+=lib/libcholmod.so
138 PETSC_LIBS+=lib/libcolamd.so
139 PETSC_LIBS+=lib/libklu.so
140 PETSC_LIBS+=lib/libmetis.so
141 PETSC_LIBS+=lib/libscalapack.so
142 PETSC_LIBS+=lib/libspqr.so
143 PETSC_LIBS+=lib/libsuitesparseconfig.so
144 PETSC_LIBS+=lib/libsuperlu.so
145 PETSC_LIBS+=lib/libumfpack.so
147 COMPONENT_POST_INSTALL_ACTION = ( \
148 $(FIND) $(PROTO_DIR)$(MPI_PREFIX) -name *.py -exec \
149 $(GSED) -i -e '1 s:\#!/usr/bin/env python[0-9.]*:\#!/usr/bin/python$(PYTHON_VERSION):' {} \; ; \
150 $(GSED) -i -e '1 s:\#!/usr/bin/env python[0-9.]*:\#!/usr/bin/python$(PYTHON_VERSION):' \
151 $(PROTO_DIR)$(MPI_LIBDIR)/petsc/bin/petscnagfor ; \
152 for f in $(PETSC_FILES); \
153 do \
154 $(GSED) -i -e 's|$(PROTO_DIR)||g' \
155 -e 's|$(COMPONENT_MPI_BUILD_DIR)|$(MPI_PREFIX)|g' \
156 -e 's|$(COMPONENT_DIR)|.|g' \
157 $(PROTO_DIR)$(MPI_PREFIX)/$$f; \
158 done; \
159 for f in $(PETSC_LIBS); \
160 do \
161 /usr/bin/elfedit -e 'dyn:runpath "$$ORIGIN:$$ORIGIN/$(PETSCGCC_RUNPATH):$$ORIGIN/$(PETSCLIB_RUNPATH)"' \
162 $(PROTO_DIR)$(MPI_PREFIX)/$$f; \
163 done; )
165 # DESTDIR should be removed as we install directly in the proto area
166 COMPONENT_INSTALL_ARGS=
168 # MPI dependencies
169 REQUIRED_PACKAGES += library/mpich/gcc
170 REQUIRED_PACKAGES += library/openmpi/gcc
172 # Auto-generated dependencies
173 PYTHON_REQUIRED_PACKAGES += runtime/python
174 REQUIRED_PACKAGES += SUNWcs
175 REQUIRED_PACKAGES += shell/bash
176 REQUIRED_PACKAGES += shell/ksh93