Debian Codegraph @

Build

raw symbols SCIP
1 #!/bin/sh
2 # $Id: Build 77906 2026-02-17 16:13:36Z 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.
10
11 # clean up environment
12 unset TEXMFCNF; export TEXMFCNF
13 LANG=C; export LANG
14
15 # cd to our source directory.
16 mydir=`dirname $0`
17 cd $mydir || exit 1
18 mydir=`pwd` # make absolute
19
20 # We export the TL_* variables so that they can be dumped to buildenv.log.
21 : ${TL_WORKDIR=Work}; export TL_WORKDIR
22
23 # allow override of install destination.
24 if test -z "$TL_INSTALL_DEST"; then
25 H=`pwd`
26 test -d inst || mkdir -p inst/texmf # avoid configure warnings
27 TL_INSTALL_DEST=$H/inst
28 fi
29 export TL_INSTALL_DEST
30
31 # allow override of the make program.
32 # The idea is to use TL_MAKE if that is defined (and set MAKE),
33 # or MAKE if that is defined (and set TL_MAKE),
34 # or default to "make" if neither is set.
35 # We have to end up with both defined because TL_MAKE is used below
36 # in this script, and MAKE is used throughout (in its usual way).
37 if test -n "$TL_MAKE"; then
38 MAKE=$TL_MAKE
39 elif test -n "$MAKE"; then
40 TL_MAKE=$MAKE
41 else
42 TL_MAKE=make
43 MAKE=make
44 fi
45 export MAKE; export TL_MAKE
46
47 # make flags
48 : ${TL_MAKE_FLAGS=}; export TL_MAKE_FLAGS
49 : ${TL_MAKE_VERBOSE=VERBOSE=1}; export TL_MAKE_VERBOSE
50
51 # allow override of make target.
52 : ${TL_TARGET=world}; export TL_TARGET
53
54 if test "x$1" = x--no-clean; then
55 shift
56 echo "$0: --no-clean given, so keeping build and install dirs: " \
57 "$TL_WORKDIR $TL_INSTALL_DEST"
58 else
59 test -f Makefile && $MAKE clean
60 rm -rf $TL_WORKDIR $TL_INSTALL_DEST
61 fi
62
63 # allow adding environment setting for build.
64 : ${TL_BUILD_ENV=}; export TL_BUILD_ENV
65 if echo "$1" | grep '^--debug' >/dev/null || test "x$1" = x-g; then
66 debug_option=$1
67 shift
68 # The idea is that with Build -g, you can set TL_COMPILER_GFLAGS in
69 # the environment with options common to all compilers --
70 # not necessarily anything to do with debugging, e.g., -mcpu=sparvc9.
71 #
72 # See https://tug.org/texlive/build.html for some discussion.
73 #
74 if test "x$debug_option" = x--debug || test "x$debug_option" = x-g; then
75 : ${TL_COMPILER_GFLAGS=-g}
76 elif test "x$debug_option" = x--debug-more; then
77 : ${TL_COMPILER_GFLAGS=-g -Og -ggdb3}
78 else
79 echo "$0: unknown debugging option: $debug_option" >&2
80 exit 1
81 fi
82 export TL_COMPILER_CFLAGS
83 fi
84 #
85 # You can also set TL_{C,CXX,OBJCXX}FLAGS for per-language flags,
86 # notably TL_CFLAGS=-Wdeclaration-after-statement to help Akira.
87 #
88 # But if no TL_*FLAGS are set, don't set CFLAGS at all,
89 # since then Autoconf's default setting (normally -g -O2) will be
90 # overridden, and thus we'll have neither optimization nor debugging.
91 #
92 if test -n "$TL_COMPILER_GFLAGS$TL_CFLAGS"; then
93 c="CFLAGS='$TL_COMPILER_GFLAGS $TL_CFLAGS $CFLAGS'"
94 else
95 c=
96 fi
97 #
98 if test -n "$TL_COMPILER_GFLAGS$TL_CXXFLAGS"; then
99 cxx="CXXFLAGS='$TL_COMPILER_GFLAGS $TL_CXXFLAGS $CXXFLAGS'"
100 else
101 cxx=
102 fi
103 #
104 # objcxx is only used on macs.
105 if test -n "$TL_COMPILER_GFLAGS$TL_OBJCXXFLAGS"; then
106 objcxx="OBJCXXFLAGS='$TL_COMPILER_GFLAGS $TL_OBJCXXFLAGS $OBJCXXFLAGS'"
107 else
108 objcxx=
109 fi
110 #
111 # combine all those.
112 TL_BUILD_ENV="$c $cxx $objcxx $TL_BUILD_ENV"
113
114 # allow for changing the banner identification, e.g.,
115 # --with-banner-add='/SomeDistro'; see the build doc.
116 : ${TL_CONF_BANNER=}; export TL_CONF_BANNER
117
118 # default to supporting large files as much as possible;
119 # see comments at --disable-largefile in README.config.
120 : ${TL_CONF_LARGEFILE=--enable-largefile}; export TL_CONF_LARGEFILE
121
122 # default to terminate if requested programs or features must be disabled.
123 : ${TL_CONF_MISSING=--disable-missing}; export TL_CONF_MISSING
124
125 # default to static linking.
126 : ${TL_CONF_SHARED=--disable-shared}; export TL_CONF_SHARED
127
128 # allow override of xdvi toolkit, default to standard xaw.
129 : ${TL_CONF_XDVI_TOOLKIT=--with-xdvi-x-toolkit=xaw}
130 export TL_CONF_XDVI_TOOLKIT
131
132 # allow override of configure location.
133 : ${TL_CONFIGURE=../configure}; export TL_CONFIGURE
134
135 # allow adding arbitrary other configure args, after all the others.
136 : ${TL_CONFIGURE_ARGS=}; export TL_CONFIGURE_ARGS
137
138 # allow for doing stuff betwen configure and make.
139 : ${TL_POSTCONFIGURE=true}; export TL_POSTCONFIGURE
140
141 # Kpathsea is not going to be able to find its cnf files during the
142 # build, so omit the warning about it.
143 : ${KPATHSEA_WARNING=0}; export KPATHSEA_WARNING
144
145 # make our working directory.
146 test -d $TL_WORKDIR || mkdir $TL_WORKDIR
147 cd $TL_WORKDIR || exit 1
148
149 # configure && make. Keep the tee outside, so that we can detect
150 # failure at either step.
151 {
152 echo "starting TeX Live build at `date`"
153 printf 'CMDLINE\t"%s"\n' "$0 $*"
154 printf 'PWD\t"%s"\n' "`pwd`"
155 printf 'UNAME\t"%s"\n' "`uname -a`"
156 env | sort >buildenv.log
157 echo "See also buildenv.log and buildinfo.log in `pwd`"
158 echo
159 #
160 set -vx # show the configure and make commands in the log.
161
162 eval $TL_BUILD_ENV $TL_CONFIGURE \
163 --prefix=$TL_INSTALL_DEST \
164 --datadir=$TL_INSTALL_DEST \
165 $TL_CONF_BANNER \
166 $TL_CONF_MISSING \
167 $TL_CONF_LARGEFILE \
168 $TL_CONF_SHARED \
169 $TL_CONF_XDVI_TOOLKIT \
170 $TL_CONFIGURE_ARGS \
171 "$@" \
172 && eval $TL_POSTCONFIGURE \
173 && eval $TL_BUILD_ENV $TL_MAKE $TL_MAKE_FLAGS $TL_MAKE_VERBOSE $TL_TARGET
174
175 # Too arcane to propagate the exit status through a pipeline.
176 # Just use a temp file.
177 echo $? >exitstatus.txt
178 } 2>&1 | tee build.log
179
180
181 # if we have a bindir, report the number of binaries built.
182 bindir=$TL_INSTALL_DEST/bin
183 if test -d "$bindir"; then
184 count=`find "$bindir" \! -type d -print | wc -l`
185 if test "$count" -gt 0; then
186 echo
187 echo "$0: $count executables in $bindir."
188 echo "$0: These binaries do not constitute a directly usable system."
189 echo "$0: If you're trying to create a runnable TeX, please see:"
190 echo "$0: https://tug.org/texinfohtml/tlbuild.html#Installing"
191 else
192 echo "$0: Build failed, no executables under $bindir."
193 echo "$0: Full log in: `pwd`/build.log"
194 exit 1
195 fi | tee -a build.log
196 # if no bindir, perhaps they specified --prefix; don't worry.
197 # Any errors will have been duly reported anyway.
198 fi
199
200 status=`cat exitstatus.txt`
201 if echo "$status" | grep '^[0-9][0-9]*$' >/dev/null; then :; else
202 echo "$0: exitstatus.txt does not contain a number; disk full?" >&2
203 status=1
204 fi
205 echo "done (exit status $status)" `date` | tee -a build.log
206
207 exit $status