4 # Copyright (c) 2005-2011 Martin Schröder <martin@luatex.org>
5 # Copyright (c) 2009-2011 Taco Hoekwater <taco@luatex.org>
6 # Copyright (c) 2013-2013 Luigi Scarso and Hans Hagen (mingw stuff)
8 # Permission to use, copy, modify, and distribute this software for any
9 # purpose with or without fee is hereby granted, provided that the above
10 # copyright notice and this permission notice appear in all copies.
12 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 # new script to build luatex binaries
23 # --make : only make, no make distclean; configure
24 # --parallel : make -j 2 -l 3.0
25 # --nostrip : do not strip binary
26 # --warnings= : enable compiler warnings
27 # --mingw : crosscompile for mingw32 from i-386linux
28 # --mingw32 : crosscompile 32 binary on unix
29 # --mingw64 : crosscompile 64 binary on unix
30 # --msys : crosscompile 32 binary on windows
31 # --msys32 : crosscompile 32 binary on windows
32 # --msys64 : crosscompile 64 binary on windows
33 # --host= : target system for mingw32 cross-compilation
34 # --build= : build system for mingw32 cross-compilation
35 # --arch= : crosscompile for ARCH on OS X
36 # --debug : CFLAGS="-g -O0" CXXFLAGS="-g -O0"--warnings=max --nostrip
38 # L/H: we assume a 64 bit build system .. it took us two days of experimenting with all
39 # kind of permutations to figure it out .. partly due to tangle/tie dependencies and
40 # we're not there yes as there are messages with respect to popen and so
44 # - generate ctangle and tie
45 # - get rid of otangle and tangle dependencies
46 # - don't generate bins we don't need
47 # - maybe make cairo in mplib optional
49 # Patch suggested by Fabrice Popineau in texk/web2c/lib/lib.h: #define eof weof
53 # try to find bash, in case the standard shell is not capable of
54 # handling the generated configure's += variable assignments
55 if which bash
>/dev
/null
57 CONFIG_SHELL
=`which bash`
61 # try to find gnu make; we may need it
63 if make -v 2>&1|
grep "GNU Make" >/dev
/null
65 echo "Your make is a GNU-make; I will use that"
66 elif gmake
-v >/dev
/null
2>&1
70 echo "You have a GNU-make installed as gmake; I will use that"
72 echo "I can't find a GNU-make; I'll try to use make and hope that works."
73 echo "If it doesn't, please install GNU-make."
86 JOBS_IF_PARALLEL
=${JOBS_IF_PARALLEL:-3}
87 MAX_LOAD_IF_PARALLEL
=${MAX_LOAD_IF_PARALLEL:-2}
94 --make ) ONLY_MAKE
=TRUE
;;
95 --nostrip ) STRIP_LUATEX
=FALSE
;;
96 --debug ) STRIP_LUATEX
=FALSE
; WARNINGS
=max
; CFLAGS
="-g -O0 $CFLAGS" ; CXXFLAGS
="-g -O0 $CXXFLAGS" ;;
97 --warnings=*) WARNINGS
=`echo $1 | sed 's/--warnings=\(.*\)/\1/' ` ;;
98 --mingw ) MINGWCROSS
=TRUE
;;
99 --mingw32 ) MINGWCROSS
=TRUE
;;
100 --mingw64 ) MINGWCROSS64
=TRUE
;;
101 --msys ) MINGWMSYS
=TRUE
;;
102 --msys32 ) MINGWMSYS
=TRUE
;;
103 --msys64 ) MINGWMSYS64
=TRUE
;;
104 --host=* ) CONFHOST
="$1" ;;
105 --build=* ) CONFBUILD
="$1" ;;
106 --parallel ) MAKE
="$MAKE -j $JOBS_IF_PARALLEL -l $MAX_LOAD_IF_PARALLEL" ;;
107 --arch=* ) MACCROSS
=TRUE
; ARCH
=`echo $1 | sed 's/--arch=\(.*\)/\1/' ` ;;
108 * ) echo "ERROR: invalid build.sh parameter: $1"; exit 1 ;;
118 MINGW64
* ) LUATEXEXE
=luatex.exe
;;
119 MINGW32
* ) LUATEXEXE
=luatex.exe
;;
120 CYGWIN
* ) LUATEXEXE
=luatex.exe
;;
123 WARNINGFLAGS
=--enable-compiler-warnings=$WARNINGS
129 if [ "$MINGWCROSS" = "TRUE" ]
132 PATH
=`pwd`/extrabin
/mingw
:$PATH
134 CFLAGS
="-mtune=nocona -g -O3 $CFLAGS"
135 CXXFLAGS
="-mtune=nocona -g -O3 $CXXFLAGS"
136 CONFHOST
="--host=i586-mingw32msvc"
137 CONFBUILD
="--build=x86_64-unknown-linux-gnu"
138 STRIP
="${CONFHOST#--host=}-strip"
139 LDFLAGS
="-Wl,--large-address-aware $CFLAGS"
140 export CFLAGS CXXFLAGS LDFLAGS
143 if [ "$MINGWCROSS64" = "TRUE" ]
146 PATH
=`pwd`/extrabin
/mingw
:$PATH
148 CFLAGS
="-mtune=nocona -g -O3 -static-libgcc -static-libstdc++ $CFLAGS"
149 CXXFLAGS
="-mtune=nocona -g -O3 $CXXFLAGS"
150 CONFHOST
="--host=x86_64-w64-mingw32"
151 CONFBUILD
="--build=x86_64-unknown-linux-gnu"
152 STRIP
="${CONFHOST#--host=}-strip"
154 export CFLAGS CXXFLAGS LDFLAGS
157 if [ "$MINGWMSYS" = "TRUE" ]
160 PATH
=`pwd`/extrabin
/msys
:$PATH
163 CFLAGS
="-mtune=nocona -m32 -g -O3 $CFLAGS"
164 CXXFLAGS
="-mtune=nocona -m32 -g -O3 $CXXFLAGS"
165 CONFHOST
="--host=i586-mingw32"
166 CONFBUILD
="--build=x86_64-w64-mingw32"
169 export CFLAGS CXXFLAGS LDFLAGS CPPFLAGS
172 if [ "$MINGWMSYS64" = "TRUE" ]
175 PATH
=`pwd`/extrabin
/mingw
:$PATH
178 CFLAGS
="-mtune=nocona -g -O3 $CFLAGS"
179 CXXFLAGS
="-mtune=nocona -g -O3 $CXXFLAGS"
180 CONFHOST
="--host=x86_64-w64-mingw32"
181 CONFBUILD
="--build=x86_64-w64-mingw32"
184 export CFLAGS CXXFLAGS LDFLAGS CPPFLAGS
187 if [ "$MACCROSS" = "TRUE" ]
189 # make sure that architecture parameter is valid
191 i386 | x86_64 | ppc | ppc64
) ;;
192 * ) echo "ERROR: architecture $ARCH is not supported"; exit 1;;
195 CFLAGS
="-arch $ARCH -g -O2 $CFLAGS"
196 CXXFLAGS
="-arch $ARCH -g -O2 $CXXFLAGS"
197 LDFLAGS
="-arch $ARCH $LDFLAGS"
198 export CFLAGS CXXFLAGS LDFLAGS
201 if [ "$STRIP_LUATEX" = "FALSE" ]
208 # clean up, if needed
209 if [ -r "$B"/Makefile
-a $ONLY_MAKE = "FALSE" ]
212 elif [ ! -r "$B"/Makefile
]
221 # get a new svn version header
222 if [ "$WARNINGS" = "max" ]
224 rm -f source
/texk
/web2c
/luatexdir
/luatex_svnversion.h
226 ( cd source ; .
/texk
/web2c
/luatexdir
/getluatexsvnversion.sh
)
230 if [ "$ONLY_MAKE" = "FALSE" ]
232 TL_MAKE
=$MAKE ..
/source
/configure
$CONFHOST $CONFBUILD $WARNINGFLAGS\
233 --enable-cxx-runtime-hack \
234 --enable-silent-rules \
237 --disable-largefile \
240 --disable-linked-scripts \
241 --enable-dump-share \
244 --without-system-harfbuzz \
245 --without-system-ptexenc \
246 --without-system-kpathsea \
247 --without-system-poppler \
248 --without-system-xpdf \
249 --without-system-freetype \
250 --without-system-freetype2 \
251 --without-system-gd \
252 --without-system-libpng \
253 --without-system-teckit \
254 --without-system-zlib \
255 --without-system-t1lib \
256 --without-system-icu \
257 --without-system-graphite \
258 --without-system-zziplib \
259 --without-mf-x-toolkit --without-x \
265 # the fact that these makes inside libs/ have to be done manually for the cross
266 # compiler hints that something is wrong in the --enable/--disable switches above,
267 # but I am too lazy to look up what is wrong exactly.
268 # (perhaps more files needed to be copied from TL?)
271 (cd libs
/zziplib
; $MAKE all
)
272 (cd libs
/zlib
; $MAKE all
)
273 (cd libs
/libpng
; $MAKE all
)
274 (cd libs
/poppler
; $MAKE all
)
276 (cd texk
/kpathsea
; $MAKE )
278 (cd texk
/web2c
; $MAKE $LUATEXEXE )
283 if [ "$STRIP_LUATEX" = "TRUE" ] ;
285 $STRIP "$B"/texk
/web2c
/$LUATEXEXE
287 echo "luatex binary not stripped"
293 ls -l "$B"/texk
/web2c
/$LUATEXEXE