Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 15a04d4e authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Jonathan Corbet
Browse files

docs-rst: auto-generate PDF image files



The PDF files that contain media images were actually generated
offline from their SVG or PNG source files.

Sphinx can handle PNG sources automatially. So, let's just
drop their PDF counterparts.

For SVG, however, Sphinx doesn't produce the right tags to
use the TexLive SVG support. Also, the SVG support is done via
shell execution, with is not nice.

So, while we don't have any support for SVG inside Sphinx
core or as an extension, move the logic to build them to Makefile,
producing the PDF images on runtime.

NOTE: due to the way Sphinx works, the PDF images should be
generated inside the Kernel source tree, as otherwise Sphinx
won't find it, not obeying what's specified by "O=" makefile
parameter.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent f3902934
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ loop_cmd = $(echo-cmd) $(cmd_$(1))
#    e.g. "media" for the linux-tv book-set at ./Documentation/media

quiet_cmd_sphinx = SPHINX  $@ --> file://$(abspath $(BUILDDIR)/$3/$4)
      cmd_sphinx = $(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/media all;\
      cmd_sphinx = $(MAKE) BUILDDIR=$(abspath $(BUILDDIR)) $(build)=Documentation/media $2;\
	BUILDDIR=$(abspath $(BUILDDIR)) SPHINX_CONF=$(abspath $(srctree)/$(src)/$5/$(SPHINX_CONF)) \
	$(SPHINXBUILD) \
	-b $2 \
@@ -98,6 +98,7 @@ installmandocs:

cleandocs:
	$(Q)rm -rf $(BUILDDIR)
	$(Q)$(MAKE) -C Documentation/media clean

endif # HAVE_SPHINX

+1 −0
Original line number Diff line number Diff line
*.pdf
+28 −1
Original line number Diff line number Diff line
@@ -10,8 +10,35 @@ FILES = audio.h.rst ca.h.rst dmx.h.rst frontend.h.rst net.h.rst video.h.rst \

TARGETS := $(addprefix $(BUILDDIR)/, $(FILES))

.PHONY: all
IMAGES = \
	typical_media_device.svg \
	uapi/dvb/dvbstb.svg \
	uapi/v4l/constraints.svg \
	uapi/v4l/subdev-image-processing-full.svg \
	uapi/v4l/subdev-image-processing-scaling-multi-source.svg \
	uapi/v4l/subdev-image-processing-crop.svg \

IMGTGT := $(patsubst %.png,%.pdf,$(patsubst %.svg,%.pdf,$(IMAGES)))
IMGPDF := $(patsubst %,$(SRC_DIR)/%,$(IMGTGT))

cmd = $(echo-cmd) $(cmd_$(1))

quiet_cmd_genpdf = GENPDF  $2
      cmd_genpdf = convert $2 $3

%.pdf: %.svg
	@$(call cmd,genpdf,$<,$@)

.PHONY: all html epub xml latex

all: $(BUILDDIR) ${TARGETS}
html: all
epub: all
xml: all
latex: $(IMGPDF) all

clean:
	-rm $(IMGTGT) 2>/dev/null

$(BUILDDIR):
	$(Q)mkdir -p $@
+2 −2
Original line number Diff line number Diff line
@@ -13,8 +13,8 @@ A typical media device hardware is shown at :ref:`typical_media_device`.

.. _typical_media_device:

.. figure::  media_api_files/typical_media_device.*
    :alt:    typical_media_device.svg
.. figure::  typical_media_device.*
    :alt:    typical_media_device.pdf / typical_media_device.svg
    :align:  center

    Typical Media Device
−51.7 KiB

File deleted.

Loading