Add half-working PDF build using mal2latex
Lunar

Lunar commited on 2014-05-15 23:47:12
Zeige 2 geänderte Dateien mit 34 Einfügungen und 7 Löschungen.

... ...
@@ -3,6 +3,7 @@
3 3
 #*
4 4
 
5 5
 /html
6
+/pdf
6 7
 /tor-browser-version.txt
7 8
 
8 9
 /tor-browser-user-manual.pot
... ...
@@ -12,6 +13,7 @@
12 13
 /[a-z][a-z]_[A-Z][A-Z]/*.mo
13 14
 /[a-z][a-z]_[A-Z][A-Z]/*.stamp
14 15
 /[a-z][a-z]_[A-Z][A-Z]/*.page
16
+/media-symlinks.stamp
15 17
 
16 18
 /Makefile
17 19
 /Makefile.in
... ...
@@ -1,5 +1,7 @@
1 1
 @YELP_HELP_RULES@
2 2
 
3
+# XXX: turn into ./configure option
4
+MAL2LATEX = ../mal2latex
3 5
 HELP_ID = tor-browser-user-manual
4 6
 HELP_FILES = $(shell cd C && git ls-files '*.page')
5 7
 HELP_MEDIA = $(shell cd C && git ls-files 'media')
... ...
@@ -7,22 +9,44 @@ HELP_PLATFORMS = windows macosx linux
7 9
 HELP_LINGUAS = ar de es fa fr it ko nl pl pt_PT ru tr vi zh_CN
8 10
 
9 11
 .PHONY: html
10
-html: all
12
+html: all media-symlinks.stamp
11 13
 	set -e && \
12 14
 		for lc in C $(HELP_LINGUAS); do \
13
-			for media in $(HELP_MEDIA); do \
14
-				if ! [ -f $$lc/$$media ]; then \
15
-					mkdir -p $$(dirname $$lc/$$media); \
16
-					ln -nsf ../../C/$$media $$lc/$$media; \
17
-				fi; \
18
-			done; \
19 15
 			for platform in $(HELP_PLATFORMS); do \
20 16
 				mkdir -p html/$$platform/$$lc; \
21 17
 				yelp-build html -x platform-$$platform.xslt \
22 18
 						-o html/$$platform/$$lc $$lc; \
23 19
 			done; \
20
+		done
21
+
22
+.PHONY: pdf
23
+pdf: all media-symlinks.stamp
24
+	set -e && \
25
+		for lc in C $(HELP_LINGUAS); do \
26
+			for platform in $(HELP_PLATFORMS); do \
27
+				PDF_DIR=pdf/$$platform/$$lc; \
28
+				LATEX_FILE=$(HELP_ID)-$$lc.latex; \
29
+				mkdir -p $$PDF_DIR; \
30
+				yelp-build cache -o $$PDF_DIR/index.cache $$lc; \
31
+				xsltproc --xinclude \
32
+					$(MAL2LATEX)/mal2latex.xsl $$PDF_DIR/index.cache \
33
+					> $$PDF_DIR/$$LATEX_FILE; \
34
+				(cd $$PDF_DIR && lualatex $$LATEX_FILE); \
35
+			done; \
24 36
 		done;
25 37
 
38
+media-symlinks.stamp: all
39
+	set -e && \
40
+		for lc in C $(HELP_LINGUAS); do \
41
+			for media in $(HELP_MEDIA); do \
42
+				if ! [ -f $$lc/$$media ]; then \
43
+					mkdir -p $$(dirname $$lc/$$media); \
44
+					ln -nsf ../../C/$$media $$lc/$$media; \
45
+				fi; \
46
+			done; \
47
+		done
48
+	touch media-symlinks.stamp
49
+
26 50
 clean:
27 51
 	set -e && \
28 52
 		for lc in C $(HELP_LINGUAS); do \
... ...
@@ -36,3 +60,4 @@ clean:
36 60
 
37 61
 distclean-local:
38 62
 	rm -rf html
63
+	rm -rf pdf
39 64