Accepting request 523742 from science:HPC:EnvMod
- Initial version. OBS-URL: https://build.opensuse.org/request/show/523742 OBS-URL: https://build.opensuse.org/package/show/science:HPC/suse-hpc?expand=0&rev=1
This commit is contained in:
commit
811007d0a1
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal 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
|
26
LICENSE
Normal file
26
LICENSE
Normal 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.
|
487
macros.hpc
Normal file
487
macros.hpc
Normal file
@ -0,0 +1,487 @@
|
|||||||
|
# If argument is non-empty print with a leading underscore
|
||||||
|
%_hpc_p %([ -n "%{?1}" ]&&echo -n _%{1})
|
||||||
|
%hpc_package_name_tail() %{?hpc_ext}%{_hpc_p}%{hpc_package_name_end}
|
||||||
|
%hpc_package_name() %{pname}%{?hpc_ext}%{_hpc_p}%{hpc_package_name_end}
|
||||||
|
|
||||||
|
# Paths
|
||||||
|
%hpc_base %{_prefix}/lib/hpc/
|
||||||
|
|
||||||
|
# For (non-mpi) libraries
|
||||||
|
%hpc_install_base %{hpc_base}%{?hpc_cf_dir}%{?hpc_mpi_dir}
|
||||||
|
%hpc_install_path_base %{hpc_install_base}%{pname}%{?hpc_ext}/
|
||||||
|
%hpc_install_path %{hpc_install_path_base}%{version}
|
||||||
|
|
||||||
|
# For compilers
|
||||||
|
%hpc_cf_install_base %{hpc_base}compiler/
|
||||||
|
%hpc_cf_install_path_base %{hpc_cf_install_base}%{hpc_compiler_family}/
|
||||||
|
%hpc_cf_install_path %{hpc_cf_install_path_base}%{hpc_cf_full_version}
|
||||||
|
|
||||||
|
# For mpi libraries
|
||||||
|
%hpc_mpi_install_base %{hpc_base}%{?hpc_cf_dir}mpi/
|
||||||
|
%hpc_mpi_install_path_base %{hpc_mpi_install_base}%{hpc_mpi_family}/
|
||||||
|
%hpc_mpi_install_path %{hpc_mpi_install_path_base}%{version}
|
||||||
|
|
||||||
|
# Different paths - below HPC directory
|
||||||
|
%hpc_exec_prefix %{hpc_prefix}
|
||||||
|
%hpc_bindir %{hpc_prefix}/bin
|
||||||
|
%hpc_sbindir %{hpc_prefix}/sbin
|
||||||
|
%hpc_sysconfdir %{_sysconfdir}
|
||||||
|
%hpc_datadir %{hpc_prefix}/share
|
||||||
|
%hpc_includedir %{hpc_prefix}/include
|
||||||
|
%hpc_libdir %{hpc_prefix}/%{_lib}
|
||||||
|
%hpc_libexecdir %{hpc_prefix}/lib
|
||||||
|
%hpc_localstatedir %{_localstatedir}
|
||||||
|
%hpc_sharedstatedir %{_sharedstatedir}
|
||||||
|
%hpc_mandir %{hpc_prefix}/share/man
|
||||||
|
%hpc_infodir %{hpc_prefix}/share/info
|
||||||
|
%hpc_pkgconfigdir %{hpc_libdir}/pkgconfig
|
||||||
|
|
||||||
|
# pkgconfig
|
||||||
|
# %hpc_write_pkgconfig [-l <libname>][-n <pkgfile_name>]
|
||||||
|
# -l <libname>: <libname> with -l option: -l <libname>. default: none
|
||||||
|
# -n <pkgfile_name>: name of pkgconf file (without the trailing .pc)
|
||||||
|
# default: %pname
|
||||||
|
%_hpc_write_pkgconfig(l:n:) \
|
||||||
|
%{!?_hpc_init_done: %{error: "%%_hpc_write_pkgconfig: Call %%hpc_init first!"}} \
|
||||||
|
%{__mkdir_p} %{buildroot}/%{hpc_pkgconfigdir} \
|
||||||
|
echo "writing %{buildroot}%{hpc_pkgconfigdir}/%{!-n:%{pname}}%{-n:%{-n*}}.pc" \
|
||||||
|
%{__cat} << "EOF" > %{buildroot}%{hpc_pkgconfigdir}/%{!-n:%{pname}}%{-n:%{-n*}}.pc \
|
||||||
|
prefix=%{hpc_prefix} \
|
||||||
|
exec_prefix=%{hpc_exec_prefix} \
|
||||||
|
libdir=%{hpc_libdir} \
|
||||||
|
includedir=%{hpc_includedir} \
|
||||||
|
sysconfdir=%{hpc_sysconfdir} \
|
||||||
|
\
|
||||||
|
Name: %pname \
|
||||||
|
Description: %summary \
|
||||||
|
Version: %version \
|
||||||
|
Libs: -L${libdir} %{?-l:-l%{-l*}} \
|
||||||
|
Cflags: -I${includedir} \
|
||||||
|
EOF\
|
||||||
|
%{nil}
|
||||||
|
|
||||||
|
%hpc_write_pkgconfig(n:l:) %{expand:%%_hpc_write_pkgconfig %{**}}
|
||||||
|
|
||||||
|
# %hpc_pkgconfig_file [-n <name_of_file>][-N]
|
||||||
|
# -n <name_of_file>: pkgconfig file name (without trailing .pc)
|
||||||
|
# -N: don't list pkgconfig directory (used when this macro is used
|
||||||
|
# more than once per file).
|
||||||
|
%hpc_pkgconfig_file(n:N) \
|
||||||
|
%{!-N:%dir %{hpc_pkgconfigdir}} \
|
||||||
|
%{hpc_pkgconfigdir}/%{!-n:%{pname}}%{-n:%{-n*}}.pc
|
||||||
|
|
||||||
|
%hpc_modulefile_add_pkgconfig_path prepend-path PKG_CONFIG_PATH %{hpc_pkgconfigdir}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Requires:
|
||||||
|
#
|
||||||
|
|
||||||
|
# Compiler
|
||||||
|
%hpc_cf_requires %{expand:%{hpc_%{hpc_compiler_family}_requires}}
|
||||||
|
# Compiler devel packages
|
||||||
|
%hpc_cf_requires_devel %{expand:%{hpc_%{hpc_compiler_family}_requires_devel}}
|
||||||
|
|
||||||
|
# MPI
|
||||||
|
%hpc_mpi_requires %{expand:%{hpc_%{hpc_mpi_family}_requires}}
|
||||||
|
# MPI devel packages
|
||||||
|
%hpc_mpi_requires_devel %{expand:%{hpc_%{hpc_mpi_family}_requires_devel}}
|
||||||
|
|
||||||
|
# Base
|
||||||
|
%hpc_requires %{?hpc_compiler_family:%{!?_hpc_build_compiler:%hpc_cf_requires}}\
|
||||||
|
%{?hpc_mpi_family:%{!?_hpc_build_mpi:%hpc_mpi_requires}}
|
||||||
|
|
||||||
|
# Devel
|
||||||
|
%hpc_requires_devel %{?hpc_compiler_family:%{!?_hpc_build_compiler:%hpc_cf_requires_devel}}\
|
||||||
|
%{?hpc_mpi_family:%{!?_hpc_build_mpi:%hpc_mpi_requires_devel}}
|
||||||
|
|
||||||
|
#
|
||||||
|
# General settings depending in compiler and mpi family
|
||||||
|
#
|
||||||
|
|
||||||
|
# Init
|
||||||
|
#
|
||||||
|
# HCP init: Call everywhere where this framework is used.
|
||||||
|
# %hpc_init [-C|-M] -c <compiler_family> [-v <compiler_version>] -m <mpi_family> [-V <mpi_version>]
|
||||||
|
# -C: build a compiler.
|
||||||
|
# -c <arg>: set compiler family to <arg> (mandatory)
|
||||||
|
# -v <arg>: set compiler version to <arg> (optional - default: base version)
|
||||||
|
# -M: build an MPI library: -C and -M are mutually exclusive!
|
||||||
|
# -m: <arg>: set MPI family to <arg>
|
||||||
|
# -V: <arg>: set MPI version to <arg> (optional - default:)
|
||||||
|
# -e: <arg>: program name extension
|
||||||
|
%_hpc_init(Cc:Mm:v:V:e:)\
|
||||||
|
%{-m:%{!-c:%{error: Cannot est MPI family without compiler}}} \
|
||||||
|
%{-c:%{expand: %%global hpc_compiler_family %{-c*}}} \
|
||||||
|
%{-m: %{expand: %%global hpc_mpi_family %{-m*}}} \
|
||||||
|
%{!-m:%{-V:%{error: MPI version sepecified but no MPI family}}} \
|
||||||
|
%{-C:%{-M:%{error: Don't build both compiler and MPI!}}} \
|
||||||
|
%{-c:%{echo: Building for %hpc_compiler_family %{-v:version %{-v*}}}} \
|
||||||
|
%{!?pname:%{error: No package name given! Set %%pname before calling %%hpc_init }} \
|
||||||
|
%{-e:%{expand: %%global hpc_ext -%{-e*}}} \
|
||||||
|
%if %{defined hpc_compiler_family} \
|
||||||
|
%if %{defined hpc_%{expand:%{hpc_compiler_family}}_init} \
|
||||||
|
# -v passed onto here \
|
||||||
|
%{expand:%%{hpc_%{expand:%{hpc_compiler_family}}_init %{-v}}} \
|
||||||
|
%endif \
|
||||||
|
%endif \
|
||||||
|
%if %{defined hpc_mpi_family} \
|
||||||
|
%if %{defined hpc_%{expand:%{hpc_mpi_family}}_init} \
|
||||||
|
# -V passed onto here \
|
||||||
|
%{expand:%%{hpc_%{expand:%{hpc_mpi_family}}_init %{-V}}} \
|
||||||
|
%endif \
|
||||||
|
%endif \
|
||||||
|
# No further expansion needed, thus no %%{expand:..} \
|
||||||
|
%{-C:%global _hpc_build_compiler 1} \
|
||||||
|
%{-M:%global _hpc_build_mpi 1} \
|
||||||
|
# \
|
||||||
|
# Compiler \
|
||||||
|
%{?hpc_compiler_family: \
|
||||||
|
%{expand: %%global hpc_cf_full_version %%{hpc_%{hpc_compiler_family}_full_version}} \
|
||||||
|
# Version for module directories \
|
||||||
|
%{expand: %%global hpc_cf_dep_version %%{hpc_%{hpc_compiler_family}_dep_version}} \
|
||||||
|
# Version extension on binaries \
|
||||||
|
%{expand: %%global hpc_cf_bin_version %%{hpc_%{hpc_compiler_family}_bin_version}} \
|
||||||
|
# Version number on package \
|
||||||
|
%{expand: %%global hpc_cf_pack_version %%{hpc_%{hpc_compiler_family}_pack_version}} \
|
||||||
|
%{expand: %%global hpc_cf_dir %{?hpc_compiler_family:%%{hpc_%{hpc_compiler_family}_dir}/}} \
|
||||||
|
} \
|
||||||
|
# \
|
||||||
|
# MPI \
|
||||||
|
%{?hpc_mpi_family: \
|
||||||
|
%global hpc_mpi_dep_version %{?hpc_mpi_family:%%{hpc_%{hpc_mpi_family}_dep_version}} \
|
||||||
|
%global hpc_mpi_dir %{?hpc_mpi_family:%%{hpc_%{hpc_mpi_family}_dir}/} \
|
||||||
|
%global hpc_mpi_pack_version %{?hpc_mpi_family:%%{hpc_%{hpc_mpi_family}_pack_version}} \
|
||||||
|
} \
|
||||||
|
%{expand: %%global hpc_prefix %{-M:%hpc_mpi_install_path}%{-C:%hpc_cf_install_path}%{!-M:%{!-C:%{hpc_install_path}}}} \
|
||||||
|
%{?_hpc_build_mpi:%global _hpc_build_xx 1} \
|
||||||
|
%{?_hpc_build_compiler:%global _hpc_build_xx 1} \
|
||||||
|
%{!?hpc_compiler_family:%global _hpc_build_xx 1} \
|
||||||
|
%define _hpc_package_name_compiler %{?hpc_compiler_family:-%{hpc_compiler_family}%{?hpc_cf_pack_version}} \
|
||||||
|
%define _hpc_package_name_mpi %{?hpc_mpi_family:%{!?_hpc_build_mpi:-%{hpc_mpi_family}%{?hpc_mpi_pack_version}}} \
|
||||||
|
%global hpc_package_name_end %{_hpc_package_name_compiler}%{_hpc_package_name_mpi}-hpc \
|
||||||
|
%global _hpc_init_done 1
|
||||||
|
|
||||||
|
%hpc_init(Cc:Mm:v:V:e:) %{expand:%%_hpc_init %{**}}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Environment Modules
|
||||||
|
#
|
||||||
|
%hpc_mpi_family_path %{?hpc_mpi_family:-%{hpc_mpi_family}%([ -n "%{hpc_mpi_dep_version}" ] &&
|
||||||
|
echo -n "-%{hpc_mpi_dep_version}")}
|
||||||
|
|
||||||
|
%hpc_compiler_family_path %{?hpc_compiler_family:%{hpc_compiler_family}-%{hpc_cf_dep_version}}
|
||||||
|
|
||||||
|
# Used for MPI library build to create the module install directory for MPI dependent libs.
|
||||||
|
%hpc_module_dep_install %{lua_lmod_moduledeps}/%{hpc_compiler_family_path}%{?hpc_mpi_family_path}
|
||||||
|
|
||||||
|
# Install path base for the module file of the current package
|
||||||
|
%_hpc_module_base %{?!compiler_family:%{lua_lmod_modulesdir}}%{?compiler_family:%{?_hpc_build_compiler:%{lua_lmod_modulesdir}}%{!?_hpc_build_compiler:%{lua_lmod_moduledeps}}/}
|
||||||
|
%hpc_module_dep_path %{_hpc_module_base}%{hpc_compiler_family_path}%{!?_hpc_build_mpi:%{?hpc_mpi_family_path}}
|
||||||
|
|
||||||
|
# install the module file here. If the default path (according to
|
||||||
|
# hpc_cf_family and hpc_mpi_family should not be used, pass trailing path
|
||||||
|
# element as argument. Do not use for compiler!
|
||||||
|
%hpc_module_dep_base %{hpc_module_dep_path}/%{hpc_module_pname}%{?hpc_ext}/
|
||||||
|
|
||||||
|
# This can be overridden in the spec file.
|
||||||
|
%hpc_module_pname %pname
|
||||||
|
|
||||||
|
%hpc_setup_compiler \
|
||||||
|
%{!?_hpc_init_done: %{error: "%%hpc_setup_compiler: Call %%hpc_init first!"}} \
|
||||||
|
module purge \
|
||||||
|
%{?hpc_compiler_family:%{expand:%{hpc_setup_%{hpc_compiler_family}}}}
|
||||||
|
|
||||||
|
%hpc_setup_mpi \
|
||||||
|
%{?hpc_mpi_family:%{expand:%{hpc_setup_%{hpc_mpi_family}}}}
|
||||||
|
|
||||||
|
%hpc_setup \
|
||||||
|
%hpc_setup_compiler \
|
||||||
|
%{!?_hpc_build_mpi:%hpc_setup_mpi}
|
||||||
|
|
||||||
|
# delete default in %postun
|
||||||
|
%hpc_module_delete_if_default \
|
||||||
|
_tmp=$(readlink -e %{hpc_module_dep_base}/version) && \
|
||||||
|
test "$_tmp" = "$(readlink -f %{hpc_module_dep_base}/.version.%{version})" && \
|
||||||
|
rm -f %{hpc_module_dep_base}/version || exit 0
|
||||||
|
|
||||||
|
#
|
||||||
|
%hpc_write_modules_version_file \
|
||||||
|
echo "Writing %{buildroot}%{hpc_module_dep_base}.version.%{version}" \
|
||||||
|
%{__cat} << EOF > %{buildroot}%{hpc_module_dep_base}.version.%{version} \
|
||||||
|
#%%Module1.0#####################################################################\
|
||||||
|
##\
|
||||||
|
## version file for %{pname}-%{version}\
|
||||||
|
##\
|
||||||
|
set ModulesVersion "%{version}"\
|
||||||
|
EOF\
|
||||||
|
%nil
|
||||||
|
|
||||||
|
#
|
||||||
|
%hpc_make_modules_dir mkdir -p %{buildroot}%{hpc_module_dep_base}
|
||||||
|
|
||||||
|
#
|
||||||
|
%hpc_write_modules_files \
|
||||||
|
%{?_hpc_build_mpi:mkdir -p %{buildroot}%{hpc_install_base}} \
|
||||||
|
%hpc_make_modules_dir \
|
||||||
|
%{?_hpc_build_xx:mkdir -p %{buildroot}%{hpc_module_dep_install}} \
|
||||||
|
%hpc_write_modules_version_file \
|
||||||
|
echo "Writing %{buildroot}%{hpc_module_dep_base}%{version}" \
|
||||||
|
cat << EOF > %{buildroot}%{hpc_module_dep_base}%{version}
|
||||||
|
|
||||||
|
%hpc_modulepath %{?_hpc_build_xx:%{hpc_module_dep_install}}%{!?_hpc_build_xx:%{hpc_module_dep_path}}
|
||||||
|
|
||||||
|
# For files section:
|
||||||
|
## Modules Files
|
||||||
|
%hpc_modules_files \
|
||||||
|
%{?_hpc_build_xx:%{hpc_module_dep_install}} \
|
||||||
|
%dir %{hpc_module_dep_base} \
|
||||||
|
%{hpc_module_dep_base}/.version.%{version} \
|
||||||
|
%{hpc_module_dep_base}/%{version}
|
||||||
|
|
||||||
|
# Compilers - use in library package when building compilers
|
||||||
|
%hpc_cf_dirs \
|
||||||
|
%dir %hpc_cf_install_base \
|
||||||
|
%dir %hpc_cf_install_path_base \
|
||||||
|
%dir %hpc_cf_install_path
|
||||||
|
|
||||||
|
# mpi libraries - use in library package when building mpi libraries
|
||||||
|
%hpc_mpi_dirs \
|
||||||
|
%dir %{hpc_install_base} \
|
||||||
|
%dir %hpc_mpi_install_base \
|
||||||
|
%dir %hpc_mpi_install_path_base \
|
||||||
|
%dir %hpc_mpi_install_path
|
||||||
|
|
||||||
|
# serial and parallel libraries - use in library package
|
||||||
|
%hpc_dirs \
|
||||||
|
%{!?hpc_compiler_family:%dir %{hpc_install_base}} \
|
||||||
|
%dir %{hpc_install_path_base} \
|
||||||
|
%dir %{hpc_install_path} \
|
||||||
|
%dir %{hpc_libdir}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Autotools
|
||||||
|
#
|
||||||
|
|
||||||
|
%hpc_configure \
|
||||||
|
%{!?_hpc_init_done: %{error: "%%hpc_configure: Call %%hpc_init first!"}} \
|
||||||
|
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
|
||||||
|
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
|
||||||
|
FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
|
||||||
|
%{_configure} --host=%{_host} --build=%{_build} \\\
|
||||||
|
%{?_program_prefix:--program-prefix=%{_program_prefix}} \\\
|
||||||
|
--disable-dependency-tracking \\\
|
||||||
|
--prefix=%{hpc_prefix} \\\
|
||||||
|
--exec-prefix=%{hpc_exec_prefix} \\\
|
||||||
|
--bindir=%{hpc_bindir} \\\
|
||||||
|
--sbindir=%{hpc_sbindir} \\\
|
||||||
|
--sysconfdir=%{_sysconfdir} \\\
|
||||||
|
--datadir=%{hpc_datadir} \\\
|
||||||
|
--includedir=%{hpc_includedir} \\\
|
||||||
|
--libdir=%{hpc_libdir} \\\
|
||||||
|
--libexecdir=%{hpc_libexecdir} \\\
|
||||||
|
--localstatedir=%{hpc_localstatedir} \\\
|
||||||
|
--sharedstatedir=%{hpc_sharedstatedir} \\\
|
||||||
|
--mandir=%{hpc_mandir} \\\
|
||||||
|
--infodir=%{hpc_infodir}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Debugging
|
||||||
|
#
|
||||||
|
|
||||||
|
# %hpc_debug [-x]
|
||||||
|
# -x: exit with a non-zero exit code. This will stop the build and keep the
|
||||||
|
# generated script file around.
|
||||||
|
#
|
||||||
|
%hpc_debug(x) \
|
||||||
|
echo "Package name %{name} for %{pname} %{?hpc_ext: ext: %{hpc_ext}}" \
|
||||||
|
%{?_hpc_build_compiler: echo "Building Compiler"} \
|
||||||
|
%{?_hpc_build_mpi: echo "Building MPI lib"} \
|
||||||
|
echo %nil \
|
||||||
|
%if %{defined hpc_compiler_family} \
|
||||||
|
echo Building for compiler family: %{hpc_compiler_family} \
|
||||||
|
echo cf_full_version: %{hpc_cf_full_version} \
|
||||||
|
echo cf_dep_version: %{hpc_cf_dep_version} \
|
||||||
|
echo cf_bin_version: %{hpc_cf_bin_version} \
|
||||||
|
echo cf_pack_version: %{hpc_cf_pack_version} \
|
||||||
|
echo cf_dir: %{hpc_cf_dir} \
|
||||||
|
echo cf_install_path: %{hpc_cf_install_path} \
|
||||||
|
echo cf_install_path_base: %{hpc_cf_install_path_base} \
|
||||||
|
echo %nil \
|
||||||
|
%endif \
|
||||||
|
%if %{defined hpc_mpi_family} \
|
||||||
|
echo "Building with MPI family support for %{hpc_mpi_family}" \
|
||||||
|
echo hpc_mpi_dep_version: %hpc_mpi_dep_version \
|
||||||
|
%{?hpc_mpi_pack_version: echo hpc_mpi_pack_version: %hpc_mpi_pack_version} \
|
||||||
|
echo hpc_mpi_family_path: %hpc_mpi_family_path \
|
||||||
|
echo hpc_mpi_dir: %{hpc_mpi_dir} \
|
||||||
|
echo %nil \
|
||||||
|
%endif \
|
||||||
|
echo hpc_prefix: %{hpc_prefix} \
|
||||||
|
echo hpc_module_dep_path: %{hpc_module_dep_path} \
|
||||||
|
echo %nil \
|
||||||
|
%{-x:exit 1}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Create 'master' package: packages which have the built package as
|
||||||
|
# dependency. This way, the latest version of a library can be installed
|
||||||
|
# without knowing its version number.
|
||||||
|
# The dependent library package will be kept around when an update to
|
||||||
|
# this package pulls in a new version of the dependent library, because
|
||||||
|
# these libraries also carry the version number of their names and
|
||||||
|
# don't conflict with an earlier version.
|
||||||
|
# %hpc_master_package [-n <full_package_name>][-g <group>][-s <.so-version>][-l][-L][-q] <package_ext>
|
||||||
|
# -n <full_package_name>: specify the full package name. This may not be used in conjunction with
|
||||||
|
# the package name extension <package_ext>.
|
||||||
|
# -g <group>: Specify the group to use.
|
||||||
|
# -s <.so-version>: If this is a dependency for a library package, specify the
|
||||||
|
# .so version. This will cause the package name to be prepended with
|
||||||
|
# `lib`. This should not be used together with -l.
|
||||||
|
# -l: mark a library package, prepend the package name with a `lib` (like -s
|
||||||
|
# but without an explicite so version. Do not use -l and -s together.
|
||||||
|
# -L: Create a link from the .version.<version_no> file to the .version file
|
||||||
|
# to mark the default version.
|
||||||
|
# -a: Use native arch even if no library package.
|
||||||
|
# -q: For internal use only!
|
||||||
|
#
|
||||||
|
%hpc_master_package(n:g:s:lLaq) \
|
||||||
|
%define _mylib %{-s:lib}%{!-s:%{-l:lib}} \
|
||||||
|
%define _p_ext %(test -n "%{*}" && echo -%{*}) \
|
||||||
|
%{-n:%define _pname %{-n*}} \
|
||||||
|
%{!-n:\
|
||||||
|
%define _pname_cf %{?compiler_family:-%{compiler_family}%{?hpc_cf_pack_version}} \
|
||||||
|
%define _pname_mpi %{!?_hpc_build_mpi:%{?hpc_mpi_family:-%{hpc_mpi_family}%{?hpc_mpi_pack_version}}} \
|
||||||
|
%define _pname_build_mpi_name %{?_hpc_build_mpi:%{hpc_mpi_family}%{?hpc_ext}%{?hpc_mpi_pack_version}} \
|
||||||
|
%define _pname_name %{!?_hpc_build_mpi:%{pname}%{?hpc_ext}%{-s*}} \
|
||||||
|
%define _pname_header %{_mylib}%{_pname_build_mpi_name}%{_pname_name} \
|
||||||
|
%define _pname %{_pname_header}%{_pname_cf}%{_pname_mpi}-hpc%{_p_ext} \
|
||||||
|
}\
|
||||||
|
%{-q:%(echo -n %{_pname}; true %{_mylib} %{_p_ext})} \
|
||||||
|
%{!-q:\
|
||||||
|
%{-g:%define _group %{-g*}} \
|
||||||
|
%{!-g: \
|
||||||
|
%define _group %(pname=%_pname; \
|
||||||
|
case $pname in \
|
||||||
|
(*-devel|*-devel-static) \
|
||||||
|
echo -n "Development/Libraries/%{?hpc_mpi_family:Parallel}%{!?hpc_mpi_family:C and C++}" ;; \
|
||||||
|
(*) \
|
||||||
|
if [ -n "%_mylib" ] \
|
||||||
|
then \
|
||||||
|
echo -n System/Libraries \
|
||||||
|
else \
|
||||||
|
echo -n Productivity/Scientific/Other \
|
||||||
|
fi ;; esac)\
|
||||||
|
} \
|
||||||
|
%{!-s:%define n_name %name} \
|
||||||
|
%{-s:%define n_name %(a=%{name};echo -n ${a/%{pname}/%{pname}%{s*}})} \
|
||||||
|
%package -n %_pname \
|
||||||
|
Summary: Dependency package for %{n_name}%{_p_ext} \
|
||||||
|
Group: %_group \
|
||||||
|
Obsoletes: %_pname < %version \
|
||||||
|
%{!-s:Requires: %{_mylib}%{name}%{_p_ext} = %version} \
|
||||||
|
%{-s:Requires: %(echo -n %{_mylib}%{name}%{_p_ext} | sed -e "s/\\(.*%{pname}\\)\\(.*\\)/\\\\1%{-s*}\\\\2/") = %version} \
|
||||||
|
%{!-l:%{!-s:%{!-a:BuildArch: noarch}}} \
|
||||||
|
%description -n %_pname \
|
||||||
|
The package %{n_name}%{_p_ext} provides the dependency to get the latest version of %pname \
|
||||||
|
%{-L:%post -n %_pname \
|
||||||
|
ln -sf %{hpc_module_dep_base}.version.%{version} %{hpc_module_dep_base}.version} \
|
||||||
|
%files -n %{_pname} \
|
||||||
|
%defattr(-,root,root)\
|
||||||
|
%define _msg '%summary: Provide the dependency to get the latest version of %pname' \
|
||||||
|
%define _readme README.%{_mylib}%{name}%{_p_ext} \
|
||||||
|
%define _tmpexec %(tmp=$(mktemp /tmp/scr-XXXXXX); \
|
||||||
|
readme=%{_readme} \
|
||||||
|
echo "#!/bin/bash" > $tmp; \
|
||||||
|
echo "echo %_msg \> $readme && rm -f $tmp || true" >> $tmp; \
|
||||||
|
chmod u+x $tmp; echo -n $tmp) \
|
||||||
|
%doc $(%_tmpexec)./%{_readme} \
|
||||||
|
} \
|
||||||
|
%{nil}
|
||||||
|
|
||||||
|
##
|
||||||
|
# Functions
|
||||||
|
##
|
||||||
|
%hpc_upcase() %(echo %{**} | tr [a-z] [A-Z])
|
||||||
|
|
||||||
|
##
|
||||||
|
# Macros specific for python packages
|
||||||
|
##
|
||||||
|
%_hpc_python_sysconfig_path() %(%1 -c "import sysconfig as s; \\\
|
||||||
|
print(s.get_paths(%{?3:vars={'platbase':\\"%3\\", 'base' : \\"%3\\"}}).get('%2'));")
|
||||||
|
|
||||||
|
%hpc_python_sitearch %{_hpc_python_sysconfig_path %python_flavor platlib %{?hpc_prefix}}
|
||||||
|
|
||||||
|
%_hpc_python_ver() %(%1 -c "import sys as s;print(s.version[:3]);")
|
||||||
|
|
||||||
|
%hpc_python_version %{_hpc_python_ver %python_flavor}
|
||||||
|
|
||||||
|
%hpc_python_master_package(n:g:lLa) \
|
||||||
|
%{?_python_macro_init} \
|
||||||
|
%{lua: \
|
||||||
|
if _hpc_python_master_package_inited ~= true then \
|
||||||
|
_hpc_python_package_list = {} \
|
||||||
|
_hpc_python_master_package_inited = true \
|
||||||
|
end \
|
||||||
|
local arg_list = "" \
|
||||||
|
local function add_args (a, opt) \
|
||||||
|
if a ~= "" then \
|
||||||
|
if arg_list ~= "" then arg_list = arg_list .. " " end \
|
||||||
|
if opt ~= nil then arg_list = arg_list .. opt .. " " end \
|
||||||
|
arg_list = arg_list .. a \
|
||||||
|
end \
|
||||||
|
end \
|
||||||
|
local n_arg = rpm.expand("%{-n*}") \
|
||||||
|
local g_arg = rpm.expand("%{-g*}") \
|
||||||
|
local l_arg = rpm.expand("%{?-l:-l}") \
|
||||||
|
local L_arg = rpm.expand("%{?-L:-L}") \
|
||||||
|
local a_arg = rpm.expand("%{?-a:-a}") \
|
||||||
|
local other_arg = rpm.expand("%{*}") \
|
||||||
|
local pname = rpm.expand("%pname") \
|
||||||
|
local python_flavor = rpm.expand("%python_flavor") \
|
||||||
|
-- io.stderr:write("n_arg "..n_arg.."\\n") \
|
||||||
|
if n_arg ~= "" then \
|
||||||
|
n_arg=n_arg:gsub("^(%w+)python%-(.*)","%1"..python_flavor.."-%2") \
|
||||||
|
-- io.stderr:write("n_arg modfied "..n_arg .."\\n") \
|
||||||
|
end \
|
||||||
|
local n_pname = pname:gsub("^python", python_flavor,1) \
|
||||||
|
rpm.define("pname "..n_pname) \
|
||||||
|
add_args (g_arg, "-g") \
|
||||||
|
add_args (n_arg, "-n") \
|
||||||
|
add_args (l_arg) \
|
||||||
|
add_args (L_arg) \
|
||||||
|
add_args (a_arg) \
|
||||||
|
add_args (other_arg) \
|
||||||
|
-- io.stderr:write("pname "..rpm.expand("%pname").."\\n") \
|
||||||
|
-- io.stderr:write(rpm.expand("%{hpc_master_package " .. arg_list .."}").."\\n") \
|
||||||
|
-- io.stderr:write(rpm.expand("%{hpc_master_package " .. arg_list .." -q}"):gsub("%s","").."\\n") \
|
||||||
|
local package = rpm.expand("%{hpc_master_package " .. arg_list .." -q}"):gsub("%s","") \
|
||||||
|
if package ~= "" then \
|
||||||
|
-- check if we have seen this package before. Since we will not have an empty files section \
|
||||||
|
-- skip it entirely! \
|
||||||
|
if _hpc_python_package_list[package] == true then \
|
||||||
|
rpm.define("pname " .. pname) \
|
||||||
|
return \
|
||||||
|
else \
|
||||||
|
_hpc_python_package_list[package] = true \
|
||||||
|
end \
|
||||||
|
end \
|
||||||
|
-- io.stderr:write(">>> "..package.."\\n") \
|
||||||
|
io.stderr:write("pname "..rpm.expand("%pname").."\\n") \
|
||||||
|
io.stderr:write("%{hpc_master_package " .. arg_list .. "}\\n\\n") \
|
||||||
|
print(rpm.expand("%{hpc_master_package " .. arg_list .. "}") .."\\n") \
|
||||||
|
rpm.define("pname " .. pname) \
|
||||||
|
-- io.stderr:write("pname "..rpm.expand("%pname").."\\n\\n") \
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# man pages
|
||||||
|
#
|
||||||
|
%hpc_compress_man() \
|
||||||
|
[ -n "%{*}" ] || { echo "no man page list!" >&2 ; exit 1; } \
|
||||||
|
for j in %{*}; do \
|
||||||
|
for i in $(ls %{buildroot}%hpc_mandir/man${j}/*.${j}* | grep -v ".*\.gz$"); \
|
||||||
|
do \
|
||||||
|
test -L $i && continue \
|
||||||
|
gzip $i \
|
||||||
|
done; \
|
||||||
|
done
|
||||||
|
|
5
suse-hpc.changes
Normal file
5
suse-hpc.changes
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed May 3 23:00:31 UTC 2017 - eich@suse.com
|
||||||
|
|
||||||
|
- Initial version.
|
||||||
|
|
50
suse-hpc.spec
Normal file
50
suse-hpc.spec
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#
|
||||||
|
# spec file for package suse_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/
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
Summary: SUSE HPC Environment
|
||||||
|
License: BSD-3-Clause
|
||||||
|
Group: Productivity/Clustering/Computing
|
||||||
|
Name: suse-hpc
|
||||||
|
Version: 0.1
|
||||||
|
Release: 0
|
||||||
|
Source0: macros.hpc
|
||||||
|
Source1: LICENSE
|
||||||
|
Url: http://www.suse.com/hpc
|
||||||
|
BuildArch: noarch
|
||||||
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
BuildRequires: sed
|
||||||
|
|
||||||
|
%description
|
||||||
|
Provide rpm macros for building and installing SUSE HPC
|
||||||
|
packages.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
|
||||||
|
%build
|
||||||
|
|
||||||
|
%install
|
||||||
|
mkdir -p %{buildroot}/%{_sysconfdir}/rpm
|
||||||
|
cp %{S:0} %{buildroot}/%{_sysconfdir}/rpm
|
||||||
|
%{__cp} %{S:1} .
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%doc LICENSE
|
||||||
|
%config %{_sysconfdir}/rpm/macros.hpc
|
||||||
|
|
||||||
|
%changelog
|
Loading…
Reference in New Issue
Block a user