99# University of Stuttgart. All rights reserved.
1010# Copyright (c) 2004-2005 The Regents of the University of California.
1111# All rights reserved.
12- # Copyright (c) 2006-2020 Cisco Systems, Inc. All rights reserved.
12+ # Copyright (c) 2006-2022 Cisco Systems, Inc. All rights reserved.
1313# Copyright (c) 2013 Mellanox Technologies, Inc.
1414# All rights reserved.
1515# Copyright (c) 2015 Research Organization for Information Science
4343#
4444# shell$ rpmbuild ... --define 'install_in_opt 1' ...
4545#
46- # Or (a multi-token example):
47- #
48- # shell$ rpmbuild ... \
49- # --define 'configure_options CFLAGS=-g --with-openib=/usr/local/ofed' ...
50- #
5146#############################################################################
5247
5348# Define this if you want to make this SRPM build in
5853# type: bool (0/1)
5954%{! ?install_in_opt: %define install_in_opt 0}
6055
56+ # This specfile expects to find all required 3rd party packages
57+ # (Libevent, Hwloc, PMIx, PRRTE) externally, and will not use the
58+ # internal/embedded copies of these packages. This behavior is
59+ # strongly recomended for packagers. However, if you want to override
60+ # this behavior, change the definition below to 0.
61+ #
62+ # NOTE: This option will cause "--with-libevent=external
63+ # --with-hwloc=external --with-pmix=external --with-prrte=external" to
64+ # be added to the arguments to configure. If you wish to use different
65+ # CLI options, set this value to 0 and set configure_options to the
66+ # CLI options you want.
67+ %{! ?all_external_3rd_party: %define all_external_3rd_party 1}
68+
6169# Define this if you want this RPM to install environment setup
6270# shell scripts.
6371# type: bool (0/1)
138146
139147# On some platforms, Open MPI/SHMEM just flat-out doesn't work with
140148# -D_FORTIFY_SOURCE (e.g., some users have reported that there are
141- # problems on ioa64 platforms). In this case, just turn it off
149+ # problems on ia64 platforms). In this case, just turn it off
142150# (meaning: this specfile will strip out that flag from the
143151# OS-provided compiler flags). We already strip out _FORTIFY_SOURCE
144152# for non-GCC compilers; setting this option to 0 will *always* strip
145153# it out, even if you're using GCC.
146154# type: bool (0/1)
147155%{! ?allow_fortify_source: %define allow_fortify_source 1}
148156
149- # Select md5 packing algorithm, that src.rpm created on one distro can be read on another.
157+ # Select md5 packing algorithm, that src.rpm created on one distro can
158+ # be read on another.
150159%global _binary_filedigest_algorithm 1
151160%global _source_filedigest_algorithm 1
152161
153162# Define this to 1 if you want to keep libtool achive files
154163# Default is 0 (remove *.la files)
155164# type: bool (0/1)
156165%{! ?install_libtool_archive: %define install_libtool_archive 0}
166+
157167#############################################################################
158168#
159169# Configuration Logic
177187# Per advice from Doug Ledford at Red Hat, docdir is supposed to be in
178188# a fixed location. But if you're installing a package in /opt, all
179189# bets are off. So feel free to install it anywhere in your tree. He
180- # suggests $prefix/doc.
181- %define _defaultdocdir /opt/%{name }/%{version }/doc
190+ # suggests $prefix/doc, but the GNU Autotools these days default to
191+ # $prefix/share/doc.
192+ %define _defaultdocdir /opt/%{name }/%{version }/share/doc
182193
183194# Also put the modulefile in /opt (unless the user already specified
184195# where they want it to go -- the modulefile is a bit different in
185196# that the user may want it outside of /opt).
186197%{! ?modulefile_path: %define modulefile_path /opt/%{name }/%{version }/share/openmpi/modulefiles}
187198%endif
188199
200+ %if %{all_external_3rd_party }
201+ %define _configure_3rd_party --with-libevent= external --with-hwloc= external --with-pmix= external --with-prrte= external
202+ %else
203+ %define _configure_3rd_party %{nil }
204+ %endif
205+
189206# Now that we have processed install_in_opt, we can see if
190207# modulefile_path was not set. If it was not, then set it to a
191208# default value.
212229%define __check_files %{nil }
213230%endif
214231
232+ # Set this to any options you want to pass in to configure.
215233%{! ?configure_options: %define configure_options %{nil }}
216234
217235%if ! %{use_default_rpm_opt_flags }
@@ -245,6 +263,12 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
245263%if %{disable_auto_requires }
246264AutoReq: no
247265%endif
266+ %if %{all_external_3rd_party }
267+ # If we require all external 3rd party packages, then assume the use
268+ # of the OS Libevent and Hwloc packages.
269+ BuildRequires: libevent-devel hwloc-devel
270+ Requires: libevent hwloc
271+ %endif
248272%if %{install_modulefile }
249273Requires: %{modules_rpm_name }
250274%endif
@@ -284,6 +308,12 @@ Provides: openmpi-runtime = %{version}
284308%if %{disable_auto_requires }
285309AutoReq: no
286310%endif
311+ %if %{all_external_3rd_party }
312+ # If we require all external 3rd party packages, then assume the use
313+ # of the OS Libevent and Hwloc packages.
314+ BuildRequires: libevent-devel hwloc-devel
315+ Requires: libevent hwloc
316+ %endif
287317%if %{install_modulefile }
288318Requires: %{modules_rpm_name }
289319%endif
@@ -465,7 +495,7 @@ CXXFLAGS="%{?cxxflags:%{cxxflags}}%{!?cxxflags:$RPM_OPT_FLAGS}"
465495FCFLAGS= "%{?fcflags:%{fcflags }}%{! ?fcflags:$RPM_OPT_FLAGS}"
466496export CFLAGS CXXFLAGS FCFLAGS
467497
468- %configure %{configure_options }
498+ %configure %{configure_options } %{ _configure_3rd_party }
469499%{__make} %{?mflags }
470500
471501
@@ -595,63 +625,34 @@ EOF
595625# always gives a 0 exit status.
596626
597627# First, find all the files
598- rm -f all.files runtime.files remaining.files devel.files docs.files
628+ rm -f all.files runtime.files remaining.files devel.files
599629find $RPM_BUILD_ROOT -type f -o -type l | \
600630 sed -e "s@$RPM_BUILD_ROOT@@" \
601631 > all.files | /bin/true
602632
603633# Runtime files. This should generally be library files and some
604634# executables (no man pages, no doc files, no header files). Do *not*
605635# include wrapper compilers.
606- cat all.files | egrep '/lib/|/lib64/|/lib32/|/bin/|/etc/|/help-' > tmp.files | /bin/true
636+ cat all.files | \
637+ egrep '/lib/|/lib64/|/lib32/|/bin/|/etc/|/help-' \
638+ > tmp.files | /bin/true
607639# Snip out a bunch of executables (e.g., wrapper compilers, pkgconfig
608- # files, .la and .a files)
609- egrep -vi 'mpic|mpif|ortec|f77|f90|pkgconfig|\.la$|\.a$' tmp.files > runtime.files | /bin/true
640+ # files, .la and .a files) and docs
641+ egrep -vi 'bin/mpic|bin/mpif|bin/mpif77|bin/mpif90|pkgconfig|wrapper|\.mod$|\.la$|\.a$' tmp.files > runtime.files | /bin/true
642+
610643rm -f tmp.files
611644
612645# Now take the runtime files out of all.files so that we don't get
613646# duplicates.
614647grep -v -f runtime.files all.files > remaining.files
615648
616- # Devel files, potentially including VT files. Basically -- just
617- # exclude the man pages and doc files.
649+ # Devel files. Basically -- just exclude the man pages and doc files.
618650cat remaining.files | \
619651 egrep -v '/man/|/doc/' \
620652 > devel.files | /bin/true
621653
622- # Now take those files out of reaming.files so that we don't get
623- # duplicates.
624- grep -v -f devel.files remaining.files > docs.files
625-
626- #################################################
627-
628- # Now that we have a final list of files for each of the runtime,
629- # devel, and docs RPMs, snip even a few more files out of those lists
630- # because for directories that are wholly in only one RPM, we just
631- # list that directory in the file lists below, and RPM will pick up
632- # all files in that tree. We therefore don't want to list any files
633- # in those trees in our *.files file lists. Additionally, the man
634- # pages may get compressed by rpmbuild after this "install" step, so we
635- # might not even have their final filenames, anyway.
636-
637- # runtime sub package
638- %if ! %{sysconfdir_in_prefix }
639- grep -v %{_sysconfdir } runtime.files > tmp.files | /bin/true
640- mv tmp.files runtime.files
641654%endif
642- grep -v %{_pkgdatadir } runtime.files > tmp.files | /bin/true
643- mv tmp.files runtime.files
644-
645- # devel sub package
646- grep -v %{_includedir } devel.files > tmp.files | /bin/true
647- mv tmp.files devel.files
648-
649- # docs sub package
650- grep -v %{_mandir } docs.files > tmp.files | /bin/true
651- mv tmp.files docs.files
652-
653- %endif
654- # End of build_all_in_one_rpm
655+ # End of !build_all_in_one_rpm
655656
656657#############################################################################
657658#
@@ -713,15 +714,15 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
713714%{_bindir }/*
714715%{_includedir }/*
715716%{_libdir }/*
716- %{_datadir }
717+ %{_datadir }/ *
717718%else
718719%{_prefix }
719720%endif
720721# If the sysconfdir is not under the prefix, then list it explicitly.
721722%if ! %{sysconfdir_in_prefix }
722723%{_sysconfdir }
723724%endif
724- # If %{ install_in_opt} , then we're instaling OMPI to
725+ # If install_in_opt, then we're instaling OMPI to
725726# /opt/openmpi/<version>. But be sure to also explicitly mention
726727# /opt/openmpi so that it can be removed by RPM when everything under
727728# there is also removed.
@@ -737,33 +738,30 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
737738%{shell_scripts_path }/%{shell_scripts_basename }.sh
738739%{shell_scripts_path }/%{shell_scripts_basename }.csh
739740%endif
740- %doc README.md INSTALL LICENSE
741+ %doc README.md LICENSE
741742
742743%else
743744
744745#
745746# Sub-package RPMs
746747#
747- # Harder than all-in-one. We list the directories specifically so
748- # that if the RPM creates directories when it is installed, we will
749- # remove them when the RPM is uninstalled. We also have to use
750- # specific file lists.
751- #
748+ # Harder than all-in-one. Explicitly list all the files we want by
749+ # the various *.files we generated above. Only list directories if
750+ # they are not /usr (or assumedly any other location that does not
751+ # already exist).
752752
753753%files runtime -f runtime.files
754754%defattr(-, root, root, -)
755- %if %(test " %{_prefix}" = " /usr" && echo 1 || echo 0)
756- %{_bindir }/*
757- %{_libdir }/*
758- %{_datadir }
759- %else
760- %{_prefix }
761- %endif
755+ %if %(test " %{_prefix}" ! = " /usr" && echo 1 || echo 0)
756+ %dir %{_prefix }
757+ %dir %{_pkgdatadir }
762758# If the sysconfdir is not under the prefix, then list it explicitly.
763759%if ! %{sysconfdir_in_prefix }
764- %{_sysconfdir }
760+ %dir %{_sysconfdir }
761+ %endif
765762%endif
766- # If %{install_in_opt}, then we're instaling OMPI to
763+
764+ # If install_in_opt, then we're instaling OMPI to
767765# /opt/openmpi/<version>. But be sure to also explicitly mention
768766# /opt/openmpi so that it can be removed by RPM when everything under
769767# there is also removed. Also list /opt/openmpi/<version>/share so
@@ -781,21 +779,23 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
781779%{shell_scripts_path }/%{shell_scripts_basename }.sh
782780%{shell_scripts_path }/%{shell_scripts_basename }.csh
783781%endif
784- %doc README.md INSTALL LICENSE
785- %{_pkgdatadir }
782+ %doc README.md LICENSE
786783
787784%files devel -f devel.files
788785%defattr(-, root, root, -)
789- %{_includedir }
790786
787+ %files docs
788+ %defattr(-, root, root, -)
791789# Note that we list the mandir specifically here, because we want all
792790# files found in that tree, because rpmbuild may have compressed them
793- # (e.g., foo.1.gz or foo.1.bz2) -- and we therefore don't know the
794- # exact filenames.
795- %files docs -f docs.files
796- %defattr(-, root, root, -)
791+ # after we installed them (e.g., foo.1.gz or foo.1.bz2), and we
792+ # therefore don't know the exact filenames.
797793%{_mandir }
798794
795+ # Explicitly list the pkgdocdir so that it will be removed when the
796+ # RPM is removed.
797+ %{_pkgdocdir }
798+
799799%endif
800800
801801
@@ -805,6 +805,15 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
805805#
806806#############################################################################
807807%changelog
808+ *
Mon Apr 04 2022 Jeff Squyres <[email protected] > 809+ - Updates for v5.0.0:
810+ - Default all 3rd-party packages to be "external".
811+ - Remove no-longer-existing INSTALL file.
812+ - Tighten up files listings for the individual RPMs.
813+ - Convert -docs sub-package to exclusively use mandir and pkgdocdir
814+ (instead of docs.files).
815+ - Remove some stale F77 and VT references.
816+
808817*
Tue Mar 28 2017 Jeff Squyres <[email protected] > 809818- Reverting a decision from a prior changelog entry: if
810819 install_in_opt==1, then even put the modulefile under /opt.
@@ -959,4 +968,3 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
959968
960969*
Wed Mar 23 2005 Mezzanine <[email protected] > 961970- Specfile auto-generated by Mezzanine
962-
0 commit comments