forked from openhpc/ohpc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OHPC_macros
212 lines (186 loc) · 7.06 KB
/
OHPC_macros
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# OpenHPC build script/utilities
#
#-----------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License"); you
# may not use this file except in compliance with the License. You may
# obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#-----------------------------------------------------------------------
# Top-level OpenHPC installation paths
%global PROJ_NAME ohpc
%global OHPC_HOME /opt/%{PROJ_NAME}
%global OHPC_ADMIN %{OHPC_HOME}/admin
%global OHPC_PUB %{OHPC_HOME}/pub
%global OHPC_APPS %{OHPC_PUB}/apps
%global OHPC_COMPILERS %{OHPC_PUB}/compiler
%global OHPC_LIBS %{OHPC_PUB}/libs
%global OHPC_MODULES %{OHPC_PUB}/modulefiles
%global OHPC_MODULEDEPS %{OHPC_PUB}/moduledeps
%global OHPC_MPI_STACKS %{OHPC_PUB}/mpi
%global OHPC_UTILS %{OHPC_PUB}/utils
%global debug_package %{nil}
%global dist .ohpc.2.0.0
%{!?PROJ_DELIM: %global PROJ_DELIM -ohpc}
DocDir: %{OHPC_PUB}/doc/contrib
# Define PNAME which can be used in modulefile generation for env vars (derived
# from pname defined in each component .spec file)
%define PNAME %(echo %{pname} | tr [a-z] [A-Z] | tr - _)
# Instead of having Source[1-9]: OHPC_macros in every SPEC file,
# this sets Source42 for all SPEC files which include OHPC_macros.
Source42: OHPC_macros
# Pre-process global OS version macros for operation outside OBS
# Supports build on clone distros without requiring distro-specific
# macros defined in each specfile.
%if 0%{!?rhel_version:1}
%{?centos_version:%global rhel_version %{centos_version}}
%{?scientificlinux_version:%global rhel_version %{scientific_version}}
%if 0%{?rhel} == 7
# OBS defines rhel_version to 700 for RHEL7
%global rhel_version 700
%endif # rhel=7
%if 0%{?rhel} == 8
# OBS defines rhel_version to 800 for RHEL8
%global rhel_version 800
%endif # rhel=8
%endif # rhel_version
# OpenHPC packages also require ohpc-buildroot to access macros used to define
# compiler and MPI families
%if 0%{!?ohpc_bootstrap:1}
Requires: ohpc-filesystem
BuildRequires: ohpc-buildroot
%endif
# OpenHPC convention: the default build configuration for compiler/MPI
# dependent packages assumes the gnu compiler and openmpi family; however,
# these choices can be overridden by specifing the compiler_family/mpi_family
# variables via rpmbuild or other mechanisms.
%{!?compiler_family: %global compiler_family gnu9}
%{!?mpi_family: %global mpi_family openmpi4}
%{!?python_family: %global python_family python3}
# Compiler dependencies
%if 0%{?ohpc_compiler_dependent} == 1
%if "%{compiler_family}" == "gnu9"
BuildRequires: gnu9-compilers%{PROJ_DELIM} >= 9.2.0
Requires: gnu9-compilers%{PROJ_DELIM} >= 9.2.0
%endif # gnu9
%if "%{compiler_family}" == "gnu8"
BuildRequires: gnu8-compilers%{PROJ_DELIM} >= 8.3.0
Requires: gnu8-compilers%{PROJ_DELIM} >= 8.3.0
%endif # gnu8
%if "%{compiler_family}" == "intel"
%if 0%{?OHPC_BUILD}
BuildRequires: intel_licenses
BuildRequires: psxe%{PROJ_DELIM}
%endif # OHPC_BUILD
BuildRequires: gcc-c++ intel-compilers-devel%{PROJ_DELIM}
Requires: gcc-c++ intel-compilers-devel%{PROJ_DELIM}
%endif # intel
%if "%{compiler_family}" == "arm1"
%if 0%{?OHPC_BUILD}
BuildRequires: arm_licenses
BuildRequires: arm%{PROJ_DELIM}
%endif # OHPC_BUILD
BuildRequires: arm1-compilers-devel%{PROJ_DELIM}
Requires: arm1-compilers-devel%{PROJ_DELIM}
%endif # arm
%if "%{compiler_family}" == "llvm"
BuildRequires: llvm-compilers%{PROJ_DELIM} >= 9.0.0
Requires: llvm-compilers%{PROJ_DELIM} >= 9.0.0
%endif # llvm
# Disable annobin on RHEL based systems
%if 0%{?rhel} == 8
%undefine _annotated_build
%endif
%endif # compiler_depdendent
# Disable generation of .build-id links
%global _build_id_links none
# Disable RPM symlink analysis on files in %%{OHPC_HOME}.
%global __libsymlink_exclude_path %{OHPC_HOME}/.*$
# MPI dependencies
%if 0%{?ohpc_mpi_dependent} == 1
%if "%{mpi_family}" == "impi"
%if 0%{?OHPC_BUILD}
BuildRequires: impi%{PROJ_DELIM}
%endif # OHPC_BUILD
BuildRequires: intel-mpi-devel%{PROJ_DELIM}
Requires: intel-mpi-devel%{PROJ_DELIM}
%global __requires_exclude ^libmpi\\.so.*$|^libmpifort\\.so.*$|^libmpicxx\\.so.*$
%endif # impi
%if "%{mpi_family}" == "mpich"
BuildRequires: mpich-%{compiler_family}%{PROJ_DELIM}
Requires: mpich-%{compiler_family}%{PROJ_DELIM}
%endif # mpich
%if "%{mpi_family}" == "mvapich2"
BuildRequires: mvapich2-%{compiler_family}%{PROJ_DELIM}
Requires: mvapich2-%{compiler_family}%{PROJ_DELIM}
%endif # mvapich2
%if "%{mpi_family}" == "openmpi3"
BuildRequires: openmpi3-%{compiler_family}%{PROJ_DELIM}
Requires: openmpi3-%{compiler_family}%{PROJ_DELIM}
%endif # openmpi3
%if "%{mpi_family}" == "openmpi4"
BuildRequires: openmpi4-%{compiler_family}%{PROJ_DELIM}
Requires: openmpi4-%{compiler_family}%{PROJ_DELIM}
%endif # openmpi4
%endif # ohpc_mpi_dependent
# Python dependencies and macros
%if 0%{?ohpc_python_dependent} == 1
%global __python %__python3
%global python_module_prefix py3-
%global python_site_dir %{python3_sitearch}
%global python_prefix python3
%global python_lib_dir python%{python3_version}
BuildRequires: %{python_prefix}-devel
BuildRequires: %{python_prefix}-setuptools
BuildRequires: python-rpm-macros
Requires: %{python_prefix}
%endif
# Single-line macro for running compiler/MPI setup scripts
# Script bodies are evaluated and stored in this macro definition
%global ohpc_setup_compiler %{expand:\
%if 0%{?OHPC_CFLAGS:1} \
export OHPC_CFLAGS=%{OHPC_CFLAGS} \
%endif \
%if 0%{?OHPC_CXXFLAGS:1} \
export OHPC_CXXFLAGS=%{OHPC_CXXFLAGS} \
%endif \
%if 0%{?OHPC_FCFLAGS:1} \
export OHPC_FCFLAGS=%{OHPC_FCFLAGS} \
%endif \
%if 0%{?OHPC_F77FLAGS:1} \
export OHPC_F77FLAGS=%{OHPC_F77FLAGS} \
%endif \
. %{OHPC_ADMIN}/ohpc/OHPC_setup_compiler %{compiler_family} \
%if 0%{?ohpc_mpi_dependent} == 1 \
. %{OHPC_ADMIN}/ohpc/OHPC_setup_mpi %{mpi_family} \
%endif \
}
# Lua version
%if 0%{!?luaver:1}
# Set luaver to lua_version if it exists
%if 0%{?lua_version:1}
%global luaver %{lua_version}
%else
# Set default Lua version to 5.1, the version used by CentOS 7
%global luaver 5.1
# Lua 5.2 is used by older SUSE
%if 0%{?suse_version} >= 1200 && 0%{?suse_version} < 1350
%global luaver 5.2
%endif # sle12
# Lua 5.3 is used by OpenSUSE/SLES 15 and RHEL/CentOS 8
%if 0%{?sle_version} >= 150000 || 0%{?rhel_version} >=800
%global luaver 5.3
%endif # sle15/rh8
%endif # lua_version not set
%endif # luaver
# check if user desires to override package and modulefile naming with
# custom delimiter (e.g optimized micro-architecture build)
%global OHPC_CUSTOM_PKG_DELIM %{nil}
%{?OHPC_CUSTOM_DELIM: %global OHPC_CUSTOM_PKG_DELIM -%{OHPC_CUSTOM_DELIM}}
%{?OHPC_CUSTOM_DELIM: %global PROJ_DELIM -%{OHPC_CUSTOM_DELIM}%{PROJ_DELIM}}