1 # builds "hard" prerequisites and llpp
5 command -v $1 >/dev
/null
2>&1
10 mupdfrev
=803470e161539f9013f854188e57505f4878e891
11 while getopts j
:f
:t
:r
:F opt
; do
13 j
) jobs="-j $OPTARG";;
16 r
) mupdfrev
="$OPTARG";;
20 "usage: $0 [-j jobs] [-f filter] [-t build type] [-r revision] [opt]"
24 shift $
(($OPTIND - 1))
30 if executable_p wget
; then
35 if executable_p curl
; then
41 echo "no program to fetch remote urls found"
46 lablgl
=http
://wwwfun.kurims.kyoto-u.ac.jp
/soft
/lsl
/dist
/lablgl-1.05.
tar.gz
47 baseurl
="http://git.ghostscript.com/"
50 mutgz
=mupdf-
$mupdfrev.tgz
51 muurl
="${baseurl}?p=mupdf.git;a=snapshot;h=$mupdfrev;sf=tgz"
53 test -d lablgl-1.05 || \
54 (dl
$lablgl $
(basename $lablgl) && tar -xzf lablgl-1.05.
tar.gz
)
55 test -e $mutgz || dl
$muurl $mutgz
57 (mkdir
$mudir && tar --strip-components 1 -C $mudir -xzf $mutgz)
62 test $m = jbig2dec
&& p
=$m || p
=thirdparty
/$m
63 test $m = openjpeg
&& e
=opj_config.h.
in.user || e
=README
64 u
="${baseurl}?p=$p.git;a=snapshot;h=$r;sf=tgz"
65 test -e $t || dl
$u $t
66 test -e $mudir/thirdparty
/$m/$e ||
67 (rm -fr $mudir/thirdparty
/$m && mkdir
$mudir/thirdparty
/$m &&
68 tar -xzf $t --strip-components 1 -C $mudir/thirdparty
/$m)
72 grep -v -E "$filt" <<-EOF | fetch
73 2ef0a19842ae1172bec153225328aaaeaf130a18 freetype
74 11b4c3203dc5a9551720760570c82408c303cd1c jbig2dec
75 219d59dcfd0e6ce8a3d8c5510e29237f0b5078ed jpeg
76 4c7d23d2cd00cee7822a61d1e8472439bd6d53c9 openjpeg
77 c16b1b18ddaaf090caf321af831bccac6381a381 zlib
80 executable_p gmake
&& make=gmake ||
make=make
83 && sed 17d Makefile.config.linux.mdk
> Makefile.config \
84 && $make lib $
(test "$1" = opt
&& echo libopt
) \
87 LIBDIR
=$root/lib
/ocaml \
88 DLLDIR
=$root/lib
/ocaml
/stublibs \
89 INSTALLDIR
=$root/lib
/ocaml
/lablGL
)
91 opjconfig
=$root/$mudir/thirdparty
/openjpeg
/libopenjpeg
/opj_config.h
92 expr "$filt" : '.*openjpeg.*' >/dev
/null ||
{
93 cat >>$opjconfig <<EOF
95 #define OPJ_BIG_ENDIAN 1
100 (cd $mudir && $make $jobs build
=$btyp $ojbe)
104 srcpath
=$
(dirname $0)
106 tp
=$root/$mudir/thirdparty
109 ccopt
="$ccopt -I $tp/jbig2dec"
110 ccopt
="$ccopt -I $tp/jpeg"
111 ccopt
="$ccopt -I $tp/freetype/include"
112 ccopt
="$ccopt -I $tp/openjpeg/libopenjpeg"
113 ccopt
="$ccopt -I $tp/zlib"
114 ccopt
="$ccopt -I $root/$mudir/include"
116 cclib
="$cclib -L$root/$mudir/build/$btyp"
117 cclib
="$cclib -lmupdf"
118 cclib
="$cclib -lz -ljpeg -lopenjpeg -ljbig2dec -lpthread -lcrypto"
121 ccopt
="$ccopt -D_GNU_SOURCE"
122 test -z "$usefontconfig" ||
{
123 ccopt
="$ccopt -DUSE_FONTCONFIG $(pkg-config --cflags fontconfig)"
124 cclib
="$cclib $(pkg-config --libs fontconfig)"
127 expr "$filt" : '.*freetype.*' >/dev
/null
&& {
128 ccopt
="$ccopt $(freetype-config --cflags) -include ft2build.h"
129 cclib
="$cclib $(freetype-config --libs)"
131 ccopt
="$ccopt -include $tp/freetype/include/ft2build.h"
132 cclib
="$cclib -lfreetype"
135 echo Building llpp...
137 sh
$srcpath/mkhelp.sh
$srcpath/keystoml.ml
$srcpath/KEYS
> help.ml
139 if test "$1" = "opt"; then
140 executable_p ocamlopt.opt
&& comp
=ocamlopt.opt || comp
=ocamlopt
145 executable_p ocamlc.opt
&& comp
=ocamlc.opt || comp
=ocamlc
151 $comp -c -o link.o
-ccopt "$ccopt" $srcpath/link.c
152 $comp -c -o help.
$osuf help.ml
153 $comp -c -o utils.
$osuf $srcpath/utils.ml
154 $comp -c -o wsi.cmi
$srcpath/wsi.mli
155 $comp -c -o wsi.
$osuf $srcpath/wsi.ml
156 $comp -c -o parser.
$osuf $srcpath/parser.ml
157 $comp -c -o config.
$osuf -I $root/lib
/ocaml
/lablGL
$srcpath/config.ml
158 $comp -c -pp "sed -f $srcpath/pp.sed" -o main.
$osuf \
159 -I $root/lib
/ocaml
/lablGL
$srcpath/main.ml
162 -I $root/lib
/ocaml
/lablGL \
163 str.
$asuf unix.
$asuf lablgl.
$asuf \