What can i say...
[llpp/slowscroll.git] / buildall.sh
blob7d8ae4f29bbb5e9801e3ca8adf3eb49487cf43be
1 # builds "hard" prerequisites and llpp
2 set -e
4 mkdir -p 3rdp
5 cd 3rdp
6 root=$(pwd)
8 lablgl=http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/dist/lablgl-1.04.tar.gz
9 mupdf=git://git.ghostscript.com/mupdf.git
10 mupdf3p=http://mupdf.com/download/mupdf-thirdparty.zip
11 mupdfrev=50dbc1a356577f3df15a876f6adb716dea29bdc5
13 test -d lablGL-1.04 || (wget -nc $lablgl && tar -xzf lablgl-1.04.tar.gz)
14 if ! test -d mupdf; then
15 git clone $mupdf
16 (cd mupdf; git checkout $mupdfrev)
17 else
18 : #(cd mupdf; git pull $mupdf; git checkout $mupdfrev)
21 test -d mupdf/thirdparty || (wget -nc $mupdf3p && unzip -d mupdf mupdf-thirdparty.zip)
23 make=$(gmake -v >/dev/null 2>&1 && echo gmake || echo make)
25 (cd lablGL-1.04 \
26 && cat Makefile.config.linux.mdk > Makefile.config \
27 && $make glut glutopt \
28 && $make install \
29 BINDIR=$root/bin \
30 LIBDIR=$root/lib/ocaml \
31 DLLDIR=$root/lib/ocaml/stublibs \
32 INSTALLDIR=$root/lib/ocaml/lablGL)
34 (cd mupdf && $make build=release)
36 cd ..
38 srcpath=$(dirname $0)
40 sh mkhelp.sh $srcpath/keystoml.ml $srcpath/KEYS > help.ml
42 tp=$root/mupdf/thirdparty
44 ccopt="-O"
45 ccopt="$ccopt -I $tp/jbig2dec"
46 ccopt="$ccopt -I $tp/jpeg-8c"
47 ccopt="$ccopt -I $tp/freetype-2.4.4/include"
48 ccopt="$ccopt -I $tp/openjpeg-1.4/libopenjpeg"
49 ccopt="$ccopt -I $tp/zlib-1.2.5"
50 ccopt="$ccopt -I $root/mupdf/fitz -I $root/mupdf/pdf"
52 ccopt="$ccopt -include ft2build.h -D_GNU_SOURCE"
54 cclib="$cclib -L$root/mupdf/build/release"
55 cclib="$cclib -lmupdf -lfitz -lz -ljpeg -lopenjpeg -ljbig2dec -lfreetype"
57 if test "$1" = "opt"; then
58 cclib="$cclib -lpthread"
59 ocamlopt -c -o link.o -ccopt "$ccopt" $srcpath/link.c
60 ocamlopt -c -o help.cmx help.ml
61 ocamlopt -c -o parser.cmx $srcpath/parser.ml
62 ocamlopt -c -o main.cmx -I $root/lib/ocaml/lablGL $srcpath/main.ml
64 ocamlopt -o llpp \
65 -I $root/lib/ocaml/lablGL \
66 str.cmxa unix.cmxa lablgl.cmxa lablglut.cmxa \
67 link.o \
68 -cclib "$cclib" \
69 help.cmx \
70 parser.cmx \
71 main.cmx
72 else
73 ocamlc -c -o link.o -ccopt "$ccopt" $srcpath/link.c
74 ocamlc -c -o help.cmo help.ml
75 ocamlc -c -o parser.cmo $srcpath/parser.ml
76 ocamlc -c -o main.cmo -I $root/lib/ocaml/lablGL $srcpath/main.ml
78 ocamlc -custom -o llpp \
79 -I $root/lib/ocaml/lablGL \
80 str.cma unix.cma lablgl.cma lablglut.cma \
81 link.o \
82 -cclib "$cclib" \
83 help.cmo \
84 parser.cmo \
85 main.cmo