From e9911bbc0faec0f40397984ae965061276d53d65 Mon Sep 17 00:00:00 2001 From: jxy_git Date: Thu, 20 Jun 2024 14:50:02 +0800 Subject: [PATCH] Fix mandoc install error --- 0001-add-compile-option.patch | 25 ++++++ mandoc.spec | 162 ++++++++++++++-------------------- 2 files changed, 91 insertions(+), 96 deletions(-) create mode 100644 0001-add-compile-option.patch diff --git a/0001-add-compile-option.patch b/0001-add-compile-option.patch new file mode 100644 index 0000000..9c8d3fd --- /dev/null +++ b/0001-add-compile-option.patch @@ -0,0 +1,25 @@ +From b67c8c1b249046b92966b0ad7768c07cbad59445 Mon Sep 17 00:00:00 2001 +From: zhangchao13 +Date: Thu, 6 Apr 2023 14:48:07 +0800 +Subject: [PATCH] fix + +--- + configure | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure b/configure +index 5cf4e08..b8566dd 100644 +--- a/configure ++++ b/configure +@@ -42,7 +42,7 @@ OSNAME= + UTF8_LOCALE= + + AR=ar +-CC=cc ++CC=$CC + CFLAGS= + FATAL=0 + LDADD= +-- +2.39.2.windows.1 + diff --git a/mandoc.spec b/mandoc.spec index a63bca7..cb83d19 100644 --- a/mandoc.spec +++ b/mandoc.spec @@ -1,23 +1,25 @@ Name: mandoc Version: 1.14.6 -Release: 1 +Release: 5 Summary: A suite of tools for compiling mdoc and man License: ISC URL: https://mandoc.bsd.lv/ Source0: https://mandoc.bsd.lv/snapshots/mandoc-%{version}.tar.gz +Patch0: 0001-add-compile-option.patch BuildRequires: gcc BuildRequires: make +BuildRequires: clang BuildRequires: zlib-devel # requirements for %%check BuildRequires: perl-interpreter BuildRequires: perl(IPC::Open3) -Requires(post): %{_sbindir}/update-alternatives +Requires(post): %{_sbindir}/update-alternatives Requires(postun): %{_sbindir}/update-alternatives -Requires(preun): %{_sbindir}/update-alternatives +Requires(preun): %{_sbindir}/update-alternatives # The shared library package has been removed per discussion with the # upstream maintainer. If using the library, the static library is @@ -68,7 +70,12 @@ echo 'INSTALL_DATA="${INSTALL} -m 0644"' >> configure.local echo 'INSTALL_LIBMANDOC=1' >> configure.local +%ifarch riscv64 +echo 'CFLAGS="%{optflags} -fPIC -Werror=implicit-function-declaration"' >> configure.local +%else echo 'CFLAGS="%{optflags} -fPIC"' >> configure.local +%endif +export CC=clang ./configure %make_build @@ -78,125 +85,76 @@ echo 'CFLAGS="%{optflags} -fPIC"' >> configure.local # Ensure headers do not have the execute bit set chmod -x %{buildroot}%{_includedir}/*.h -# Rename files for alternative usage -mv %{buildroot}%{_bindir}/man %{buildroot}%{_bindir}/man.mandoc -mv %{buildroot}%{_bindir}/apropos %{buildroot}%{_bindir}/apropos.mandoc -mv %{buildroot}%{_bindir}/whatis %{buildroot}%{_bindir}/whatis.mandoc -mv %{buildroot}%{_bindir}/soelim %{buildroot}%{_bindir}/soelim.mandoc -mv %{buildroot}%{_sbindir}/makewhatis %{buildroot}%{_sbindir}/makewhatis.mandoc -mv %{buildroot}%{_mandir}/man1/apropos.1 %{buildroot}%{_mandir}/man1/apropos.mandoc.1 -mv %{buildroot}%{_mandir}/man1/man.1 %{buildroot}%{_mandir}/man1/man.mandoc.1 -mv %{buildroot}%{_mandir}/man1/soelim.1 %{buildroot}%{_mandir}/man1/soelim.mandoc.1 -mv %{buildroot}%{_mandir}/man1/whatis.1 %{buildroot}%{_mandir}/man1/whatis.mandoc.1 -mv %{buildroot}%{_mandir}/man7/man.7 %{buildroot}%{_mandir}/man7/man.mandoc.7 -mv %{buildroot}%{_mandir}/man7/roff.7 %{buildroot}%{_mandir}/man7/roff.mandoc.7 -mv %{buildroot}%{_mandir}/man7/eqn.7 %{buildroot}%{_mandir}/man7/eqn.mandoc.7 -mv %{buildroot}%{_mandir}/man7/tbl.7 %{buildroot}%{_mandir}/man7/tbl.mandoc.7 -mv %{buildroot}%{_mandir}/man8/makewhatis.8 %{buildroot}%{_mandir}/man8/makewhatis.mandoc.8 - -# 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 -touch %{buildroot}%{_mandir}/man1/man.1 -touch %{buildroot}%{_mandir}/man1/soelim.1 -touch %{buildroot}%{_mandir}/man1/whatis.1 -touch %{buildroot}%{_mandir}/man7/man.7 -touch %{buildroot}%{_mandir}/man7/roff.7 -touch %{buildroot}%{_mandir}/man7/eqn.7 -touch %{buildroot}%{_mandir}/man7/tbl.7 -touch %{buildroot}%{_mandir}/man8/makewhatis.8 +# rename files for alternative usage +for f in man apropos whatis soelim; do + # Rename binary executables + mv %{buildroot}%{_bindir}/$f %{buildroot}%{_bindir}/$f.%{name} + + # Rename corresponding man pages + mv %{buildroot}%{_mandir}/man1/$f.1 %{buildroot}%{_mandir}/man1/$f.%{name}.1 +done %check env LD_LIBRARY_PATH="$PWD" %make_build regress -%postun -if [ $1 -ge 1 ]; then - if [ "$(readlink %{_sysconfdir}/alternatives/man)" = "%{_bindir}/man.mandoc" ]; then - %{_sbindir}/alternatives --set man %{_bindir}/man.mandoc - fi +%pre +for f in man apropos whatis; do + [ -L %{_bindir}/$f ] || %{__rm} -f %{_bindir}/$f >/dev/null 2>&1 || : + [ -L %{_mandir}/man1/$f.1.gz ] || %{__rm} -f %{_mandir}/man1/$f.1.gz >/dev/null 2>&1 || : +done - if [ "$(readlink %{_sysconfdir}/alternatives/soelim)" = "%{_bindir}/soelim.mandoc" ]; then - %{_sbindir}/alternatives --set soelim %{_bindir}/soelim.mandoc - fi - - if [ "$(readlink %{_sysconfdir}/alternatives/roff.7.gz)" = "%{_mandir}/man7/roff.mandoc.7.gz" ]; then - %{_sbindir}/alternatives --set roff.7.gz %{_mandir}/man7/roff.mandoc.7.gz - fi - - if [ "$(readlink %{_sysconfdir}/alternatives/man.7.gz)" = "%{_mandir}/man7/man.mandoc.7.gz" ]; then - %{_sbindir}/alternatives --set man.7.gz %{_mandir}/man7/man.mandoc.7.gz +if [ -e /usr/lib/systemd/system/mandb.timer ]; then + if test -d /run/systemd; then + systemctl stop man-db.timer >/dev/null 2>&1 || : + systemctl -q disable man-db.timer >/dev/null 2>&1 || : fi fi -%post -%{_sbindir}/update-alternatives --install %{_bindir}/man man %{_bindir}/man.mandoc 200 \ - --slave %{_bindir}/apropos apropos %{_bindir}/apropos.mandoc \ - --slave %{_bindir}/whatis whatis %{_bindir}/whatis.mandoc \ - --slave %{_sbindir}/makewhatis makewhatis %{_sbindir}/makewhatis.mandoc \ - --slave %{_mandir}/man1/apropos.1.gz apropos.1.gz %{_mandir}/man1/apropos.mandoc.1.gz \ - --slave %{_mandir}/man1/man.1.gz man.1.gz %{_mandir}/man1/man.mandoc.1.gz \ - --slave %{_mandir}/man1/whatis.1.gz whatis.1.gz %{_mandir}/man1/whatis.mandoc.1.gz \ - --slave %{_mandir}/man8/makewhatis.8.gz makewhatis.8.gz %{_mandir}/man8/makewhatis.mandoc.8.gz - -%{_sbindir}/update-alternatives --install %{_bindir}/soelim soelim %{_bindir}/soelim.mandoc 200 \ - --slave %{_mandir}/man1/soelim.1.gz soelim.1.gz %{_mandir}/man1/soelim.mandoc.1.gz - -%{_sbindir}/update-alternatives --install %{_mandir}/man7/roff.7.gz roff.7.gz %{_mandir}/man7/roff.mandoc.7.gz 200 \ - --slave %{_mandir}/man7/eqn.7.gz eqn.7.gz %{_mandir}/man7/eqn.mandoc.7.gz \ - --slave %{_mandir}/man7/tbl.7.gz tbl.7.gz %{_mandir}/man7/tbl.mandoc.7.gz - -%{_sbindir}/update-alternatives --install %{_mandir}/man7/man.7.gz man.7.gz %{_mandir}/man7/man.mandoc.7.gz 200 - %preun if [ $1 -eq 0 ]; then - %{_sbindir}/update-alternatives --remove man %{_bindir}/man.mandoc - %{_sbindir}/update-alternatives --remove soelim %{_bindir}/soelim.mandoc - %{_sbindir}/update-alternatives --remove roff.7.gz %{_mandir}/man7/roff.mandoc.7.gz - %{_sbindir}/update-alternatives --remove man.7.gz %{_mandir}/man7/man.mandoc.7.gz + %{_sbindir}/update-alternatives --remove man %{_bindir}/man.%{name} >/dev/null 2>&1 || : fi +%post +# set up the alternatives files +%{_sbindir}/update-alternatives --install %{_bindir}/man man %{_bindir}/man.%{name} 300 \ + --slave %{_bindir}/apropos apropos %{_bindir}/apropos.%{name} \ + --slave %{_bindir}/whatis whatis %{_bindir}/whatis.%{name} \ + --slave %{_mandir}/man1/man.1.gz man.1.gz %{_mandir}/man1/man.%{name}.1.gz \ + --slave %{_mandir}/man1/apropos.1.gz apropos.1.gz %{_mandir}/man1/apropos.%{name}.1.gz \ + --slave %{_mandir}/man1/whatis.1.gz whatis.1.gz %{_mandir}/man1/whatis.%{name}.1.gz \ + --slave %{_mandir}/man1/soelim.1.gz soelim.1.gz %{_mandir}/man1/soelim.%{name}.1.gz \ + >/dev/null 2>&1 || : + %files %license LICENSE %{_bindir}/demandoc %{_bindir}/mandoc -%{_bindir}/apropos.mandoc %ghost %{_bindir}/apropos -%{_bindir}/man.mandoc +%{_bindir}/apropos.%{name} %ghost %{_bindir}/man -%{_bindir}/soelim.mandoc +%{_bindir}/man.%{name} %ghost %{_bindir}/soelim -%{_bindir}/whatis.mandoc +%{_bindir}/soelim.%{name} %ghost %{_bindir}/whatis -%{_sbindir}/makewhatis.mandoc -%ghost %{_sbindir}/makewhatis +%{_bindir}/whatis.%{name} +%{_sbindir}/makewhatis %{_mandir}/man1/demandoc.1.gz %{_mandir}/man1/mandoc.1.gz -%{_mandir}/man1/apropos.mandoc.1.gz -%ghost %{_mandir}/man1/apropos.1.gz -%{_mandir}/man1/man.mandoc.1.gz -%ghost %{_mandir}/man1/man.1.gz -%{_mandir}/man1/soelim.mandoc.1.gz -%ghost %{_mandir}/man1/soelim.1.gz -%{_mandir}/man1/whatis.mandoc.1.gz -%ghost %{_mandir}/man1/whatis.1.gz +%ghost %{_mandir}/man1/soelim.1* +%{_mandir}/man1/soelim.%{name}.* +%{_mandir}/man1/man.%{name}.1* +%{_mandir}/man1/apropos.%{name}.1* +%{_mandir}/man1/whatis.%{name}.1* %{_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/eqn.7.gz %{_mandir}/man7/mandoc_char.7.gz -%{_mandir}/man7/man.mandoc.7.gz -%ghost %{_mandir}/man7/man.7.gz +%{_mandir}/man7/man.7.gz %{_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 +%{_mandir}/man7/roff.7.gz +%{_mandir}/man7/tbl.7.gz +%{_mandir}/man8/makewhatis.8.gz %files -n libmandoc-devel %license LICENSE @@ -217,6 +175,18 @@ fi %{_mandir}/man3/tbl.3* %changelog +* Mon Apr 22 2024 lilong - 1.14.6-5 +- Fix low-level dependency compilation failure + +* Mon Apr 15 2024 lilong - 1.14.6-4 +- Fix crash when mandoc install + +* Mon Oct 9 2023 laokz - 1.14.6-3 +- add CFLAGS for riscv64 to workaround fragile test-strptime.c + +* Thu Apr 6 2023 changzhangm - 1.14.6-2 +- Update to 1.14.6-2 + * Fri Sep 23 2022 chendexi - 1.14.6-1 - Initial package