Xiyue Deng wrote:
> Recently I am attempting to enable shipping docs of the racket-mode
> package[1].  However, its info page contains links to image files
> (e.g. [2]) using the image syntax[3].

I encountered the same problem for fisicalab.app [1] and solved it
this way in debian/rules (I'm not sure if it would be useful for you):

# Rule to build the documentation because the upstream build system
# doesn't have one.  Several things to note:
# 1. All images are installed along with the HTML documentation in
#    order not to clutter infodir and to avoid duplicate files.
# 2. For producing Info files with images, texi2any needs to find the
#    real image.  Because /usr/share/doc/fisicalab.app-doc-*/html
#    does not exist at build time, the images are copied in a relative
#    directory and the .texinfo files are patched accordingly.  Then the
#    .info files are patched to add the leading slash.
# 3. The Texinfo manual recommends to install images for Info files in
#    infodir/PACKAGE-figures but Emacs cannot load them from there.
#    Furthermore, the filenames are the same for English/Spanish but
#    with different content.
# 4. Lintian emits file-references-package-build-path for the PDF
#    files which probably means that the build is not reproducible.
#    There doesn't seem to be a way to remove the PTEX.FileName:
#    neither by passing the appropriate --Xopt nor by patching the
#    .texinfo files.  Postprocessing the PDF files with various tools
#    also doesn't have any effect.
define doc-rule
srcdir=Documentation/Manual/$(2); \
  mkdir --parents build-$(1)/usr/share/doc/fisicalab.app-doc-$(1)/html \
  && cp $${srcdir}/* build-$(1) \
  && cp build-$(1)/*.{jpg,png} \
    build-$(1)/usr/share/doc/fisicalab.app-doc-$(1)/html \
  && sed --in-place \
    's/@image{/@image{usr\/share\/doc\/fisicalab.app-doc-$(1)\/html\//g' \
    build-$(1)/*.texinfo \
  && texi2any --output=build-$(1) build-$(1)/fisicalab.texinfo \
  && sed --in-place 's/usr\/share/\/usr\/share/g' build-$(1)/*.info* \
  && mkdir build-$(1)/html \
  && cp $${srcdir}/*.{jpg,png} build-$(1)/html \
  && texi2any --output=build-$(1)/html --html $${srcdir}/fisicalab.texinfo \
  && texi2any --output=build-$(1)/fisicalab.pdf --pdf --Xopt=--clean \
    $${srcdir}/fisicalab.texinfo
endef

# Build documentation, supporting the "nodoc" profile.
execute_after_dh_auto_build-indep:
ifdef docs
        $(call doc-rule,en,English)
        $(call doc-rule,es,Spanish)
endif

[1] Should appear soon at https://tracker.debian.org/pkg/fisicalab.app

Reply via email to