Enable out-of-source-tree builds
Lunar

Lunar commited on 2014-05-28 09:39:36
Zeige 5 geänderte Dateien mit 20 Einfügungen und 9 Löschungen.


One can now do:

    mkdir build-tree && cd build-tree
    ../user-manual/configure --with-tor-browser-bundle=../tor-browser-bundle
    make html

Easy part was sprinkling Makefile.am with appropriate $(srcdir). Symlinks
to the media needs to be done to localized version or to C version as a
fallback.

Less funny was how to deal with <xi:include /> for the version number.
We use the `-p` option of yelp-build to specify a search path. Works great.
But there's no such option to `itstool` and it errors out if it's unable
to find `type="text"` includes (to get include them in translation strings, I
presume). So we now include the Tor Browser version in an XML file instead.

Gotcha: yelp rules uses the presence of the C directory to detect if it's
an out-of-tree build. So we must not create a C directory when building.

Let's also re-add a missing variable substitution in configure.ac.
... ...
@@ -6,6 +6,10 @@
6 6
   <title>Tor Browser User Manual</title>
7 7
   <p its:locNote="&lt;span/&gt; will be replaced by current Tor Browser version">
8 8
     Version:
9
-    <span its:translate="no"><xi:include href="../tor-browser-version.txt" parse="text"/></span>
9
+    <span its:translate="no"
10
+     ><xi:include href="tor-browser-version.xml" parse="xml" xpointer="xpointer(//text()))">
11
+        <xi:fallback>UNKNOWN</xi:fallback>
12
+      </xi:include>
13
+    </span>
10 14
   </p>
11 15
 </page>
... ...
@@ -6,8 +6,8 @@ MAL2LATEX = ../mal2latex
6 6
 TOR_AND_HTTPS = ../tor-and-https
7 7
 
8 8
 HELP_ID = tor-browser-user-manual
9
-HELP_FILES = $(shell cd C && git ls-files '*.page')
10
-HELP_MEDIA = $(shell cd C && git ls-files 'media')
9
+HELP_FILES = $(shell cd $(srcdir)/C && git ls-files '*.page')
10
+HELP_MEDIA = $(shell cd $(srcdir)/C && git ls-files 'media')
11 11
 HELP_PLATFORMS = windows macosx linux
12 12
 HELP_LINGUAS = @TOR_BROWSER_BUNDLE_LOCALES@
13 13
 
... ...
@@ -17,7 +17,8 @@ html: all media-symlinks.stamp
17 17
 		for lc in C $(HELP_LINGUAS); do \
18 18
 			for platform in $(HELP_PLATFORMS); do \
19 19
 				mkdir -p html/$$platform/$$lc; \
20
-				yelp-build html -x platform-$$platform.xslt \
20
+				yelp-build html -p include \
21
+						-x $(srcdir)/platform-$$platform.xslt \
21 22
 						-o html/$$platform/$$lc $$lc; \
22 23
 			done; \
23 24
 		done
... ...
@@ -38,13 +39,17 @@ pdf: all media-symlinks.stamp
38 39
 			done; \
39 40
 		done;
40 41
 
41
-media-symlinks.stamp: all
42
+media-symlinks.stamp:
42 43
 	set -e && \
43
-		for lc in C $(HELP_LINGUAS); do \
44
+		for lc in $(HELP_LINGUAS); do \
44 45
 			for media in $(HELP_MEDIA); do \
45 46
 				if ! [ -f $$lc/$$media ]; then \
46 47
 					mkdir -p $$(dirname $$lc/$$media); \
47
-					ln -nsf ../../C/$$media $$lc/$$media; \
48
+					if [ -f $(srcdir)/$$lc/$$media ]; then \
49
+						ln -nsf $(abs_srcdir)/$$lc/$$media $$lc/$$media; \
50
+					else \
51
+						ln -nsf $(abs_srcdir)/C/$$media $$lc/$$media; \
52
+					fi; \
48 53
 				fi; \
49 54
 			done; \
50 55
 		done
... ...
@@ -19,11 +19,12 @@ if test "x$TOR_BROWSER_VERSION" = "x"; then
19 19
 fi
20 20
 TOR_BROWSER_BUNDLE_LOCALES=$(. "$VERSIONS_PATH"; echo "$BUNDLE_LOCALES")
21 21
 
22
+AC_SUBST(TOR_BROWSER_VERSION)
22 23
 AC_SUBST(TOR_BROWSER_BUNDLE_LOCALES)
23 24
 
24 25
 YELP_HELP_INIT
25 26
 
26 27
 AC_CONFIG_FILES([Makefile
27
-                 tor-browser-version.txt])
28
+                 include/tor-browser-version.xml])
28 29
 
29 30
 AC_OUTPUT
... ...
@@ -0,0 +1,2 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<sys>@TOR_BROWSER_VERSION@</sys>
... ...
@@ -1 +0,0 @@
1
-@TOR_BROWSER_VERSION@
2 0