-
Notifications
You must be signed in to change notification settings - Fork 0
Packaging notes
We use the altcc-rpm-macros package to ease the task of configuring the spec files.
Generally start with Fedora package:
fedpkg clone %package% cd %package% fedpkg prep
- Added to top:
%global shortname hdf5 %global ver 1.8.17 %?altcc_init
If you do not use "shortname" and "ver" for your macro names, you can set them explicitly with the -n and -v options, e.g.:
%{?altcc_init:%altcc_init -n %{shortname} -v %{ver}}
This initializes the altcc macros and attempts to allow for a single spec to be used for both normal compilation and altcc builds.
- Add %{?altcc_pkg_suffix} to Name, and use %{ver} for Version:
Name: %{shortname}%{?altcc_pkg_suffix}
Version: %{ver}
- Add %{?altcc_dep_suffix} to any BuildRequires/Requires for other altcc package names, e.g.:
BuildRequires: hdf5%{?altcc_dep_suffix}-devel
- Drop BR on gcc-* for non-altcc builds, if desired:
%{!?altcc:BuildRequires: gcc-gfortran}
- To the main package that contains the environment modules, add:
%?altcc_reqmodules %?altcc_provide
- To each sub-package, add:
%package devel
%{?altcc:%altcc_provide devel}
If the package name is given with -n, use:
%package -n WRF%{?altcc_pkg_suffix}
%{?altcc:%altcc_provide -n WRF}
- Setup macro needs shortname-version:
%setup -q -n %{shortname}-%{version}
As does any other use of %{name} during the %prep/%build/%install/%files sections.
- Do not use module purge, unload any loaded modules. You'll need to load the modules of any dependent altcc packages:
%{?altcc:module load hdf5}
- Add source:
Source2: %{shortname}.module.in
- In %install:
%{?altcc:%altcc_writemodule %SOURCE2}
- %files:
%{?altcc:%altcc_files %{_bindir} %{_libdir} %{_mandir}/man1}
We add an item for each different leaf directory installed into. Parent directories are automatically owned as well. Add a "-m" option to the package that contains the module file. This is generally the main package unless there is a -libs sub-package.
- To handle %doc, add -d to %altcc_files and add %?altcc_doc to %install
- To handle %license, add -l to %altcc_files and add %?altcc_license to %install
When packaging an MPI implementation you need to pass -m option to %altcc_init: %{?altcc:%altcc_init -m}
The big change from Fedora is with MPI packages. Fedora uses its own module layout for parallel building and install of MPI packages. Instead we use a system where we either build a serial or a parallel package depending on what module files are loaded. So we strip out all of the mpi conditionals and instead have sections like:
%if %{?altcc_with_mpi}
# Serial build
%configure --enable-extra-example-tests
%else
# MPI builds
export CC=mpicc
export F77=mpif90
export FC=mpif90
%configure \
--enable-parallel \
--enable-parallel-tests
%endif