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.
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
15 # cd to our source directory.
21 # allow override of install destination.
22 if test -z "$TL_INSTALL_DEST"; then
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
36 elif test -n "$MAKE"; then
47 # allow override of make target.
50 if test "x$1" = x--no-clean
; then
53 test -f Makefile
&& $MAKE clean
54 rm -rf $TL_WORKDIR $TL_INSTALL_DEST
57 # allow adding environment setting for build.
59 if test "x$1" = x--debug ||
test "x$1" = x-g
; then
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.
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`"
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 \
123 $TL_CONF_XDVI_TOOLKIT \
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
141 echo "$0: $count executables in $bindir."
143 echo "$0: Build failed, no executables under $bindir."
144 echo "$0: Full log in `pwd`/build.log."
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