Here is an improved and tested patch to create epub versions of the
documentation and put it in the language packages.  Something to include
in the default build?

-- 
Happy hacking
Petter Reinholdtsen
diff --git a/Makefile b/Makefile
index 07360dd..48e2fdd 100644
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ update-copyright:
 		> debian/copyright
 	rm documentation/*/copyright.manual
 
-readme status build install dist-clean clean pdf::
+readme status build install dist-clean clean pdf epub::
 	$(MAKE) -C $(SRCDIR)/debian-edu-squeeze $@
 	$(MAKE) -C $(SRCDIR)/debian-edu-wheezy $@
 	$(MAKE) -C $(SRCDIR)/rosegarden $@
diff --git a/debian/control b/debian/control
index c958665..dcac5d1 100644
--- a/debian/control
+++ b/debian/control
@@ -8,6 +8,7 @@ Build-Depends-Indep: docbook-utils, poxml, ldp-docbook-xsl, dblatex, po4a,
  texlive-lang-cyrillic, texlive-lang-danish,  texlive-lang-spanish,
  texlive-lang-french, texlive-lang-german, texlive-lang-italian,
  texlive-lang-norwegian, texlive-lang-dutch, imagemagick
+ , dbtoepub
 Maintainer: Debian Edu Developers <[email protected]>
 Uploaders: Holger Levsen <[email protected]>, 
  David Prévot <[email protected]>
diff --git a/documentation/common/Makefile.common b/documentation/common/Makefile.common
index 99d6ff2..8c44e03 100644
--- a/documentation/common/Makefile.common
+++ b/documentation/common/Makefile.common
@@ -5,6 +5,7 @@ DESTDIR=
 DESTPATH = /usr/share/doc
 LANGUAGES = `find . -name "$(name).*.po" | sed -e "s/.\/$(name).//" -e "s/.po//"`
 # Program name and option
+DBTOEPUB = dbtoepub
 XP = xsltproc --nonet --novalid --xinclude ../common/html.xsl
 DBLATEX = dblatex -T db2latex --backend=xetex --xsl-user=../common/user_param.xsl --xsl-user=../common/xetex_param.xsl -p ../common/pdf.xsl
 # that's ugly, smarter approach appreciated
@@ -30,8 +31,10 @@ status:
 	done
 	@cat fixme-status.txt
 
+build: build-html build-epub
+
 ifndef LINGUA
-build:
+build-html:
 	# create localized XML files
 	po4a --msgmerge-opt --no-location po4a.cfg
 	msgcat --no-location -o $(name).pot $(name).pot
@@ -42,11 +45,18 @@ build:
 	sed -i "s/href=\"index.html/href=\"$(name).en.html/g" $(name).en.html
 	# build the other HTML versions
 	-for f in $(LANGUAGES) ; do \
+		echo "Creating HTML for $$f"; \
 		$(XP) $(name).$$f.xml && mv index.html $(name).$$f.html ; \
 		sed -i "s/href=\"index.html/href=\"$(name).$$f.html/g" $(name).$$f.html ; \
 	done
+build-epub:
+	-for LINGUA in $(LANGUAGES) ; do \
+		echo "Creating epub for $$LINGUA"; \
+		po4a --translate-only $(name).$$LINGUA.xml po4a.cfg ; \
+		$(DBTOEPUB) $(name).$$LINGUA.xml ; \
+	done
 else
-build:
+build-html:
 	# create the localized XML file
 	po4a --translate-only $(name).$(LINGUA).xml po4a.cfg
 	# rewrap the PO file just to be sure
@@ -55,6 +65,7 @@ build:
 	$(XP) $(name).$(LINGUA).xml && mv index.html $(name).$(LINGUA).html
 	# restore internal links
 	sed -i "s/href=\"index.html/href=\"$(name).$(LINGUA).html/g" $(name).$(LINGUA).html
+build-epub: epub
 endif
 
 ifndef LINGUA
@@ -66,6 +77,15 @@ pdf:
 	$(DBLATEX) $(name).$(LINGUA).xml --param=lingua=$(LINGUA)
 endif
 
+ifndef LINGUA
+epub:
+	$(DBTOEPUB) $(name).xml
+else
+epub:
+	po4a --translate-only $(name).$(LINGUA).xml po4a.cfg
+	$(DBTOEPUB) $(name).$(LINGUA).xml
+endif
+
 install: build
 	# en needs to be first
 	for f in en $(LANGUAGES) ; do \
@@ -102,6 +122,9 @@ install: build
 			  rm $$LANGPATH/images/*.pdf ; \
 			fi ; \
 		fi ; \
+		if [ -e $(name).$$f.epub ] ; then \
+			cp $(name).$$f.epub $$LANGPATH/$(name).epub ; \
+		fi ; \
 	done 		
 	rm $(DESTDIR)/debian-edu-doc-en/$(DESTPATH)/debian-edu-doc-en/images/*.pdf ; \
 
@@ -112,3 +135,5 @@ clean:
 	rm -f *.po~
 
 dist-clean:	clean
+	rm -f *.epub
+	rm -f *.pdf

Reply via email to