%global OHPC_BUILD 1
%global PROJ_NAME       ohpc
%global OHPC_HOME       /opt/%{PROJ_NAME}
%global OHPC_ADMIN      %{OHPC_HOME}/admin
%global OHPC_PUB        %{OHPC_HOME}/pub
%global OHPC_COMPILERS  %{OHPC_PUB}/compiler
%global OHPC_MPI_STACKS %{OHPC_PUB}/mpi
%global OHPC_APPS       %{OHPC_PUB}/apps
%global OHPC_LIBS       %{OHPC_PUB}/libs
%global OHPC_MODULES    %{OHPC_PUB}/modulefiles
%global OHPC_MODULEDEPS %{OHPC_PUB}/moduledeps
%global debug_package   %{nil}
%global dist            .ohpc.1.3.1.3

%{!?PROJ_DELIM: %global PROJ_DELIM -ohpc}

DocDir:    %{OHPC_PUB}/doc/contrib

# All openHPC package require ohpc-filesystem for the basic FS layout
Requires: ohpc-filesystem
# All openHPC need ohpc-buildroot during build as it pulls in required
# build depenencies and also provides the compiler and mpi setup scripts
%if 0%{?ohpc_bootstrap} == 0
BuildRequires: ohpc-buildroot
%endif

# Set the compiler to devtoolset-6 if it is on a RHEL 7 system
%if 0%{?rhel} == 7
	%{!?compiler_family: %global compiler_family gnu7}
	# OBS define's rhel_version to 700 for RHEL, in case we are
	# not running in OBS
	%global rhel_version 700
%endif

# OpenHPC convention: the default assumes the gnu compiler family
# and mpi family openmpi;
# however, this can be overridden by specifing the compiler_family
# variable via rpmbuild or other mechanisms.

%{!?compiler_family: %global compiler_family gnu}
%{!?mpi_family: %global mpi_family mpich}

%global ohpc_compiler() \
	%if "%{compiler_family}" == "gnu" \
BuildRequires: gnu-compilers%{PROJ_DELIM} \
Requires:      gnu-compilers%{PROJ_DELIM} \
	%endif \
	%if "%{compiler_family}" == "intel" \
BuildRequires: gcc-c++ intel-compilers-devel%{PROJ_DELIM} \
Requires:      gcc-c++ intel-compilers-devel%{PROJ_DELIM} \
	%if 0%{OHPC_BUILD} \
BuildRequires: intel_licenses \
	%endif \
	%endif \
	%if "%{compiler_family}" == "dts6" \
BuildRequires: devtoolset-6 \
Requires:      devtoolset-6 \
BuildRequires: gnu-dts6-compilers%{PROJ_DELIM} \
Requires:      gnu-dts6-compilers%{PROJ_DELIM} \
	%endif \
	%if "%{compiler_family}" == "gnu7" \
BuildRequires: gnu-7-compilers%{PROJ_DELIM} \
Requires:      gnu-7-compilers%{PROJ_DELIM} \
	%endif

%global ohpc_setup_compiler %{expand:\
	. %{OHPC_ADMIN}/ohpc/OHPC_setup_compiler %{compiler_family} \
}
