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
186196%{! ?modulefile_path: %define modulefile_path /opt/%{name }/%{version }/share/openmpi/modulefiles}
187197%endif
188198
199+ %if %{all_external_3rd_party }
200+ %define _configure_3rd_party --with-libevent= external --with-hwloc= external --with-pmix= external --with-prrte= external
201+ %else
202+ %define _configure_3rd_party %{nil }
203+ %endif
204+
189205# Now that we have processed install_in_opt, we can see if
190206# modulefile_path was not set. If it was not, then set it to a
191207# default value.
212228%define __check_files %{nil }
213229%endif
214230
231+ # Set this to any options you want to pass in to configure.
215232%{! ?configure_options: %define configure_options %{nil }}
216233
217234%if ! %{use_default_rpm_opt_flags }
@@ -245,6 +262,12 @@ BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
245262%if %{disable_auto_requires }
246263AutoReq: no
247264%endif
265+ %if %{all_external_3rd_party }
266+ # If we require all external 3rd party packages, then assume the use
267+ # of the OS Libevent and Hwloc packages.
268+ BuildRequires: libevent-devel hwloc-devel
269+ Requires: libevent hwloc
270+ %endif
248271%if %{install_modulefile }
249272Requires: %{modules_rpm_name }
250273%endif
@@ -284,6 +307,12 @@ Provides: openmpi-runtime = %{version}
284307%if %{disable_auto_requires }
285308AutoReq: no
286309%endif
310+ %if %{all_external_3rd_party }
311+ # If we require all external 3rd party packages, then assume the use
312+ # of the OS Libevent and Hwloc packages.
313+ BuildRequires: libevent-devel hwloc-devel
314+ Requires: libevent hwloc
315+ %endif
287316%if %{install_modulefile }
288317Requires: %{modules_rpm_name }
289318%endif
@@ -465,7 +494,7 @@ CXXFLAGS="%{?cxxflags:%{cxxflags}}%{!?cxxflags:$RPM_OPT_FLAGS}"
465494FCFLAGS= "%{?fcflags:%{fcflags }}%{! ?fcflags:$RPM_OPT_FLAGS}"
466495export CFLAGS CXXFLAGS FCFLAGS
467496
468- %configure %{configure_options }
497+ %configure %{configure_options } %{ _configure_3rd_party }
469498%{__make} %{?mflags }
470499
471500
@@ -478,6 +507,12 @@ export CFLAGS CXXFLAGS FCFLAGS
478507%install
479508%{__make} install DESTDIR=$RPM_BUILD_ROOT %{?mflags_install }
480509
510+ # Copy all the HTML docs, too
511+ cd docs/_build/html
512+ mkdir -p $RPM_BUILD_ROOT/%{_pkgdocdir }/html
513+ cp -rp . $RPM_BUILD_ROOT/%{_pkgdocdir }/html
514+ cd -
515+
481516# We've had cases of config.log being left in the installation tree.
482517# We don't need that in an RPM.
483518find $RPM_BUILD_ROOT -name config.log -exec rm -f {} \;
595630# always gives a 0 exit status.
596631
597632# First, find all the files
598- rm -f all.files runtime.files remaining.files devel.files docs.files
633+ rm -f all.files runtime.files remaining.files devel.files
599634find $RPM_BUILD_ROOT -type f -o -type l | \
600635 sed -e "s@$RPM_BUILD_ROOT@@" \
601636 > all.files | /bin/true
@@ -605,53 +640,21 @@ find $RPM_BUILD_ROOT -type f -o -type l | \
605640# include wrapper compilers.
606641cat all.files | egrep '/lib/|/lib64/|/lib32/|/bin/|/etc/|/help-' > tmp.files | /bin/true
607642# 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
643+ # files, .la and .a files) and docs
644+ egrep -vi 'mpic|mpif|f77|f90|pkgconfig|\.la$|\.a$' tmp.files > runtime.files | /bin/true
610645rm -f tmp.files
611646
612647# Now take the runtime files out of all.files so that we don't get
613648# duplicates.
614649grep -v -f runtime.files all.files > remaining.files
615650
616- # Devel files, potentially including VT files. Basically -- just
617- # exclude the man pages and doc files.
651+ # Devel files. Basically -- just exclude the man pages and doc files.
618652cat remaining.files | \
619653 egrep -v '/man/|/doc/' \
620654 > devel.files | /bin/true
621655
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
641- %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-
653656%endif
654- # End of build_all_in_one_rpm
657+ # End of ! build_all_in_one_rpm
655658
656659#############################################################################
657660#
@@ -713,15 +716,15 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
713716%{_bindir }/*
714717%{_includedir }/*
715718%{_libdir }/*
716- %{_datadir }
719+ %{_datadir }/ *
717720%else
718721%{_prefix }
719722%endif
720723# If the sysconfdir is not under the prefix, then list it explicitly.
721724%if ! %{sysconfdir_in_prefix }
722725%{_sysconfdir }
723726%endif
724- # If %{ install_in_opt} , then we're instaling OMPI to
727+ # If install_in_opt, then we're instaling OMPI to
725728# /opt/openmpi/<version>. But be sure to also explicitly mention
726729# /opt/openmpi so that it can be removed by RPM when everything under
727730# there is also removed.
@@ -737,33 +740,34 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
737740%{shell_scripts_path }/%{shell_scripts_basename }.sh
738741%{shell_scripts_path }/%{shell_scripts_basename }.csh
739742%endif
740- %doc README.md INSTALL LICENSE
743+ %doc README.md LICENSE
741744
742745%else
743746
744747#
745748# Sub-package RPMs
746749#
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- #
750+ # Harder than all-in-one. Explicitly list all the files we want by
751+ # the various *.files we generated above. Only list directories if
752+ # they are not /usr (or assumedly any other location that does not
753+ # already exist).
752754
753755%files runtime -f runtime.files
754756%defattr(-, root, root, -)
755- %if %(test " %{_prefix}" = " /usr" && echo 1 || echo 0)
756- %{_bindir }/*
757- %{_libdir }/*
758- %{_datadir }
759- %else
760- %{_prefix }
761- %endif
757+ %if %(test " %{_prefix}" ! = " /usr" && echo 1 || echo 0)
758+ %dir %{_prefix }
762759# If the sysconfdir is not under the prefix, then list it explicitly.
763760%if ! %{sysconfdir_in_prefix }
764- %{_sysconfdir }
761+ %dir %{_sysconfdir }
762+ %endif
765763%endif
766- # If %{install_in_opt}, then we're instaling OMPI to
764+
765+ # Explicitly list pkgdatadir and get all flies in it. This may cause
766+ # "File is listed twice" warnings (which are annoying but harmless),
767+ # but it covers the case where pkgdatadir is outside of preifx.
768+ %{_pkgdatadir }
769+
770+ # If install_in_opt, then we're instaling OMPI to
767771# /opt/openmpi/<version>. But be sure to also explicitly mention
768772# /opt/openmpi so that it can be removed by RPM when everything under
769773# there is also removed. Also list /opt/openmpi/<version>/share so
@@ -781,21 +785,23 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
781785%{shell_scripts_path }/%{shell_scripts_basename }.sh
782786%{shell_scripts_path }/%{shell_scripts_basename }.csh
783787%endif
784- %doc README.md INSTALL LICENSE
785- %{_pkgdatadir }
788+ %doc README.md LICENSE
786789
787790%files devel -f devel.files
788791%defattr(-, root, root, -)
789- %{_includedir }
790792
793+ %files docs
794+ %defattr(-, root, root, -)
791795# Note that we list the mandir specifically here, because we want all
792796# 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, -)
797+ # after we installed them (e.g., foo.1.gz or foo.1.bz2), and we
798+ # therefore don't know the exact filenames.
797799%{_mandir }
798800
801+ # Explicitly list the pkgdocdir so that it will be removed when the
802+ # RPM is removed.
803+ %{_pkgdocdir }
804+
799805%endif
800806
801807
@@ -805,6 +811,16 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
805811#
806812#############################################################################
807813%changelog
814+ *
Mon Apr 04 2022 Jeff Squyres <[email protected] > 815+ - Updates for v5.0.0:
816+ - Default all 3rd-party packages to be "external".
817+ - Copy all the Sphinx-generated HTML files to pkgdocdir/html.
818+ - Remove no-longer-existing INSTALL file.
819+ - Tighten up files listings for the individual RPMs.
820+ - Convert -docs sub-package to exclusively use mandir and pkgdocdir
821+ (instead of docs.files).
822+ - Remove some stale F77 and VT references.
823+
808824*
Tue Mar 28 2017 Jeff Squyres <[email protected] > 809825- Reverting a decision from a prior changelog entry: if
810826 install_in_opt==1, then even put the modulefile under /opt.
@@ -959,4 +975,3 @@ test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
959975
960976*
Wed Mar 23 2005 Mezzanine <[email protected] > 961977- Specfile auto-generated by Mezzanine
962-
0 commit comments