summaryrefslogtreecommitdiff
path: root/Build/source/README.2building
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-04-10 17:01:25 +0000
committerKarl Berry <karl@freefriends.org>2018-04-10 17:01:25 +0000
commit03ceb06427ff4019680b054f9f08ce5c3923d063 (patch)
treed79d4a429493a50afe9977d247222d7426cdc40a /Build/source/README.2building
parent584f1a0700fa73a35b7ad9bdcc84eb4792cd9278 (diff)
tlbuild remake for 2018
git-svn-id: svn://tug.org/texlive/trunk@47432 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/README.2building')
-rw-r--r--Build/source/README.2building104
1 files changed, 104 insertions, 0 deletions
diff --git a/Build/source/README.2building b/Build/source/README.2building
index 12ddd9a9391..d19b92c2a8a 100644
--- a/Build/source/README.2building
+++ b/Build/source/README.2building
@@ -149,3 +149,107 @@ individual packages may use something different. You can explicitly
specify the compilers to be used with the environment variables 'CC',
'CXX', and 'OBJCXX'.
+4.6 Cross compilation
+=====================
+
+In a cross compilation a "build" system is used to create binaries to be
+executed on a "host" system with different hardware and/or operating
+system.
+
+ In simple cases, the build system can execute binaries for the host
+system. This typically occurs for bi-arch systems where, e.g.,
+'i386-linux' binaries can run on 'x86_64-linux' systems and 'win32'
+binaries can run on 'win64' systems. Although sometimes called "native
+cross", technically this is not cross compilation at all. In most such
+cases it suffices to specify suitable compiler flags. It might be
+useful to add the configure option '--build=HOST' to get the correct
+canonical host name, but note that this should _not_ be '--host=HOST'
+(*note (autoconf)Hosts and Cross-Compilation::).
+
+ In order to build, e.g., 32-bit binaries with 'clang' on a 64-bit
+MacOSX system one could use:
+
+ TL_BUILD_ENV="CC='clang -arch i386' \
+ CXX='clang++ -arch i386' \
+ OBJCXX='clang++ -arch i386'" \
+ ./Build --build=i386-apple-darwin
+
+4.6.1 Cross configuring
+-----------------------
+
+In a standard cross compilation, binaries for the host system cannot
+execute on the build system and it is necessary to specify the configure
+options '--host=HOST' and '--build=BUILD' with two different values.
+
+ Building binaries requires suitable "cross" tools, e.g., compiler,
+linker, and archiver, and perhaps a "cross" version of 'pkg-config' and
+similar to locate host system libraries. Autoconf expects that these
+cross tools are given by their usual variables or found under their
+usual name prefixed with 'HOST-'. Here a list of such tools and
+corresponding variables:
+
+ ar AR
+ freetype-config FT2_CONFIG
+ g++ CXX
+ gcc CC
+ icu-config ICU_CONFIG
+ objdump OBJDUMP
+ pkg-config PKG_CONFIG
+ ranlib RANLIB
+ strip STRIP
+
+In order to, e.g., build 'mingw32' binaries on 'x86_64-linux' with a
+cross compiler found as 'i386-pc-mingw32-gcc' one would specify
+
+ --host=i386-pc-mingw32 --build=x86_64-linux-gnu
+
+or perhaps
+
+ --host=mingw32 --build=x86_64-linux CC=i386-pc-mingw32-gcc
+
+but this latter, especially, might require adding 'CXX' and others.
+
+ Configure arguments such as 'CFLAGS=...' refer to the cross compiler.
+If necessary, you can specify compilers and flags for the few auxiliary
+C and C++ programs required for the build process as configure arguments
+
+ BUILDCC=...
+ BUILDCPPFLAGS=...
+ BUILDCFLAGS=...
+ BUILDCXX=...
+ BUILDCXXFLAGS=...
+ BUILDLDFLAGS=...
+
+4.6.2 Cross problems
+--------------------
+
+The fact that binaries for the host system cannot be executed on the
+build system causes some problems.
+
+ One problem is that configure tests using 'AC_RUN_IFELSE' can compile
+and link the test program but cannot execute it. Such tests should be
+avoided if possible and otherwise must supply a pessimistic test result.
+
+ Another problem arises if the build process must execute some
+(auxiliary or installable) programs. Auxiliary programs can be placed
+into a subdirectory that is configured natively as is done for
+'texk/web2c/web2c', 'texk/dvipsk/squeeze', and 'texk/xdvik/squeeze'.
+The module 'libs/freetype2' uses the value of 'CC_BUILD', 'BUILD-gcc',
+'gcc', or 'cc' as the compiler for the auxiliary program.
+
+ The situation for installable programs needed by the build process is
+somewhat different. A rather expensive possibility, chosen for the ICU
+libraries in module 'libs/icu', is to first compile natively for the
+build system and in a second step to use these (uninstalled) programs
+during the cross compilation.
+
+ This approach would also be possible for the tools such as 'tangle'
+used in the module 'texk/web2c' to build the WEB programs, but that
+would require first building a native 'kpathsea' library. To avoid this
+complication, cross compilation of the WEB or CWEB programs requires
+sufficiently recent installed versions of 'tangle', 'ctangle',
+'otangle', and 'tie'.
+
+ Building 'xindy' requires running the host system 'clisp' binary,
+thus cross compilation is not possible.
+