Sync from SUSE:ALP:Source:Standard:1.0 gnu-compilers-hpc revision e17532a67d4c2d335ff04d574baa73b4

This commit is contained in:
Adrian Schröter 2023-12-28 12:21:20 +01:00
commit 411dbab39d
7 changed files with 544 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

28
LICENSE Normal file
View File

@ -0,0 +1,28 @@
Copyright © 2017 openSUSE Project
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

9
_multibuild Normal file
View File

@ -0,0 +1,9 @@
<multibuild>
<package>gnu-hpc</package>
<package>gnu8-hpc</package>
<package>gnu9-hpc</package>
<package>gnu10-hpc</package>
<package>gnu11-hpc</package>
<package>gnu12-hpc</package>
<package>gnu13-hpc</package>
</multibuild>

View File

@ -0,0 +1 @@
addFilter("hidden-file-or-dir")

157
gnu-compilers-hpc.changes Normal file
View File

@ -0,0 +1,157 @@
-------------------------------------------------------------------
Mon Sep 4 11:39:42 UTC 2023 - Egbert Eich <eich@suse.com>
- Create correct links for cc and c++ and make sure failure of last
test in %posttrans is not returned as status of scriptlet
(bsc#1214816).
-------------------------------------------------------------------
Wed Jun 14 08:23:44 UTC 2023 - Egbert Eich <eich@suse.com>
- Fix %posttrans script (`done` instead of `fi`) (bsc#1212351).
-------------------------------------------------------------------
Thu Jun 8 14:22:49 UTC 2023 - Egbert Eich <eich@suse.com>
- Add support for gcc13
-------------------------------------------------------------------
Mon Jan 2 15:30:36 UTC 2023 - Egbert Eich <eich@suse.com>
- Fix compatibility for SLE-12: define _rpmmacrodir after hpc_init.
-------------------------------------------------------------------
Tue Dec 13 15:31:07 UTC 2022 - Egbert Eich <eich@suse.com>
- Add support for gcc12 (jsc#PED-2834).
-------------------------------------------------------------------
Mon Dec 13 16:45:02 UTC 2021 - Antoine Ginies <aginies@suse.com>
- fix _multibuild with a correct list of gcc version
-------------------------------------------------------------------
Wed Oct 6 18:50:31 UTC 2021 - Egbert Eich <eich@suse.com>
- Use %_rpmmacrodir instead of %{_sysconfdir}/rpm (boo#1191381).
-------------------------------------------------------------------
Thu Jul 15 10:22:42 UTC 2021 - Egbert Eich <eich@suse.com>
- Improve setting of standard binaries (c, c++) for non-base
versions.
- Improve environment settings: only set CC, CXX etc when
compilers are installed. Thus, if only gnu<X>-compiler-hpc
is installed, they will not be set.
-------------------------------------------------------------------
Wed Jun 23 06:52:49 UTC 2021 - Egbert Eich <eich@suse.com>
- Add build support for gcc11 to HPC build (jsc#SLE-18780,
jsc#SLE-18781, jsc#SLE-18782).
-------------------------------------------------------------------
Thu Jul 23 16:13:13 UTC 2020 - Egbert Eich <eich@suse.com>
- Add build support for gcc10 to HPC build (bsc#1174439).
Fix version parsing for gcc10 and up.
-------------------------------------------------------------------
Fri Aug 2 05:30:55 UTC 2019 - Egbert Eich <eich@suse.com>
- Add support for gcc v.6, v.8 and v.9.
for SLE-12 HPC: v.6, v.7, v.8 (jsc#SLE-7765)
for SLE-15 & SLE-15-SP1: gcc v.7, v.8 (jsc#SLE-7766)
for SLE-15-SP2: add gcc v.9 (jsc#SLE-8604)
- For the base compiler add a Provides: for the versioned form.
-------------------------------------------------------------------
Wed Jan 16 15:01:07 UTC 2019 - eich@suse.com
- Add links from the generic compiler binary names cc, cpp, c++
and fc to the compiler specific names in the package private
binary directory.
-------------------------------------------------------------------
Sun Nov 18 10:32:56 UTC 2018 - eich@suse.com
- Define _hpc_gnu_module (bsc#1116458).
-------------------------------------------------------------------
Tue Jan 30 10:11:45 UTC 2018 - eich@suse.com
- Update to gcc v.7 for SLES-12 builds.
- Set the 'granularity' for selection to the
granularity of GNU toolchain versions we
distinguish: For major versions until 4,
this is 2 versions, for anything above it
is just the major version.
- On TW/Factory add explicit dependency to the
compiler major version package. This is to make
sure package gets rebuilt when this versions
changes.
-------------------------------------------------------------------
Fri Nov 10 20:17:48 UTC 2017 - eich@suse.com
- Add Requires: for lua-lmod to base package.
- Add Provides/Conflicts: to macro package:
only one version of this macro package can
can be installed at the same time.
-------------------------------------------------------------------
Thu Oct 5 12:32:32 UTC 2017 - eich@suse.com
- Make source files downloadable from git.
- Remove some debugging code.
-------------------------------------------------------------------
Wed Oct 4 08:12:01 UTC 2017 - eich@suse.com
- Fix LICENSE and copyright statement in LICENSE.
-------------------------------------------------------------------
Tue Sep 12 18:53:09 UTC 2017 - eich@suse.com
- Rename: rpmlintrc -> gnu-compilers-hpc-rpmlintrc
-------------------------------------------------------------------
Tue Sep 12 08:28:31 UTC 2017 - eich@suse.com
- Remove spec_fix.pl, use multibuild instead.
- Add RPM macros to be used together with macros.hpc from suse-hpc.
-------------------------------------------------------------------
Thu Jun 8 09:43:11 UTC 2017 - eich@suse.com
- Update spec_fix.pl: It is now able to produce multiple spec files
from one replacement file.
-------------------------------------------------------------------
Tue May 2 09:21:42 UTC 2017 - eich@suse.com
- Remove ohpc-isms.
- Add support for gcc update versions.
- Pick correct compiler version.
-------------------------------------------------------------------
Wed Nov 30 14:00:23 UTC 2016 - eich@suse.com
- Fix group of devel package: Development/Languages
-------------------------------------------------------------------
Tue Nov 15 13:10:57 UTC 2016 - pmladek@suse.com
- Add gcc-c++ into requires of the devel package
- Make the devel package to require the exact version of the main one
-------------------------------------------------------------------
Thu Oct 20 11:30:36 UTC 2016 - eich@suse.com
- Modified package to use a spec file template.
-------------------------------------------------------------------
Thu Oct 13 20:25:14 UTC 2016 - eich@suse.com
- Initial version of gnu compiler selection module
FATE#321705.

285
gnu-compilers-hpc.spec Normal file
View File

@ -0,0 +1,285 @@
#
# spec file
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%nil
%if "%flavor" == ""
ExclusiveArch: do_not_build
%endif
%global pname gnu
%global compiler_family %pname
%define myname %{compiler_family}%{?c_f_ver}-compilers-hpc
%if "%flavor" == "gnu-hpc"
%undefine c_f_ver
%endif
%if "%flavor" == "gnu6-hpc"
%define c_f_ver 6
%endif
%if "%flavor" == "gnu7-hpc"
%define c_f_ver 7
%endif
%if "%flavor" == "gnu8-hpc"
%define c_f_ver 8
%endif
%if "%flavor" == "gnu9-hpc"
%define c_f_ver 9
%endif
%if "%flavor" == "gnu10-hpc"
%define c_f_ver 10
%endif
%if "%flavor" == "gnu11-hpc"
%define c_f_ver 11
%endif
%if "%flavor" == "gnu12-hpc"
%define c_f_ver 12
%endif
%if "%flavor" == "gnu13-hpc"
%define c_f_ver 13
%endif
# For Factory only build the default
%if 0%{?suse_version} > 1600 && "%flavor" != "gnu-hpc"
ExclusiveArch: do-not-build
%endif
# Keep in sync with macros.hpc-gnu
# ab >= 40 - version: a.b to accompodate for old gcc version scheme of gcc < 5
%global hpc_gnu_bin_version %{?c_f_ver:-%(v=%c_f_ver; [ $v -lt 40 ] && echo $v ||
sed -e "s@\\([0-9]\\)@\\1.@g" \\
-e "s@\\([0-9]\\)\\.\\$@\\1@g" <<< $v)}
%global hpc_gnu_full_version %( gcc%{hpc_gnu_bin_version} --version |\
head -1 |\
sed -e "s#.* \\([0-9]\\+\\.[0-9.]\\+\\)\\(\$\\| .*\\)#\\1#" )
%global hpc_gnu_dep_version %(HPC_CF_FULL_VERSION=%hpc_gnu_full_version; \
[ ${HPC_CF_FULL_VERSION%%%%.*} -lt 5 ] && \
echo ${HPC_CF_FULL_VERSION%%.*} || \
echo ${HPC_CF_FULL_VERSION%%%%.*} )
%global hpc_prov_version %{!?c_f_ver:%(var=%hpc_gnu_dep_version; echo ${var/./_})}
%global hpc_gnu_pack_version %{?c_f_ver}
%if 0%{!?leap_version:1} && 0%{!?sle_version:1}
%global hpc_rolling_release_version %(echo %hpc_gnu_dep_version | tr -d '.')
%endif
%global hpc_gnu_dir gnu%{hpc_gnu_dep_version}
%hpc_init -C -c %compiler_family %{?c_f_ver:-v %{c_f_ver}}
%{!?_rpmmacrodir:%define _rpmmacrodir %{_sysconfdir}/rpm}
Summary: SUSE HPC GNU Compiler Toolchain environment
License: BSD-3-Clause
Group: Development/Tools/Other
Name: %myname
Version: 1.4
Release: 0
URL: https://github.com/openhpc/ohpc
Source0: https://raw.githubusercontent.com/openSUSE/hpc/master/compiler/macros.hpc-gnu
Source1: LICENSE
Source2: gnu-compilers-hpc-rpmlintrc
Source3: _multibuild
BuildRequires: gcc%{?c_f_ver}
BuildRequires: lua-lmod
BuildRequires: suse-hpc
%{!?c_f_ver: #
Provides: %{compiler_family}%{?hpc_prov_version}-compilers-hpc = %version-%release
}
Requires: lua-lmod
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
Provides HPC-compatible setup and configuration for the GNU compiler toolchain.
%define meta README.meta
%package devel
Summary: Devel package for HPC GNU compiler environment
Group: Development/Tools/Other
BuildArch: noarch
%{!?c_f_ver: #
Provides: %{compiler_family}%{?hpc_prov_version}-compilers-hpc-devel = %version-%release
}
Requires: %{name} = %{version}
Requires: gcc%{hpc_cf_pack_version}
Requires: gcc%{hpc_cf_pack_version}-c++
Requires: gcc%{hpc_cf_pack_version}-fortran
%if 0%{?hpc_rolling_release_version:1}
Requires: gcc%{hpc_rolling_release_version}
Requires: gcc%{hpc_rolling_release_version}-c++
Requires: gcc%{hpc_rolling_release_version}-fortran
%endif
%description devel
Provides package dependencies for building with the GNU compiler toolchain.
%package macros-devel
Summary: Macro package for HPC GNU compiler environment
Group: Development/Tools/Other
Provides: %{pname}-hpc-macros-devel = %{version}
Conflicts: otherproviders(%{pname}-hpc-macros-devel)
BuildArch: noarch
%{!?c_f_ver: #
Provides: %{compiler_family}%{?hpc_prov_version}-compilers-hpc-macros-devel = %version-%release
}
Requires: %{name}-devel = %{version}
%description macros-devel
Provides macros for building HPC compliant RPM with the GNU compiler toolchain.
%prep
%build
echo "hpc_gnu_full_version: %hpc_gnu_full_version"
echo "hpc_gnu_dep_version: %hpc_gnu_dep_version"
echo "hpc_gnu_bin_version: %hpc_gnu_bin_version"
%{!?c_f_ver:echo "hpc_prov_version: %hpc_prov_version"}
%{__cat} <<EOF > %{meta}
%{name}-devel is a meta package to ensure installation of the
gnu toolchain.
EOF
%install
mkdir -p %{buildroot}/%{_rpmmacrodir}
cp %{S:0} %{buildroot}/%{_rpmmacrodir}
cp %{S:1} .
%define lmod_base %{lua_lmod_modulesdir}/%pname
mkdir -p %{buildroot}%{hpc_cf_install_path}
mkdir -p %{buildroot}%{hpc_install_base}
mkdir -p %{buildroot}%{hpc_modulepath}
mkdir -p %{buildroot}%{lua_lmod_modulesdir}/%pname
%{__cat} <<EOF > %{buildroot}/%{lmod_base}/%{hpc_cf_dep_version}
#%%Module1.0#####################################################################
proc ModulesHelp { } {
puts stderr " "
puts stderr "This module loads the GNU compiler collection"
puts stderr " "
puts stderr "Consult the man pages for detailed information"
puts stderr "on the commandline syntax and compiler options."
puts stderr " "
puts stderr "\nVersion %{hpc_cf_dep_version}\n"
}
module-whatis "Name: GNU Compiler Collection"
module-whatis "Version: %{version}"
module-whatis "Category: compiler, runtime support"
module-whatis "Description: GNU Compiler Family (C/C++/Fortran for %_arch)"
module-whatis "URL: http://gcc.gnu.org"
set version %{hpc_cf_dep_version}
prepend-path MODULEPATH %{hpc_modulepath}
prepend-path PATH %{hpc_cf_install_path}/bin
%if 0%{?c_f_ver:1} > 0
if {[file isfile %{_bindir}/gcc%{hpc_gnu_bin_version}]} {
prepend-path MANPATH %{hpc_cf_install_path}/man
setenv CC gcc%{hpc_gnu_bin_version}
setenv CXX g++%{hpc_gnu_bin_version}
setenv FC gfortran%{hpc_gnu_bin_version}
setenv F77 gfortran%{hpc_gnu_bin_version}
}
%else
# nothing to do since gcc is in the default path
%endif
family "compiler"
EOF
export hpc_cf_dep_version=%{hpc_cf_dep_version}
%{__cat} <<EOF > %{buildroot}/%{lmod_base}/.version.%{hpc_cf_dep_version}
#%%Module1.0#####################################################################
##
## version file for GNU-compilers-${hpc_cf_dep_version}
##
set ModulesVersion "%{hpc_cf_dep_version}"
EOF
%if 0%{?c_f_ver:1}
%preun devel
rm -rf %{hpc_cf_install_path}/bin %{hpc_cf_install_path}/bin
%endif
%posttrans devel
mkdir -p %{hpc_cf_install_path}/bin
%if 0%{?c_f_ver:1}
export list="cpp%{hpc_cf_pack_version} gcc%{hpc_cf_pack_version} \
gcc%{hpc_cf_pack_version}-c++ gcc%{hpc_cf_pack_version}-fortran"
for i in $(rpm -ql ${list} | grep -E -e "/usr/bin|/usr/share/man")
do
dir=$(dirname $i)
base=$(basename $i)
base=${base/%{hpc_gnu_bin_version}/}
base=${base/.././}
case $dir in
/usr/share/man*)
mandir=$(basename $dir)
mkdir -p %{hpc_cf_install_path}/man/${mandir}
ln -sf $i %{hpc_cf_install_path}/man/${mandir}/$base
;;
/usr/bin*)
ln -sf $i %{hpc_cf_install_path}/bin/$base
;;
esac
done
for i in cc,gcc c++,g++; do
test -e %{hpc_cf_install_path}/bin/${i##*,} \
&& ln -s ${i##*,} %{hpc_cf_install_path}/bin/${i%%%%,*} || true
done
%else
# for the base compiler version link to the 'default' binary:
localbindir=%_bindir/
for i in cc cpp c++
do
test -e %{hpc_cf_install_path}/bin/${i} || ln -sf ${localbindir}${i}%{hpc_gnu_bin_version} %{hpc_cf_install_path}/bin/${i}
done
test -e %{hpc_cf_install_path}/bin/fortran || ln -sf ${localbindir}gfortran%{hpc_gnu_bin_version} %{hpc_cf_install_path}/bin/fc
%endif
%files
%defattr(-,root,root,-)
%license LICENSE
%dir %{lua_lmod_modulesdir}/%{pname}
%dir %{hpc_modulepath}
%dir %{hpc_base}
%dir %hpc_install_base
%hpc_cf_dirs
%{lua_lmod_modulesdir}/%{pname}/%{hpc_cf_dep_version}
%{lua_lmod_modulesdir}/%{pname}/.version.%{hpc_cf_dep_version}
%files devel
%defattr(-,root,root,-)
%doc %{meta}
%files macros-devel
%defattr(-,root,root,-)
%config %{_rpmmacrodir}/macros.hpc-gnu
%changelog

41
macros.hpc-gnu Normal file
View File

@ -0,0 +1,41 @@
#
# GNU Toolchain
#
# Version extension on binaries - GNU specific
# Use an init function to set these globally. This gets us around the arbitrary
# recursion limit of 16 in RPM.
%hpc_gnu_init(v:) \
%{-v: %define _cf_ver %{-v*}} \
%{echo: hpc_gnu_init %{?_cf_ver:version: %_cf_ver}} \
%{expand: %%global hpc_gnu_bin_version %{?_cf_ver:-%(\\\
v=%_cf_ver; [ $v -lt 40 ] && echo $v || \\\
sed -e "s@\\([0-9]\\)@\\1.@g" \\\
-e "s@\\([0-9]\\)\\.\\$@\\1@g" <<< $v)}%{!?_cf_ver:%%{nil}}} \
%{expand: %%global hpc_gnu_full_version %(\\\
gcc%{hpc_gnu_bin_version} --version |\\\
head -1 |\\\
sed -e "s#.* \\([0-9]\\+\\.[0-9.]\\+\\)\\(\$\\| .*\\)#\\1#")}\
%{expand: %%global hpc_gnu_dep_version %(\\\
FULL_VERSION=%hpc_gnu_full_version; \\\
[ ${FULL_VERSION%%%%.*} -lt 5 ] && \\\
echo ${FULL_VERSION%%.*} || \\\
echo ${FULL_VERSION%%%%.*})} \
%{expand: %%global hpc_gnu_pack_version %{?_cf_ver}%{!?_cf_ver:%%{nil}}} \
%{expand: %%global hpc_gnu_dir gnu%{hpc_gnu_dep_version}} \
%{expand: %%global _hpc_gnu_module gnu/%hpc_gnu_dep_version}
%hpc_setup_gnu \
export CC=gcc%{hpc_gnu_bin_version} \
export CXX=g++%{hpc_gnu_bin_version} \
export FC=gfortran%{hpc_gnu_bin_version} \
export F77=gfortran%{hpc_gnu_bin_version} \
module load gnu/%hpc_gnu_dep_version
# Requires:
%hpc_gnu_requires \
Requires: gnu%{?hpc_cf_pack_version}-compilers-hpc
%hpc_gnu_requires_devel \
Requires: gnu%{?hpc_cf_pack_version}-compilers-hpc-devel