summaryrefslogtreecommitdiff
path: root/Build/source/Build
blob: 111c17f4b0eba659149f244c519ac92327ef9f4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/sh
# $Id$
# Public domain.  Originally written many years ago by Sebastian Rahtz.
# To build again, try Build --no-clean.
# To build 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}

# make flags
: ${TL_MAKE_FLAGS=}

# set MAKE to $TL_MAKE for configure
: ${MAKE=${TL_MAKE}}
export 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

# For MacOSX PowerPC, we want to keep working on 10.3.
# For MacOSX Intel, though, the earliest system is 10.4.
if sh build-aux/config.guess | grep powerpc.*darwin >/dev/null \
   && test -z "$MACOSX_DEPLOYMENT_TARGET"; then
  MACOSX_DEPLOYMENT_TARGET=10.3
  export MACOSX_DEPLOYMENT_TARGET
fi

: ${TL_BUILD_ENV=}
if test "x$1" = x--debug || test "x$1" = x-g; then
  shift
  TL_BUILD_ENV="CFLAGS='-g $TL_GCFLAGS' CXXFLAGS=-g OBJCFLAGS=-g $TL_BUILD_ENV"
fi

test -d $TL_WORKDIR || mkdir $TL_WORKDIR
cd $TL_WORKDIR || exit 1

# allow override of configure location, just in case.
: ${TL_CONFIGURE=../configure}

# banner for TeX et al.
: ${TL_CONF_BANNER=--with-tex-banner='"TeX Live 2010/pretest"'}

# longinteger and off_t declarations are still inconsistent, do not
# enable this unless you are testing.
: ${TL_CONF_LARGEFILE=--disable-largefile}

# default to static linking.
: ${TL_CONF_SHARED=--disable-shared}

# default to terminate if requested programs or features must be disabled.
: ${TL_CONF_MISSING=--disable-missing}

# allow override of xdvi toolkit, default to standard xaw.
: ${TL_CONF_XDVI_TOOLKIT=--with-xdvi-x-toolkit=xaw}

# allow adding arbitrary other configure args, such as
# --with-tex-banner='TeX Live 2009/SomeDistro'.
: ${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}

# configure && make.  Keep the tee outside, so that we can detect
# failure at either step.
{
  echo starting `date`
  echo "$0 $*"
  echo
  set -vx  # show the configure and make commands in the log.

  eval $TL_BUILD_ENV time $TL_CONFIGURE \
        --prefix=$TL_INSTALL_DEST \
        --datadir=$TL_INSTALL_DEST \
        $TL_CONF_BANNER \
        $TL_CONF_SHARED \
        $TL_CONF_MISSING \
        $TL_CONF_LARGEFILE \
        $TL_CONF_XDVI_TOOLKIT \
        $TL_CONFIGURE_ARGS \
        "$@" \
  && eval $TL_BUILD_ENV time $TL_MAKE $TL_MAKE_FLAGS $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 executables in $bindir."
else
  echo "$0: Build failed, no executables under $bindir."
  exit 1
fi | tee -a build.log

echo done `date` | tee -a build.log

exit `cat exitstatus.txt`