[svnbook] r4270 committed - Fix some issues with the epub build, and add rules for generating...

svnbook at googlecode.com svnbook at googlecode.com
Thu May 31 16:25:07 CDT 2012


Revision: 4270
Author:   cmpilato at gmail.com
Date:     Thu May 31 14:24:43 2012
Log:      Fix some issues with the epub build, and add rules for generating
MOBI-formatted files (complete with a generic book cover!).

* en/book
   (svn:ignore): Add 'svn-book.mobi' to the ignores list.

* en/book/images/ebook-cover.jpg
   New.

* tools/Makefile.base-rules
   (epub): Move UNIFIED_XML_TARGET dependency ...
   (EPUB_TARGET): ... into here.  Also, fix some whitespace goofs.
   (mobi, MOBI_TARGET): New rules.
   (clean): Also remove MOBI_TARGET.

* tools/Makefile.base-vars
   (MOBI_TARGET): New.

http://code.google.com/p/svnbook/source/detail?r=4270

Added:
  /trunk/en/book/images/ebook-cover.jpg
Modified:
  /trunk/en/book
  /trunk/tools/Makefile.base-rules
  /trunk/tools/Makefile.base-vars

=======================================
--- /dev/null	
+++ /trunk/en/book/images/ebook-cover.jpg	Thu May 31 14:24:43 2012
Binary file, no diff available.
=======================================
--- /trunk/tools/Makefile.base-rules	Thu May 31 13:21:35 2012
+++ /trunk/tools/Makefile.base-rules	Thu May 31 14:24:43 2012
@@ -73,15 +73,25 @@
  	$(TOOLS_DIR)/bin/run-fop.sh -fo $(FO_TARGET) -ps $(PS_TARGET)

  # Requires at least docbook-xsl-1.74
-epub: $(UNIFIED_XML_TARGET) $(EPUB_TARGET)
-$(EPUB_TARGET): $(ALL_SOURCE)
+epub: $(EPUB_TARGET)
+$(EPUB_TARGET): $(UNIFIED_XML_TARGET) $(ALL_SOURCE)
  	$(ENSURE_XSL)
  	if [ -x /usr/bin/dbtoepub ] ; then \
-	  /usr/bin/dbtoepub -v -o $(EPUB_TARGET) $(UNIFIED_XML_TARGET) ;\
+	  /usr/bin/dbtoepub -v -o $(EPUB_TARGET) $(UNIFIED_XML_TARGET) ; \
  	else \
-	  $(TOOLS_DIR)/xsl/epub/bin/dbtoepub -v -o  
$(EPUB_TARGET)$(UNIFIED_XML_TARGET) ; \
+	  $(TOOLS_DIR)/xsl/epub/bin/dbtoepub -v -o $(EPUB_TARGET)  
$(UNIFIED_XML_TARGET) ; \
  	fi

+mobi: $(MOBI_TARGET)
+$(MOBI_TARGET): $(EPUB_TARGET)
+	if [ -x /usr/bin/ebook-convert ] ; then \
+	  /usr/bin/ebook-convert $(EPUB_TARGET) $(MOBI_TARGET) \
+            --dont-justify --cover book/images/ebook-cover.jpg -v ; \
+	else \
+	  $(TOOLS_DIR)/xsl/epub/bin/ebook-convert $(EPUB_TARGET) $(MOBI_TARGET) \
+            --dont-justify --cover book/images/ebook-cover.jpg -v ; \
+	fi
+
  $(UNIFIED_XML_TARGET): version
  	$(XMLLINT) --nonet --noent --xinclude --postvalid --output  
$(UNIFIED_XML_TARGET) book/book.xml

@@ -117,7 +127,7 @@
  clean:
  	rm -f $(VERSION_SOURCE) $(HTML_TARGET) $(UNIFIED_XML_TARGET)
  	rm -f $(HTML_ARCH_TARGET) $(HTML_CHUNK_ARCH_TARGET)
-	rm -f $(FO_TARGET) $(PDF_TARGET) $(PS_TARGET) $(EPUB_TARGET)
+	rm -f $(FO_TARGET) $(PDF_TARGET) $(PS_TARGET) $(EPUB_TARGET)  
$(MOBI_TARGET)
  	rm -rf $(HTML_CHUNK_DIR)

  # Utility targets
=======================================
--- /trunk/tools/Makefile.base-vars	Thu May 31 13:18:37 2012
+++ /trunk/tools/Makefile.base-vars	Thu May 31 14:24:43 2012
@@ -54,6 +54,7 @@
  PS_TARGET = $(DIR)/$(OUTNAME).ps
  FO_TARGET = $(DIR)/$(OUTNAME).fo
  EPUB_TARGET = $(DIR)/$(OUTNAME).epub
+MOBI_TARGET = $(DIR)/$(OUTNAME).mobi
  UNIFIED_XML_TARGET = $(DIR)/$(OUTNAME).xml
  XML_SOURCE = $(DIR)/$(NAME).xml
  VERSION_SOURCE = $(DIR)/version.xml




More information about the svnbook-dev mailing list