Blob Blame Raw
Name:           mandoc
Version:        1.14.4
Release:        1%{?dist}
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:         mandoc-shared-library.patch

# Separate the commands for installing libraries and headers
Patch1:         mandoc-install-hdr.patch

BuildRequires:  gcc
BuildRequires:  make
BuildRequires:  zlib-devel

# requirements for %%check
BuildRequires:  perl(IPC::Open3)

Requires:       libmandoc%{?_isa} = %{version}-%{release}

%description
mandoc is a suite of tools compiling mdoc, the roff macro language of choice
for BSD manual pages, and man, the predominant historical language for UNIX
manuals. It is small, ISO C, ISC-licensed, and quite fast. The main component
of the toolset is the mandoc utility program, based on the libmandoc validating
compiler, to format output for UTF-8 and ASCII UNIX terminals, HTML 5,
PostScript, and PDF.

%package -n libmandoc
Summary:        A validating compiler for mdoc and man

%description -n libmandoc
The mandoc library parses a UNIX manual into an abstract syntax tree (AST).
UNIX manuals are composed of mdoc(7) or man(7), and may be mixed with roff(7),
tbl(7), and eqn(7) invocations.

%package -n libmandoc-devel
Summary:        Development libraries and headers for libmandoc
Requires:       libmandoc%{?_isa} = %{version}-%{release}

%description -n libmandoc-devel
The mandoc library parses a UNIX manual into an abstract syntax tree (AST).
UNIX manuals are composed of mdoc(7) or man(7), and may be mixed with roff(7),
tbl(7), and eqn(7) invocations.

%prep
%autosetup -p1

%build
# NB: not an autoconf script
# settings are read in through configure.local
echo 'PREFIX=%{_prefix}'   >  configure.local
echo 'BINDIR=%{_bindir}'   >> configure.local
echo 'SBINDIR=%{_sbindir}' >> configure.local
echo 'MANDIR=%{_mandir}'   >> configure.local
echo 'INCLUDEDIR=%{_includedir}' >> configure.local
echo 'LIBDIR=%{_libdir}'   >> configure.local

# with default settings rpmlint complains about cross-directory hardlinks
echo 'LN="ln -sf"' >> configure.local

# change the names of binaries, conf files, and section 7 man pages
# to avoid conflicts with man-db and groff
echo 'MANM_MANCONF=mandoc.conf' >> configure.local
echo 'MANM_MAN=mandoc_man'      >> configure.local
echo 'BINM_MAN=mman'            >> configure.local
echo 'BINM_APROPOS=mapropos'    >> configure.local
echo 'BINM_WHATIS=mwhatis'      >> configure.local
echo 'BINM_MAKEWHATIS=mandocdb' >> configure.local
echo 'BINM_SOELIM=msoelim'      >> configure.local

# override the install permissions so that owner-write bits are set,
# so rpmbuild can do whatever modifications it does post-%%install
echo 'INSTALL_PROGRAM="${INSTALL} -m 0755"' >> configure.local
echo 'INSTALL_LIB="${INSTALL} -m 0755"'     >> configure.local
echo 'INSTALL_HDR="${INSTALL} -m 0644"'     >> configure.local
echo 'INSTALL_MAN="${INSTALL} -m 0644"'     >> configure.local
echo 'INSTALL_DATA="${INSTALL} -m 0644"'    >> configure.local

echo 'INSTALL_LIBMANDOC=1' >> configure.local

echo 'CFLAGS="%{optflags}"' >> configure.local
./configure
make %{?_smp_mflags}

%install
%make_install

%check
env LD_LIBRARY_PATH="$PWD" make regress

%ldconfig_scriptlets -n libmandoc

%files
%license LICENSE
%{_bindir}/demandoc
%{_bindir}/mandoc
%{_bindir}/mapropos
%{_bindir}/mman
%{_bindir}/msoelim
%{_bindir}/mwhatis
%{_sbindir}/mandocdb
%{_mandir}/man1/demandoc.1*
%{_mandir}/man1/mandoc.1*
%{_mandir}/man1/mapropos.1*
%{_mandir}/man1/mman.1*
%{_mandir}/man1/msoelim.1*
%{_mandir}/man1/mwhatis.1*
%{_mandir}/man5/mandoc.conf.5*
%{_mandir}/man5/mandoc.db.5*
%{_mandir}/man7/eqn.7*
%{_mandir}/man7/mandoc_char.7*
%{_mandir}/man7/mandoc_man.7*
%{_mandir}/man7/mdoc.7*
%{_mandir}/man7/roff.7*
%{_mandir}/man7/tbl.7*
%{_mandir}/man8/mandocdb.8*

%files -n libmandoc
%license LICENSE
%{_libdir}/libmandoc.so.1.0
%{_libdir}/libmandoc.so.1

%files -n libmandoc-devel
%license LICENSE
%{_libdir}/libmandoc.so
%{_includedir}/man.h
%{_includedir}/mandoc.h
%{_includedir}/mandoc_aux.h
%{_includedir}/mdoc.h
%{_includedir}/roff.h
%{_mandir}/man3/mandoc.3*
%{_mandir}/man3/mandoc_escape.3*
%{_mandir}/man3/mandoc_malloc.3*
%{_mandir}/man3/mansearch.3*
%{_mandir}/man3/mchars_alloc.3*
%{_mandir}/man3/tbl.3*

%changelog
* Thu Feb  7 2019 David Shea <dshea@redhat.com> - 1.14.4-1
- Initial package