[tor-commits] [user-manual/master] Enable out-of-source-tree builds

lunar at torproject.org lunar at torproject.org
Wed May 28 07:39:47 UTC 2014


commit 44a3777eb38d94319871ba97b25af8b8aa60e50e
Author: Lunar <lunar at torproject.org>
Date:   Wed May 28 09:22:25 2014 +0200

    Enable out-of-source-tree builds
    
    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.
---
 C/index.page                       |    6 +++++-
 Makefile.am                        |   17 +++++++++++------
 configure.ac                       |    3 ++-
 include/tor-browser-version.xml.in |    2 ++
 tor-browser-version.txt.in         |    1 -
 5 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/C/index.page b/C/index.page
index 764fcde..191839f 100644
--- a/C/index.page
+++ b/C/index.page
@@ -6,6 +6,10 @@
   <title>Tor Browser User Manual</title>
   <p its:locNote="<span/> will be replaced by current Tor Browser version">
     Version:
-    <span its:translate="no"><xi:include href="../tor-browser-version.txt" parse="text"/></span>
+    <span its:translate="no"
+     ><xi:include href="tor-browser-version.xml" parse="xml" xpointer="xpointer(//text()))">
+        <xi:fallback>UNKNOWN</xi:fallback>
+      </xi:include>
+    </span>
   </p>
 </page>
diff --git a/Makefile.am b/Makefile.am
index a0dfb8d..672ae9e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,8 +6,8 @@ MAL2LATEX = ../mal2latex
 TOR_AND_HTTPS = ../tor-and-https
 
 HELP_ID = tor-browser-user-manual
-HELP_FILES = $(shell cd C && git ls-files '*.page')
-HELP_MEDIA = $(shell cd C && git ls-files 'media')
+HELP_FILES = $(shell cd $(srcdir)/C && git ls-files '*.page')
+HELP_MEDIA = $(shell cd $(srcdir)/C && git ls-files 'media')
 HELP_PLATFORMS = windows macosx linux
 HELP_LINGUAS = @TOR_BROWSER_BUNDLE_LOCALES@
 
@@ -17,7 +17,8 @@ html: all media-symlinks.stamp
 		for lc in C $(HELP_LINGUAS); do \
 			for platform in $(HELP_PLATFORMS); do \
 				mkdir -p html/$$platform/$$lc; \
-				yelp-build html -x platform-$$platform.xslt \
+				yelp-build html -p include \
+						-x $(srcdir)/platform-$$platform.xslt \
 						-o html/$$platform/$$lc $$lc; \
 			done; \
 		done
@@ -38,13 +39,17 @@ pdf: all media-symlinks.stamp
 			done; \
 		done;
 
-media-symlinks.stamp: all
+media-symlinks.stamp:
 	set -e && \
-		for lc in C $(HELP_LINGUAS); do \
+		for lc in $(HELP_LINGUAS); do \
 			for media in $(HELP_MEDIA); do \
 				if ! [ -f $$lc/$$media ]; then \
 					mkdir -p $$(dirname $$lc/$$media); \
-					ln -nsf ../../C/$$media $$lc/$$media; \
+					if [ -f $(srcdir)/$$lc/$$media ]; then \
+						ln -nsf $(abs_srcdir)/$$lc/$$media $$lc/$$media; \
+					else \
+						ln -nsf $(abs_srcdir)/C/$$media $$lc/$$media; \
+					fi; \
 				fi; \
 			done; \
 		done
diff --git a/configure.ac b/configure.ac
index ed8bbcf..a1b12f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,11 +19,12 @@ if test "x$TOR_BROWSER_VERSION" = "x"; then
 fi
 TOR_BROWSER_BUNDLE_LOCALES=$(. "$VERSIONS_PATH"; echo "$BUNDLE_LOCALES")
 
+AC_SUBST(TOR_BROWSER_VERSION)
 AC_SUBST(TOR_BROWSER_BUNDLE_LOCALES)
 
 YELP_HELP_INIT
 
 AC_CONFIG_FILES([Makefile
-                 tor-browser-version.txt])
+                 include/tor-browser-version.xml])
 
 AC_OUTPUT
diff --git a/include/tor-browser-version.xml.in b/include/tor-browser-version.xml.in
new file mode 100644
index 0000000..8cf6628
--- /dev/null
+++ b/include/tor-browser-version.xml.in
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sys>@TOR_BROWSER_VERSION@</sys>
diff --git a/tor-browser-version.txt.in b/tor-browser-version.txt.in
deleted file mode 100644
index c675947..0000000
--- a/tor-browser-version.txt.in
+++ /dev/null
@@ -1 +0,0 @@
- at TOR_BROWSER_VERSION@



More information about the tor-commits mailing list