Sync with upstream
[llpp/slowscroll.git] / build.sh
blobc9347bcfe045b2be9ed0e4170185e3ea973131a2
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
9 test x"$2" = "x" || cty="$2" && cty=""
11 ccopt="$CFLAGS -Wno-pointer-sign -O2"
12 mlopt='-warn-error +a -w +a -g -safe-string'
13 if test -z "$native"; then
14 comp=ocamlc$cty
15 osu=.cmo
16 asu=.cma
17 lfl=-custom
18 else
19 comp=ocamlopt$cty
20 osu=.cmx
21 asu=.cmxa
22 lfl=
24 mkdir -p "$builddir/lablGL"
25 srcdir=$(dirname $0)
26 version=$(cd $srcdir && git describe --tags 2>/dev/null) || version=unknown
27 mloptgl="-I $srcdir/lablGL -I $builddir/lablGL"
28 set -x
29 $comp -ccopt "$ccopt -o $builddir/lablGL/ml_raw.o" -c $srcdir/lablGL/ml_raw.c
30 $comp -ccopt "$ccopt -o $builddir/lablGL/ml_gl.o" -c $srcdir/lablGL/ml_gl.c
31 $comp -ccopt "$ccopt -o $builddir/lablGL/ml_glarray.o" -c $srcdir/lablGL/ml_glarray.c
32 $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
33 /bin/sh $srcdir/mkhelp.sh $srcdir/KEYS "$version" >$builddir/help.ml
34 $comp -c $mloptgl -o $builddir/keys$osu $srcdir/keys.ml
35 $comp -c $mloptgl -o $builddir/lablGL/gl$osu $srcdir/lablGL/gl.ml
36 $comp -c $mloptgl -o $builddir/lablGL/raw$osu $srcdir/lablGL/raw.ml
37 $comp -c $mloptgl -o $builddir/lablGL/glPix$osu $srcdir/lablGL/glPix.ml
38 $comp -c $mloptgl -o $builddir/lablGL/glDraw$osu $srcdir/lablGL/glDraw.ml
39 $comp -c $mloptgl -o $builddir/lablGL/glTex.cmi $srcdir/lablGL/glTex.mli
40 $comp -c $mloptgl -o $builddir/lablGL/glMisc.cmi $srcdir/lablGL/glMisc.mli
41 $comp -c $mloptgl -o $builddir/lablGL/glMat$osu $srcdir/lablGL/glMat.ml
42 $comp -c $mloptgl -o $builddir/lablGL/glMisc$osu $srcdir/lablGL/glMisc.ml
43 $comp -c $mloptgl -o $builddir/lablGL/glFunc$osu $srcdir/lablGL/glFunc.ml
44 $comp -c $mloptgl -o $builddir/lablGL/glTex$osu $srcdir/lablGL/glTex.ml
45 $comp -c $mloptgl -o $builddir/lablGL/glArray$osu $srcdir/lablGL/glArray.ml
46 $comp -c $mloptgl -o $builddir/lablGL/glClear$osu $srcdir/lablGL/glClear.ml
47 $comp -c -o $builddir/help$osu $builddir/help.ml
48 $comp -c $mlopt -o $builddir/utils$osu $srcdir/utils.ml
49 $comp -c $mlopt -I $builddir -o $builddir/parser$osu $srcdir/parser.ml
50 $comp -c $mlopt -I $builddir -o $builddir/wsi.cmi $srcdir/wsi.mli
51 $comp -c $mloptgl -I $builddir -o $builddir/config$osu $srcdir/config.ml
52 $comp -c $mloptgl -I $builddir -o $builddir/main$osu $srcdir/main.ml
53 $comp -c $mlopt -I $builddir -o $builddir/wsi$osu $srcdir/wsi.ml
54 $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"