Patchwork [v3] doc-epub rule updates

login
register
mail settings
Submitter Benjamin Kosnik
Date Jan. 17, 2012, 11:41 p.m.
Message ID <20120117154159.0563f2cc@shotwell>
Download mbox | patch
Permalink /patch/136543/
State New
Headers show

Comments

Benjamin Kosnik - Jan. 17, 2012, 11:41 p.m.
This updates the support for generating epub docs to EPUB3. Using the
EPUB3 stylesheets allows the removal of ruby and other tool checks from
configure, and generates a much better documentation file. 

tested x86/linux

-benjamin

Patch

2012-01-17  Benjamin Kosnik  <bkoz@redhat.com>

	    * configure.ac (BUILD_EPUB): Adjust for epub3.
	    * configure: Regenerate.
	    * Makefile.in: Same.
	    * doc/Makefile.am (stamp-epub-docbook): Update for epub3.
	    * doc/Makefile.in: Regenerate.
	    * include/Makefile.in: Same.
	    * libsupc++/Makefile.in: Same.
	    * po/Makefile.in: Same.
	    * python/Makefile.in: Same.
	    * src/Makefile.in: Same.
	    * testsuite/Makefile.in: Same.

	    * doc/xml/manual/documentation_hacking.xml: Update.

diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index d453f63..1c62aea 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -373,18 +373,21 @@  AM_CONDITIONAL(BUILD_MAN,
 	       test $ac_cv_prog_DOXYGEN = "yes" &&
 	       test $ac_cv_prog_DOT = "yes")
 
-# Check for pdf/epub dependencies.
+# Check for pdf dependencies.
 AC_CHECK_PROG([DBLATEX], dblatex, yes, no)
 AC_CHECK_PROG([PDFLATEX], pdflatex, yes, no)
 AM_CONDITIONAL(BUILD_PDF,
 	       test $ac_cv_prog_DBLATEX = "yes" &&
 	       test $ac_cv_prog_PDFLATEX = "yes")
 
-AC_CHECK_PROG([RUBY], ruby, yes, no)
-AC_CHECK_PROG([DBTOEPUB], dbtoepub, yes, no)
+# Check for epub dependencies.
+AC_CHECK_FILE(/usr/share/xml/docbook/stylesheet/docbook-xsl-ns/epub3/chunk.xsl,
+	      ac_cv_file_epub3_a=yes, ac_cv_file_epub3_a=no)
+AC_CHECK_FILE(/usr/share/sgml/docbook/xsl-ns-stylesheets/epub3/chunk.xsl,
+	      ac_cv_file_epub3_b=yes, ac_cv_file_epub3_b=no)
 AM_CONDITIONAL(BUILD_EPUB,
-	       test $ac_cv_prog_RUBY = "yes" &&
-	       test $ac_cv_prog_DBTOEPUB = "yes")
+	       test $ac_cv_file_epub3_a = "yes" ||
+	       test $ac_cv_file_epub3_b = "yes")
 
 
 # Propagate the target-specific source directories through the build chain.
diff --git a/libstdc++-v3/doc/Makefile.am b/libstdc++-v3/doc/Makefile.am
index 3cb6dce..0f7b285 100644
--- a/libstdc++-v3/doc/Makefile.am
+++ b/libstdc++-v3/doc/Makefile.am
@@ -467,10 +467,11 @@  XSLT_PARAM = --param toc.section.depth 4
 XSL_FO_STYLE = $(XSL_STYLE_DIR)/fo/docbook.xsl
 XSL_HTML_STYLE = $(XSL_STYLE_DIR)/xhtml-1_1/chunk.xsl
 XSL_HTML_SINGLE_STYLE = $(XSL_STYLE_DIR)/xhtml-1_1/docbook.xsl
-XSL_EPUB_STYLE = $(XSL_STYLE_DIR)/epub/docbook.xsl
+XSL_EPUB_STYLE = $(XSL_STYLE_DIR)/epub3/chunk.xsl
 
 ${docbook_outdir}/epub:
 	mkdir -p ${docbook_outdir}/epub
+	mkdir -p ${docbook_outdir}/epub/OEBPS/images
 
 ${docbook_outdir}/fo:
 	mkdir -p ${docbook_outdir}/fo
@@ -592,20 +593,25 @@  doc-texinfo-docbook: stamp-texinfo-docbook
 
 doc-info-docbook: stamp-info-docbook
 
-# EPUB, via ruby + dbtoepub
-# Can verify document with: epubcheck
+# EPUB version 3
+# http://sourceforge.net/projects/docbook/files/epub3/
+# Can verify document with epubcheck
 manual_epub = ${docbook_outdir}/epub/libstdc++-manual.epub
 stamp-epub-docbook: stamp-xml-single-docbook ${docbook_outdir}/epub
 	@echo "Generating epub files..."
 	if [ ! -d "${docbook_outdir}/images" ]; then \
 	  $(LN_S) ${top_srcdir}/doc/xml/images ${docbook_outdir}/; \
 	fi
-	${XSL_STYLE_DIR}/epub/bin/dbtoepub -v -d -o ${manual_epub} ${set_xml}
+	$(XSLTPROC) $(XSLT_PARAM) $(XSLT_FLAGS) \
+	--stringparam base.dir "${docbook_outdir}/epub/OEBPS/" \
+	$(XSL_EPUB_STYLE) ${top_srcdir}/doc/xml/spine.xml
+	$(INSTALL_DATA)	$(xml_images) ${docbook_outdir}/epub/OEBPS/images
+	zip -X0 ${manual_epub} ${docbook_outdir}/epub/mimetype
+	zip -r -X9 ${manual_epub} ${docbook_outdir}/epub/META-INF ${docbook_outdir}/epub/OEBPS
 	$(STAMP) stamp-epub-docbook
 
 doc-epub-docbook: stamp-epub-docbook
 
-
 # Performance doc and graph configuration.
 # Assumes pychart, beautiful soup installed.
 # Generates the plots/graph imagery for performance testing.
diff --git a/libstdc++-v3/doc/xml/manual/documentation_hacking.xml b/libstdc++-v3/doc/xml/manual/documentation_hacking.xml
index f6d7d55..2fe7692 100644
--- a/libstdc++-v3/doc/xml/manual/documentation_hacking.xml
+++ b/libstdc++-v3/doc/xml/manual/documentation_hacking.xml
@@ -611,6 +611,12 @@ 
       <entry>info output</entry>
     </row>
 
+    <row>
+      <entry>epub3 stylesheets</entry>
+      <entry>b3</entry>
+      <entry>epub output</entry>
+    </row>
+
   </tbody>
 </tgroup>
 </table>
@@ -675,6 +681,10 @@ 
 	For Texinfo output, something that transforms valid Docbook
 	XML to Texinfo is required. The default choice is <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://docbook2x.sourceforge.net/">docbook2X</link>.
       </para>
+
+      <para>
+	For epub output, the <link xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:href="http://sourceforge.net/projects/docbook/files/epub3/">stylesheets</link> for EPUB3 are required. These stylesheets are still in development. To validate the created file, <link xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:href="https://code.google.com/p/epubcheck/">epubcheck</link> is necessary.
+      </para>
     </section>
 
     <section xml:id="docbook.rules"><info><title>Generating the DocBook Files</title></info>