#!/bin/sh # $Id$ # Originally written many years ago by Sebastian Rahtz. Public domain. # To build again from same sources, try Build --no-clean. # To build (mostly) without optimization, try Build --debug. # # Any other options given are passed along to configure, and everything can be # overridden with environment variables. # clean up environment unset TEXMFCNF; export TEXMFCNF LANG=C; export LANG # cd to our source directory. mydir=`dirname $0` cd $mydir || exit 1 : ${TL_WORKDIR=Work} # allow override of install destination. if test -z "$TL_INSTALL_DEST"; then H=`pwd` test -d inst || mkdir -p inst/texmf # avoid configure warnings TL_INSTALL_DEST=$H/inst fi # allow override of make program. : ${TL_MAKE=make} # and then also set GNUMAKE to that, for the sake of freetype2/configure. : ${GNUMAKE=${TL_MAKE}} export GNUMAKE if test "x$1" = x--no-clean; then shift else test -f Makefile && $TL_MAKE clean rm -rf $TL_WORKDIR $TL_INSTALL_DEST fi : ${TL_BUILD_ENV=} if test "x$1" = x--debug; then TL_BUILD_ENV="CFLAGS=-g CXXFLAGS=-g" shift fi unset CDPATH test -d $TL_WORKDIR || mkdir $TL_WORKDIR cd $TL_WORKDIR || exit 1 # allow override of configure location, just in case. : ${TL_CONFIGURE=../configure} # longinteger and off_t declarations are still inconsistent, do not # enable this unless you are testing. : ${TL_CONF_LARGEFILE=--disable-largefile} # allow override of xdvi toolkit, default to standard xaw. : ${TL_CONF_XDVI_TOOLKIT=--with-xdvi-x-toolkit=xaw} # default to building ICU without thread support, since xetex doesn't need it. : ${TL_CONF_THREADS=--disable-threads} # default to include freetype2 support for old Mac font file formats. : ${TL_CONF_MAC_FONTS=--with-old-mac-fonts} # skip xindy by default, it requires clisp (see utils/README). : ${TL_CONF_XINDY=--without-xindy} # allow adding arbitrary other configure args. : ${TL_CONFIGURE_ARGS=} # allow override of make target. : ${TL_TARGET=world} # Kpathsea is not going to be able to find its cnf files during the # build, so omit the warning about it. : ${KPATHSEA_WARNING=0} # set -vx # configure && make. Keep the tee outside, so that we can detect # failure at either step. { eval $TL_BUILD_ENV time $TL_CONFIGURE \ --prefix=$TL_INSTALL_DEST \ --datadir=$TL_INSTALL_DEST \ $TL_CONF_LARGEFILE \ $TL_CONF_XDVI_TOOLKIT \ $TL_CONF_THREADS \ $TL_CONF_MAC_FONTS \ $TL_CONF_XINDY \ $TL_CONFIGURE_ARGS \ "$@" \ && eval $TL_BUILD_ENV time $TL_MAKE $TL_TARGET # Too arcane to try to propagate the exit status through a pipeline. # Just use a temp file. echo $? >exitstatus.txt } 2>&1 | tee build.log # report the number of binaries built. bindir=$TL_INSTALL_DEST/bin count=`find $bindir \! -type d -print | wc -l` if test "$count" -gt 0; then echo echo "$0: $count binaries in $bindir." else echo "$0: Build failed, no binaries under $bindir." exit 1 fi | tee -a build.log exit `cat exitstatus.txt`