Install the user tools using alternatives (#1785308)

Signed-off-by: David Cantrell <david.l.cantrell@gmail.com>
This commit is contained in:
David Cantrell 2020-02-24 14:43:23 -05:00
parent a419f21006
commit 1dcdb98493

View File

@ -1,27 +1,29 @@
Name: mandoc Name: mandoc
Version: 1.14.5 Version: 1.14.5
Release: 3%{?dist} Release: 4%{?dist}
Summary: A suite of tools for compiling mdoc and man Summary: A suite of tools for compiling mdoc and man
License: ISC License: ISC
URL: https://mandoc.bsd.lv/ URL: https://mandoc.bsd.lv/
Source0: https://mandoc.bsd.lv/snapshots/mandoc-%{version}.tar.gz Source0: https://mandoc.bsd.lv/snapshots/mandoc-%{version}.tar.gz
Patch0: mandoc-shared-library.patch Patch0: mandoc-shared-library.patch
# Separate the commands for installing libraries and headers # Separate the commands for installing libraries and headers
Patch1: mandoc-install-hdr.patch Patch1: mandoc-install-hdr.patch
# Simplify the compat #if for functions # Simplify the compat #if for functions
Patch2: mandoc-simplify-compat.patch Patch2: mandoc-simplify-compat.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: make BuildRequires: make
BuildRequires: zlib-devel BuildRequires: zlib-devel
# requirements for %%check # requirements for %%check
BuildRequires: perl(IPC::Open3) BuildRequires: perl(IPC::Open3)
Requires: libmandoc%{?_isa} = %{version}-%{release} Requires: libmandoc%{?_isa} = %{version}-%{release}
Requires(post): %{_sbindir}/update-alternatives
Requires(postun): %{_sbindir}/update-alternatives
%description %description
mandoc is a suite of tools compiling mdoc, the roff macro language of choice mandoc is a suite of tools compiling mdoc, the roff macro language of choice
@ -66,14 +68,17 @@ echo 'LN="ln -sf"' >> configure.local
# change the names of binaries, conf files, and section 7 man pages # change the names of binaries, conf files, and section 7 man pages
# to avoid conflicts with man-db and groff # to avoid conflicts with man-db and groff
echo 'MANM_MANCONF=mandoc.conf' >> configure.local echo 'MANM_MANCONF=mandoc.conf' >> configure.local
echo 'MANM_MAN=mandoc_man' >> configure.local echo 'BINM_MAN=man.mandoc' >> configure.local
echo 'MANM_MDOC=mandoc_mdoc' >> configure.local echo 'BINM_APROPOS=apropos.mandoc' >> configure.local
echo 'BINM_MAN=mman' >> configure.local echo 'BINM_WHATIS=whatis.mandoc' >> configure.local
echo 'BINM_APROPOS=mapropos' >> configure.local echo 'BINM_MAKEWHATIS=makewhatis.mandoc' >> configure.local
echo 'BINM_WHATIS=mwhatis' >> configure.local echo 'BINM_SOELIM=soelim.mandoc' >> configure.local
echo 'BINM_MAKEWHATIS=mandocdb' >> configure.local echo 'MANM_MAN=man.mandoc' >> configure.local
echo 'BINM_SOELIM=msoelim' >> configure.local echo 'MANM_MDOC=mdoc.mandoc' >> configure.local
echo 'MANM_ROFF=roff.mandoc' >> configure.local
echo 'MANM_EQN=eqn.mandoc' >> configure.local
echo 'MANM_TBL=tbl.mandoc' >> configure.local
# override the install permissions so that owner-write bits are set, # override the install permissions so that owner-write bits are set,
# so rpmbuild can do whatever modifications it does post-%%install # so rpmbuild can do whatever modifications it does post-%%install
@ -92,35 +97,98 @@ make %{?_smp_mflags}
%install %install
%make_install %make_install
# Compress all the man pages
find %{buildroot}/%{_mandir}/ -type f | xargs gzip -9
# Touch all the locations that update-alternatives will use
touch %{buildroot}%{_bindir}/man
touch %{buildroot}%{_bindir}/apropos
touch %{buildroot}%{_bindir}/whatis
touch %{buildroot}%{_bindir}/soelim
touch %{buildroot}%{_sbindir}/makewhatis
touch %{buildroot}%{_mandir}/man1/apropos.1.gz
touch %{buildroot}%{_mandir}/man1/man.1.gz
touch %{buildroot}%{_mandir}/man1/soelim.1.gz
touch %{buildroot}%{_mandir}/man1/whatis.1.gz
touch %{buildroot}%{_mandir}/man7/man.7.gz
touch %{buildroot}%{_mandir}/man7/mdoc.7.gz
touch %{buildroot}%{_mandir}/man7/roff.7.gz
touch %{buildroot}%{_mandir}/man7/eqn.7.gz
touch %{buildroot}%{_mandir}/man7/tbl.7.gz
touch %{buildroot}%{_mandir}/man8/makewhatis.8.gz
%check %check
env LD_LIBRARY_PATH="$PWD" make regress env LD_LIBRARY_PATH="$PWD" make regress
%ldconfig_scriptlets -n libmandoc %ldconfig_scriptlets -n libmandoc
%postun
if [ $1 -ge 1 ]; then
if [ "$(readlink %{_sysconfdir}/alternatives/mandoc)" = "%{_bindir}/man.mandoc" ]; then
%{_sbindir}/alternatives --set mandoc %{_bindir}/man.mandoc
fi
fi
%post
%{_sbindir}/update-alternatives --install %{_bindir}/man mandoc %{_bindir}/man.mandoc 200 \
--slave %{_bindir}/soelim mandoc-soelim %{_bindir}/soelim.mandoc \
--slave %{_bindir}/whatis mandoc-whatis %{_bindir}/whatis.mandoc \
--slave %{_sbindir}/makewhatis mandoc-makewhatis %{_sbindir}/makewhatis.mandoc \
--slave %{_mandir}/man1/apropos.1.gz mandoc-aproposman %{_mandir}/man1/apropos.mandoc.1.gz \
--slave %{_mandir}/man1/man.1.gz mandoc-man1man %{_mandir}/man1/man.mandoc.1.gz \
--slave %{_mandir}/man1/soelim.1.gz mandoc-soelimman %{_mandir}/man1/soelim.mandoc.1.gz \
--slave %{_mandir}/man1/whatis.1.gz mandoc-whatisman %{_mandir}/man1/whatis.mandoc.1.gz \
--slave %{_mandir}/man7/man.7.gz mandoc-man7man %{_mandir}/man7/man.mandoc.7.gz \
--slave %{_mandir}/man7/mdoc.7.gz mandoc-mdocman %{_mandir}/man7/mdoc.mandoc.7.gz \
--slave %{_mandir}/man7/roff.7.gz mandoc-roffman %{_mandir}/man7/roff.mandoc.7.gz \
--slave %{_mandir}/man7/eqn.7.gz mandoc-eqnman %{_mandir}/man7/eqn.mandoc.7.gz \
--slave %{_mandir}/man7/tbl.7.gz mandoc-tblman %{_mandir}/man7/tbl.mandoc.7.gz
--slave %{_mandir}/man8/makewhatis.8.gz mandoc-makewhatisman %{_mandir}/man8/makewhatis.mandoc.8.gz
%preun
if [ $1 -eq 0 ]; then
%{_sbindir}/update-alternatives --remove mandoc %{_bindir}/man.mandoc
fi
%files %files
%license LICENSE %license LICENSE
%{_bindir}/demandoc %{_bindir}/demandoc
%{_bindir}/mandoc %{_bindir}/mandoc
%{_bindir}/mapropos %{_bindir}/apropos.mandoc
%{_bindir}/mman %ghost %{_bindir}/apropos
%{_bindir}/msoelim %{_bindir}/man.mandoc
%{_bindir}/mwhatis %ghost %{_bindir}/man
%{_sbindir}/mandocdb %{_bindir}/soelim.mandoc
%{_mandir}/man1/demandoc.1* %ghost %{_bindir}/soelim
%{_mandir}/man1/mandoc.1* %{_bindir}/whatis.mandoc
%{_mandir}/man1/mapropos.1* %ghost %{_bindir}/whatis
%{_mandir}/man1/mman.1* %{_sbindir}/makewhatis.mandoc
%{_mandir}/man1/msoelim.1* %ghost %{_sbindir}/makewhatis
%{_mandir}/man1/mwhatis.1* %{_mandir}/man1/demandoc.1.gz
%{_mandir}/man5/mandoc.conf.5* %{_mandir}/man1/mandoc.1.gz
%{_mandir}/man5/mandoc.db.5* %{_mandir}/man1/apropos.mandoc.1.gz
%{_mandir}/man7/eqn.7* %ghost %{_mandir}/man1/apropos.1.gz
%{_mandir}/man7/mandoc_char.7* %{_mandir}/man1/man.mandoc.1.gz
%{_mandir}/man7/mandoc_man.7* %ghost %{_mandir}/man1/man.1.gz
%{_mandir}/man7/mandoc_mdoc.7* %{_mandir}/man1/soelim.mandoc.1.gz
%{_mandir}/man7/roff.7* %ghost %{_mandir}/man1/soelim.1.gz
%{_mandir}/man7/tbl.7* %{_mandir}/man1/whatis.mandoc.1.gz
%{_mandir}/man8/mandocdb.8* %ghost %{_mandir}/man1/whatis.1.gz
%{_mandir}/man5/mandoc.conf.5.gz
%{_mandir}/man5/mandoc.db.5.gz
%{_mandir}/man7/eqn.mandoc.7.gz
%ghost %{_mandir}/man7/eqn.7.gz
%{_mandir}/man7/mandoc_char.7.gz
%{_mandir}/man7/man.mandoc.7.gz
%ghost %{_mandir}/man7/man.7.gz
%{_mandir}/man7/mdoc.mandoc.7.gz
%ghost %{_mandir}/man7/mdoc.7.gz
%{_mandir}/man7/roff.mandoc.7.gz
%ghost %{_mandir}/man7/roff.7.gz
%{_mandir}/man7/tbl.mandoc.7.gz
%ghost %{_mandir}/man7/tbl.7.gz
%{_mandir}/man8/makewhatis.mandoc.8.gz
%ghost %{_mandir}/man8/makewhatis.8.gz
%files -n libmandoc %files -n libmandoc
%license LICENSE %license LICENSE
@ -146,6 +214,9 @@ env LD_LIBRARY_PATH="$PWD" make regress
%{_mandir}/man3/tbl.3* %{_mandir}/man3/tbl.3*
%changelog %changelog
* Mon Feb 24 2020 David Cantrell <dcantrell@redhat.com> - 1.14.5-4
- Install the user tools using alternatives (#1785308)
* Thu Feb 06 2020 David Cantrell <dcantrell@redhat.com> - 1.14.5-3 * Thu Feb 06 2020 David Cantrell <dcantrell@redhat.com> - 1.14.5-3
- Simplify the compat preprocessor tests (#1799629) - Simplify the compat preprocessor tests (#1799629)