Refactor
[llpp.git] / buildall.sh
blob23d4d345cdf7eaa3da85f315b794c14ea2d2e6f4
1 # builds "hard" prerequisites and llpp
2 set -e
4 use_sumatrapdf_patched_mupdf=false
6 mkdir -p 3rdp
7 cd 3rdp
9 root=$(pwd)
11 openjpeg=http://openjpeg.googlecode.com/svn/trunk/
12 jbig2dec=git://git.ghostscript.com/jbig2dec.git
13 lablgl=:pserver:anoncvs@camlcvs.inria.fr:/caml
14 mupdf=git://git.ghostscript.com/mupdf.git
15 sumatrapdf=http://sumatrapdf.googlecode.com/svn/trunk
17 test -d openjpeg || svn -r r608 checkout $openjpeg openjpeg
18 test -d jbig2dec || git clone $jbig2dec jbig2dec
19 test -d lablgl || cvs -d $lablgl co -d lablgl bazar-ocaml/lablGL
21 if ! test -d mupdf; then
22 if $use_sumatrapdf_patched_mupdf; then
23 svn checkout $sumatrapdf/mupdf mupdf
24 else
25 git clone $mupdf
29 mkdir -p $root/bin
30 mkdir -p $root/lib
31 mkdir -p $root/include
33 (cd openjpeg \
34 && make dist \
35 && cp dist/*.h $root/include/ \
36 && cp dist/*.a $root/lib/)
38 (cd jbig2dec \
39 && make -f Makefile.unix install prefix=$root && rm -f $root/lib/*.so*)
41 (cd lablgl \
42 && cat Makefile.config.linux.mdk > Makefile.config \
43 && make glut glutopt \
44 && make install \
45 BINDIR=$root/bin \
46 LIBDIR=$root/lib/ocaml \
47 DLLDIR=$root/lib/ocaml/stublibs \
48 INSTALLDIR=$root/lib/ocaml/lablGL)
50 export CPATH=$CPATH:$root/include:$root/mupdf/pdf:$root/mupdf/fitz
51 export LIBRARY_PATH=$LIBRARY_PATH:$root/lib:$root/mupdf/build/release
53 (cd mupdf && make build=release)
55 cd ..
57 srcpath=$(dirname $0)
59 sh mkhelp.sh $srcpath/keystoml.ml $srcpath/KEYS > help.ml
61 ccopt="$(freetype-config --cflags) -O -include ft2build.h"
62 if test "$1" = "opt"; then
63 cclib="-lmupdf -lfitz -lz -ljpeg -lopenjpeg -ljbig2dec -lfreetype -lpthread"
64 ocamlopt -c -o link.o -ccopt "$ccopt" $srcpath/link.c
65 ocamlopt -c -o help.cmx help.ml
66 ocamlopt -c -o parser.cmx $srcpath/parser.ml
67 ocamlopt -c -o main.cmx -I $root/lib/ocaml/lablGL $srcpath/main.ml
69 ocamlopt -o llpp \
70 -I $root/lib/ocaml/lablGL \
71 str.cmxa unix.cmxa lablgl.cmxa lablglut.cmxa \
72 link.o \
73 -cclib "$cclib" \
74 help.cmx \
75 parser.cmx \
76 main.cmx
77 else
78 cclib="-lmupdf -lfitz -lz -ljpeg -lopenjpeg -ljbig2dec -lfreetype"
79 ocamlc -c -o link.o -ccopt "$ccopt" $srcpath/link.c
80 ocamlc -c -o help.cmo help.ml
81 ocamlc -c -o parser.cmo $srcpath/parser.ml
82 ocamlc -c -o main.cmo -I $root/lib/ocaml/lablGL $srcpath/main.ml
84 ocamlc -custom -o llpp \
85 -I $root/lib/ocaml/lablGL \
86 str.cma unix.cma lablgl.cma lablglut.cma \
87 link.o \
88 -cclib "$cclib" \
89 help.cmo \
90 parser.cmo \
91 main.cmo