Change splitatspace to return a pair
[llpp.git] / build.sh
blob640f0023fa34c813d292aefdd970b9999d429b73
1 #!/bin/sh
2 set -e
3 if test x"$1" = x; then
4 printf "No build directory specified\n" 1>&2
5 exit 1
6 else
7 builddir="$1"
8 fi
10 ccopt="$CFLAGS -Wno-pointer-sign -O2"
11 mlopt='-warn-error +a -w +a -g -safe-string'
12 if test -z "$native"; then
13 comp=ocamlc.opt
14 osu=.cmo
15 asu=.cma
16 lfl=-custom
17 else
18 comp=ocamlopt.opt
19 osu=.cmx
20 asu=.cmxa
21 lfl=
23 mkdir -p "$builddir/lablGL"
24 srcdir=$(dirname $0)
25 version=$(cd $srcdir && git describe --tags 2>/dev/null) || version=unknown
26 mloptgl="-I $srcdir/lablGL -I $builddir/lablGL"
27 set -x
28 $comp -ccopt "$ccopt -o $builddir/lablGL/ml_raw.o" -c $srcdir/lablGL/ml_raw.c
29 $comp -ccopt "$ccopt -o $builddir/lablGL/ml_gl.o" -c $srcdir/lablGL/ml_gl.c
30 $comp -ccopt "$ccopt -o $builddir/lablGL/ml_glarray.o" -c $srcdir/lablGL/ml_glarray.c
31 $comp -ccopt "-I $srcdir/mupdf/include -I $srcdir/mupdf/thirdparty/freetype/include -Wextra -Wall -Werror -D_GNU_SOURCE -O -g -std=c99 -pedantic-errors -Wunused-parameter -Wsign-compare -Wshadow -o $builddir/link.o" -c $srcdir/link.c
32 /bin/sh $srcdir/mkhelp.sh $srcdir/KEYS "$version" >$builddir/help.ml
33 $comp -c $mloptgl -o $builddir/lablGL/gl$osu $srcdir/lablGL/gl.ml
34 $comp -c $mloptgl -o $builddir/lablGL/raw$osu $srcdir/lablGL/raw.ml
35 $comp -c $mloptgl -o $builddir/lablGL/glPix$osu $srcdir/lablGL/glPix.ml
36 $comp -c $mloptgl -o $builddir/lablGL/glDraw$osu $srcdir/lablGL/glDraw.ml
37 $comp -c $mloptgl -o $builddir/lablGL/glTex.cmi $srcdir/lablGL/glTex.mli
38 $comp -c $mloptgl -o $builddir/lablGL/glMisc.cmi $srcdir/lablGL/glMisc.mli
39 $comp -c $mloptgl -o $builddir/lablGL/glMat$osu $srcdir/lablGL/glMat.ml
40 $comp -c $mloptgl -o $builddir/lablGL/glMisc$osu $srcdir/lablGL/glMisc.ml
41 $comp -c $mloptgl -o $builddir/lablGL/glFunc$osu $srcdir/lablGL/glFunc.ml
42 $comp -c $mloptgl -o $builddir/lablGL/glTex$osu $srcdir/lablGL/glTex.ml
43 $comp -c $mloptgl -o $builddir/lablGL/glArray$osu $srcdir/lablGL/glArray.ml
44 $comp -c $mloptgl -o $builddir/lablGL/glClear$osu $srcdir/lablGL/glClear.ml
45 $comp -c -o $builddir/help$osu $builddir/help.ml
46 $comp -c $mlopt -o $builddir/utils$osu $srcdir/utils.ml
47 $comp -c $mlopt -o $builddir/parser$osu $srcdir/parser.ml
48 $comp -c $mlopt -I $builddir -o $builddir/wsi.cmi $srcdir/wsi.mli
49 $comp -c $mloptgl -I $builddir -o $builddir/config$osu $srcdir/config.ml
50 sed -f $srcdir/pp.sed $srcdir/main.ml >$builddir/main.ml
51 $comp -c $mloptgl -I $builddir -o $builddir/main$osu $builddir/main.ml
52 $comp -c $mlopt -I $builddir -o $builddir/wsi$osu $srcdir/wsi.ml
53 $comp -g $lfl -I lablGL -o $builddir/llpp unix$asu str$asu $builddir/help$osu $builddir/lablGL/raw$osu $builddir/utils$osu $builddir/parser$osu $builddir/lablGL/glMisc$osu $builddir/wsi$osu $builddir/lablGL/gl$osu $builddir/lablGL/glMat$osu $builddir/lablGL/glFunc$osu $builddir/lablGL/glClear$osu $builddir/lablGL/glPix$osu $builddir/lablGL/glTex$osu $builddir/lablGL/glDraw$osu $builddir/config$osu $builddir/lablGL/glArray$osu $builddir/main$osu $builddir/link.o -cclib "-lGL -lX11 -lmupdf -lmupdfthird -lpthread -L$srcdir/mupdf/build/native -lcrypto $builddir/lablGL/ml_gl.o $builddir/lablGL/ml_glarray.o $builddir/lablGL/ml_raw.o"