Avoid doing extra work
[llpp/slowscroll.git] / buildall.sh
blob425f4186fc00f69e770f53b26d759adc651ccc18
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=http://wwwfun.kurims.kyoto-u.ac.jp/soft/lsl/dist/lablgl-1.04.tar.gz
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-1.04 || (wget $lablgl && tar -xzf lablgl-1.04.tar.gz)
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 make=$(gmake -v >/dev/null 2>&1 && echo gmake || echo make)
35 (cd openjpeg \
36 && $make dist \
37 && cp dist/*.h $root/include/ \
38 && cp dist/*.a $root/lib/)
40 (cd jbig2dec \
41 && $make -f Makefile.unix install prefix=$root && rm -f $root/lib/*.so*)
43 (cd lablGL-1.04 \
44 && cat Makefile.config.linux.mdk > Makefile.config \
45 && $make glut glutopt \
46 && $make install \
47 BINDIR=$root/bin \
48 LIBDIR=$root/lib/ocaml \
49 DLLDIR=$root/lib/ocaml/stublibs \
50 INSTALLDIR=$root/lib/ocaml/lablGL)
52 export CPATH=$root/include:$root/mupdf/pdf:$root/mupdf/fitz:$CPATH:/usr/local/include
53 export LIBRARY_PATH=$root/lib:$root/mupdf/build/release:$LIBRARY_PATH:/usr/local/lib
55 (cd mupdf && $make build=release)
57 cd ..
59 srcpath=$(dirname $0)
61 sh mkhelp.sh $srcpath/keystoml.ml $srcpath/KEYS > help.ml
63 ccopt="$(freetype-config --cflags) -O -include ft2build.h -D_GNU_SOURCE"
64 if test "$1" = "opt"; then
65 cclib="-lmupdf -lfitz -lz -ljpeg -lopenjpeg -ljbig2dec -lfreetype -lpthread"
66 ocamlopt -c -o link.o -ccopt "$ccopt" $srcpath/link.c
67 ocamlopt -c -o help.cmx help.ml
68 ocamlopt -c -o parser.cmx $srcpath/parser.ml
69 ocamlopt -c -o main.cmx -I $root/lib/ocaml/lablGL $srcpath/main.ml
71 ocamlopt -o llpp \
72 -I $root/lib/ocaml/lablGL \
73 str.cmxa unix.cmxa lablgl.cmxa lablglut.cmxa \
74 link.o \
75 -cclib "$cclib" \
76 help.cmx \
77 parser.cmx \
78 main.cmx
79 else
80 cclib="-lmupdf -lfitz -lz -ljpeg -lopenjpeg -ljbig2dec -lfreetype"
81 ocamlc -c -o link.o -ccopt "$ccopt" $srcpath/link.c
82 ocamlc -c -o help.cmo help.ml
83 ocamlc -c -o parser.cmo $srcpath/parser.ml
84 ocamlc -c -o main.cmo -I $root/lib/ocaml/lablGL $srcpath/main.ml
86 ocamlc -custom -o llpp \
87 -I $root/lib/ocaml/lablGL \
88 str.cma unix.cma lablgl.cma lablglut.cma \
89 link.o \
90 -cclib "$cclib" \
91 help.cmo \
92 parser.cmo \
93 main.cmo