Accepting request 523741 from science:HPC:EnvMod

- Update spec_fix.pl: It is now able to produce multiple spec files
  from one replacement file.
- Remove ohpc-isms.
- Add support for gcc update versions.
- Pick correct compiler version.
- Fix group of devel package: Development/Languages
- Add gcc-c++ into requires of the devel package
- Make the devel package to require the exact version of the main one
- Modified package to use a spec file template.
- Initial version of gnu compiler selection module
  FATE#321705.

OBS-URL: https://build.opensuse.org/request/show/523741
OBS-URL: https://build.opensuse.org/package/show/science:HPC/gnu-compilers-hpc?expand=0&rev=1
This commit is contained in:
Nicolas Morey-Chaisemartin 2017-09-12 14:34:49 +00:00 committed by Git OBS Bridge
commit 1373f6ef54
8 changed files with 338 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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

26
LICENSE Normal file
View File

@ -0,0 +1,26 @@
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 Novell 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.

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>gnu-hpc</package>
</multibuild>

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

@ -0,0 +1,34 @@
-------------------------------------------------------------------
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.

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

@ -0,0 +1,211 @@
#
# spec file for package compilers-hpc
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%nil
%if "%flavor" == ""
%global flavor gnu-hpc
%endif
%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
# Keep in sync with macros.hpc-gnu
%global hpc_gnu_bin_version %{?c_f_ver:-%(echo %c_f_ver | \
sed -e "s@\\([0-9]\\)@\\1.@g" -e "s@\\([0-9]\\)\\.\\$@\\1@g")}
%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; \
echo ${HPC_CF_FULL_VERSION%.*})
%global hpc_gnu_pack_version %{?c_f_ver}
%global hpc_gnu_dir gnu%{hpc_gnu_dep_version}
%hpc_init -C -c %compiler_family %{?c_f_ver:-v %{c_f_ver}}
Summary: SUSE HPC GNU Compiler Toolchain environment
License: BSD-3-Clause
Group: Development/Languages
Name: %myname
Version: 1.3
Release: 0
Url: https://github.com/openhpc/ohpc
Source0: macros.hpc-gnu
Source1: LICENSE
Source2: rpmlintrc
Source3: _multibuild
BuildRequires: gcc%{?c_f_ver}
BuildRequires: lua-lmod
BuildRequires: suse-hpc
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/Languages
BuildArch: noarch
Requires: %{name} = %{version}
Requires: gcc%{hpc_cf_pack_version}
Requires: gcc%{hpc_cf_pack_version}-c++
Requires: gcc%{hpc_cf_pack_version}-fortran
%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/Languages
BuildArch: noarch
Requires: %{name}-devel = %{version}
%description macros-devel
Provides macros for building HPC compliant RPM with the GNU compiler toolchain.
%prep
%build
%{__cat} <<EOF > %{meta}
%{name}-devel is a meta package to ensure installation of the
gnu toolchain.
EOF
%install
mkdir -p %{buildroot}%{_sysconfdir}/rpm
cp %{S:0} %{buildroot}%{_sysconfdir}/rpm
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_full_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_full_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_full_version}
prepend-path MODULEPATH %{hpc_modulepath}
%if 0%{?c_f_ver:1} > 0
prepend-path MANPATH %{hpc_cf_install_path}/man
prepend-path PATH %{hpc_cf_install_path}/bin
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_full_version=%{hpc_cf_full_version}
%{__cat} <<"EOF" > %{buildroot}/%{lmod_base}/.version.%{hpc_cf_full_version}
#%%Module1.0#####################################################################
##
## version file for GNU-compilers-${hpc_cf_full_version}
##
set ModulesVersion "%{hpc_cf_full_version}"
EOF
%if 0%{?c_f_ver:1}
%preun devel
rm -rf %{hpc_cf_install_path}/bin %{hpc_cf_install_path}/bin
%endif
%if 0%{?c_f_ver:1}
%posttrans devel
export list="cpp%{hpc_cf_pack_version} gcc%{hpc_cf_pack_version} \
gcc%{hpc_cf_pack_version}-c++ gcc%{hpc_cf_pack_version}-fortran"
mkdir -p %{hpc_cf_install_path}/bin
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}/}
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
%endif
%files
%defattr(-,root,root,-)
%doc 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_full_version}
%{lua_lmod_modulesdir}/%{pname}/.version.%{hpc_cf_full_version}
%files devel
%defattr(-,root,root,-)
%doc %{meta}
%files macros-devel
%defattr(-,root,root,-)
%config %{_sysconfdir}/rpm/macros.hpc-gnu
%changelog

39
macros.hpc-gnu Normal file
View File

@ -0,0 +1,39 @@
#
# 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:-%(\\\
echo %_cf_ver | \\\
sed -e "s@\\([0-9]\\)@\\1.@g" \\\
-e "s@\\([0-9]\\)\\.\\$@\\1@g")}%{!?_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#")}\
# FIXME: We may just want to pick the major.minor or major version only \
%{expand: %%global hpc_gnu_dep_version %(\\\
FULL_VERSION=%hpc_gnu_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}}
%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_cf_full_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

1
rpmlintrc Normal file
View File

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