Added comments on ff only scripts
[luatex.git] / source / Build
blob7f90ff644dcb6369eff67c69f804b12cef5e1a06
1 #!/bin/sh
2 # $Id: Build 35412 2014-10-21 18:19:11Z karl $
3 # Public domain. Originally written many years ago by Sebastian Rahtz.
4 # The basic idea is to run configure && make, but with a multitude of
5 # environment variables to allow overriding everything.
6 #
7 # To build again from where it left off, try Build --no-clean.
8 # To build without optimization, try Build --debug.
9 # Any other options given are passed along to configure.
11 # clean up environment
12 unset TEXMFCNF; export TEXMFCNF
13 LANG=C; export LANG
15 # cd to our source directory.
16 mydir=`dirname $0`
17 cd $mydir || exit 1
19 : ${TL_WORKDIR=Work}
21 # allow override of install destination.
22 if test -z "$TL_INSTALL_DEST"; then
23 H=`pwd`
24 test -d inst || mkdir -p inst/texmf # avoid configure warnings
25 TL_INSTALL_DEST=$H/inst
28 # allow override of the make program.
29 # The idea is to use TL_MAKE if that is defined (and set MAKE),
30 # or MAKE if that is defined (and set TL_MAKE),
31 # or default to "make" if neither is set.
32 # We have to end up with both defined because TL_MAKE is used below
33 # in this script, and MAKE is used throughout (in its usual way).
34 if test -n "$TL_MAKE"; then
35 MAKE=$TL_MAKE
36 elif test -n "$MAKE"; then
37 TL_MAKE=$MAKE
38 else
39 TL_MAKE=make
40 MAKE=make
42 export MAKE
44 # make flags
45 : ${TL_MAKE_FLAGS=}
47 # allow override of make target.
48 : ${TL_TARGET=world}
50 if test "x$1" = x--no-clean; then
51 shift
52 else
53 test -f Makefile && $MAKE clean
54 rm -rf $TL_WORKDIR $TL_INSTALL_DEST
57 # allow adding environment setting for build.
58 : ${TL_BUILD_ENV=}
59 if test "x$1" = x--debug || test "x$1" = x-g; then
60 shift
61 # The idea is that with Build -g, you can set TL_COMPILER_GFLAGS in
62 # the environment with options common to all compilers.
63 # Not necessarily anything to do with debugging, e.g., -mcpu=sparvc9.
64 : ${TL_COMPILER_GFLAGS=-g}
65 c="CFLAGS='$TL_COMPILER_GFLAGS'"
66 cxx="CXXFLAGS='$TL_COMPILER_GFLAGS'"
67 TL_BUILD_ENV="$c $cxx $TL_BUILD_ENV"
70 # allow override of configure location.
71 : ${TL_CONFIGURE=../configure}
73 # allow for changing the banner identification, e.g.,
74 # --with-banner-add='/SomeDistro'; see the build doc.
75 : ${TL_CONF_BANNER=}
77 # default to supporting large files as much as possible;
78 # see comments at --disable-largefile in README.config.
79 : ${TL_CONF_LARGEFILE=--enable-largefile}
81 # default to terminate if requested programs or features must be disabled.
82 : ${TL_CONF_MISSING=--disable-missing}
84 # default to static linking.
85 : ${TL_CONF_SHARED=--disable-shared}
87 # allow override of xdvi toolkit, default to standard xaw.
88 : ${TL_CONF_XDVI_TOOLKIT=--with-xdvi-x-toolkit=xaw}
90 # allow adding arbitrary other configure args, after all the others.
91 : ${TL_CONFIGURE_ARGS=}
93 # allow for doing stuff betwen configure and make.
94 : ${TL_POSTCONFIGURE=true}
96 # Kpathsea is not going to be able to find its cnf files during the
97 # build, so omit the warning about it.
98 : ${KPATHSEA_WARNING=0}
100 # make our working directory.
101 test -d $TL_WORKDIR || mkdir $TL_WORKDIR
102 cd $TL_WORKDIR || exit 1
104 # configure && make. Keep the tee outside, so that we can detect
105 # failure at either step.
107 echo "starting TeX Live build at `date`"
108 echo "on `uname -a`"
109 echo "in `pwd`"
110 echo "$0 $*"
111 echo
112 env | sort >buildenv.log
114 set -vx # show the configure and make commands in the log.
116 eval $TL_BUILD_ENV $TL_CONFIGURE \
117 --prefix=$TL_INSTALL_DEST \
118 --datadir=$TL_INSTALL_DEST \
119 $TL_CONF_BANNER \
120 $TL_CONF_MISSING \
121 $TL_CONF_LARGEFILE \
122 $TL_CONF_SHARED \
123 $TL_CONF_XDVI_TOOLKIT \
124 $TL_CONFIGURE_ARGS \
125 "$@" \
126 && eval $TL_POSTCONFIGURE \
127 && eval $TL_BUILD_ENV $TL_MAKE $TL_MAKE_FLAGS $TL_TARGET
129 # Too arcane to try to propagate the exit status through a pipeline.
130 # Just use a temp file.
131 echo $? >exitstatus.txt
132 } 2>&1 | tee build.log
135 # if we have a bindir, report the number of binaries built.
136 bindir=$TL_INSTALL_DEST/bin
137 if test -d "$bindir"; then
138 count=`find "$bindir" \! -type d -print | wc -l`
139 if test "$count" -gt 0; then
140 echo
141 echo "$0: $count executables in $bindir."
142 else
143 echo "$0: Build failed, no executables under $bindir."
144 echo "$0: Full log in `pwd`/build.log."
145 exit 1
146 fi | tee -a build.log
147 # if no bindir, perhaps they specified --prefix; don't worry.
148 # Any errors will have been duly reported anyway.
151 status=`cat exitstatus.txt`
152 echo "done (exit status $status)" `date` | tee -a build.log
154 exit $status