2 # $Id: Build 40051 2016-03-17 01:20:14Z mojca $
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 objcxx
="OBJCXXFLAGS='$TL_COMPILER_GFLAGS'" # needed only on macs
68 TL_BUILD_ENV
="$c $cxx $objcxx $TL_BUILD_ENV"
71 # allow override of configure location.
72 : ${TL_CONFIGURE=../configure}
74 # allow for changing the banner identification, e.g.,
75 # --with-banner-add='/SomeDistro'; see the build doc.
78 # default to supporting large files as much as possible;
79 # see comments at --disable-largefile in README.config.
80 : ${TL_CONF_LARGEFILE=--enable-largefile}
82 # default to terminate if requested programs or features must be disabled.
83 : ${TL_CONF_MISSING=--disable-missing}
85 # default to static linking.
86 : ${TL_CONF_SHARED=--disable-shared}
88 # allow override of xdvi toolkit, default to standard xaw.
89 : ${TL_CONF_XDVI_TOOLKIT=--with-xdvi-x-toolkit=xaw}
91 # allow adding arbitrary other configure args, after all the others.
92 : ${TL_CONFIGURE_ARGS=}
94 # allow for doing stuff betwen configure and make.
95 : ${TL_POSTCONFIGURE=true}
97 # Kpathsea is not going to be able to find its cnf files during the
98 # build, so omit the warning about it.
99 : ${KPATHSEA_WARNING=0}
101 # make our working directory.
102 test -d $TL_WORKDIR || mkdir
$TL_WORKDIR
103 cd $TL_WORKDIR ||
exit 1
105 # configure && make. Keep the tee outside, so that we can detect
106 # failure at either step.
108 echo "starting TeX Live build at `date`"
113 env |
sort >buildenv.log
115 set -vx # show the configure and make commands in the log.
117 eval $TL_BUILD_ENV $TL_CONFIGURE \
118 --prefix=$TL_INSTALL_DEST \
119 --datadir=$TL_INSTALL_DEST \
124 $TL_CONF_XDVI_TOOLKIT \
127 && eval $TL_POSTCONFIGURE \
128 && eval $TL_BUILD_ENV $TL_MAKE $TL_MAKE_FLAGS $TL_TARGET
130 # Too arcane to try to propagate the exit status through a pipeline.
131 # Just use a temp file.
132 echo $?
>exitstatus.txt
133 } 2>&1 |
tee build.log
136 # if we have a bindir, report the number of binaries built.
137 bindir
=$TL_INSTALL_DEST/bin
138 if test -d "$bindir"; then
139 count
=`find "$bindir" \! -type d -print | wc -l`
140 if test "$count" -gt 0; then
142 echo "$0: $count executables in $bindir."
144 echo "$0: Build failed, no executables under $bindir."
145 echo "$0: Full log in `pwd`/build.log."
147 fi |
tee -a build.log
148 # if no bindir, perhaps they specified --prefix; don't worry.
149 # Any errors will have been duly reported anyway.
152 status
=`cat exitstatus.txt`
153 if echo "$status" |
egrep '^[0-9]+$' >/dev
/null
; then :; else
154 echo "$0: exitstatus.txt does not contain a number; disk full?" >&2
157 echo "done (exit status $status)" `date` |
tee -a build.log