[Fedora-packaging] %doc doesn't seem to use _defaultdocdir definition

Michael Schwendt mschwendt at gmail.com
Fri Apr 3 10:05:41 UTC 2015


On Fri, 03 Apr 2015 11:21:47 +0300, Daniel Letai wrote:

> Hi List,
> I'm a newb at writing spec files, please bear with me.
> 
> I'm rebuilding a package for RHEL 6, so if this is the wrong list, 
> please let me know.
> 
> I have redefined the prefix stack:
> %global _prefix         /opt/%{name}/%{version}
> %global _exec_prefix    %{_prefix}
> %global _bindir         %{_exec_prefix}/bin
> %global _sbindir        %{_exec_prefix}/sbin
> %global _libexecdir     %{_exec_prefix}/libexec
> %global _sysconfdir     /etc
> %global _sharedstatedir /var/lib
> %global _localstatedir  /var
> %global _libdir         %{_exec_prefix}/%{_lib}
> %global _includedir     %{_prefix}/include
> %global _datarootdir    %{_prefix}/share
> %global _datadir        %{_datarootdir}
> %global _infodir        %{_datarootdir}/info
> %global _localedir      %{_datarootdir}/locale
> %global _mandir         %{_datarootdir}/man
> %global _docdir         %{_datarootdir}/doc
> %global _htmldir        %{_docdir}
> %global _dvidir         %{_docdir}
> %global _pdfdir         %{_docdir}
> %global _psdir          %{_docdir}
> %global _defaultdocdir  %{_docdir}
> 
> In configure:
>          ../configure \
>          --prefix=%{_prefix} \
>          --exec-prefix=%{_exec_prefix} \
>          --bindir=%{_bindir} \
>          --sbindir=%{_sbindir} \
>          --sysconfdir=%{_sysconfdir} \
>          --datadir=%{_datadir} \
>          --includedir=%{_includedir} \
>          --libdir=%{_libdir} \
>          --libexecdir=%{_libexecdir} \
>          --localstatedir=%{_localstatedir} \
>          --sharedstatedir=%{_sharedstatedir} \
>          --mandir=%{_mandir} \
>          --infodir=%{_infodir} \
>          --docdir=%{_docdir} \
>          ...
> 
> In make install:
> make DESTDIR=%{buildroot} \
>          prefix=%{_prefix} \
>          mandir=%{_mandir} \
>          infodir=%{_infodir} \
>          docdir=%{_docdir} \
>          install
> 
> The package completes without errors, resulting in RPMs, but In the 
> output I see multiple instances of:
> + DOCDIR=~/rpmbuild/BUILDROOT/<rpm top buildroot 
> dir>/usr/share/doc/%{name}-%{version}
> + export DOCDIR
> 
> and when installing the RPMs they install docs to /usr/share/doc.
> 
> when building and installing manually all is well (share/doc under /opt/...)
> What am I doing wrong?

First, please clarify: The two steps you mention, the "configure" step
and "make install", are completely unrelated to %doc. Do you refer to
documentation files installed by "make install …" or to using the %doc
macro to copy local files to the package's documentation directory?
It should be a simple exercise to create a minimal spec file that
includes a single %doc line in its %files section to experiment with
redefined RPM macros (not limited to "rpmbuild -bb --define "_prefix /opt"
test.spec).


More information about the packaging mailing list