5 test $
(uname
-m) = "x86)_64" && buildtype
=native || buildtype
=release
10 usage: $0 [-F] [-b build-type] [-O] [-n] [mudir]
13 -b: MuPDF's build type [default native]
14 -O: use ocamlfind for lablGL discovery
15 -n: use native OCaml compiler (bytecode otherwise)
17 build-type = debug|release|native
18 mudir = path to MuPDF's git checkout
23 while getopts nFb
:O opt
; do
25 F
) fontconfig
=true
; cflags
="$cflags -DUSE_FONTCONFIG";;
26 b
) buildtype
="$OPTARG";;
35 test -e "$mupdf" || usage
"Don't know where to find MuPDF's git checkout" 1
37 pkgs
="freetype2 zlib openssl" # j(peg|big2dec)?
38 test $fontconfig && pkgs
="$pkgs fontconfig" || true
41 expr >/dev
/null
"$0" : "/.*" && {
44 helpcmdl
=" -f $(dirname $path)/build.ninja"
51 builddir
=$
(cd $builddir >/dev
/null
$builddir && pwd -P)
53 libs
="$(pkg-config --libs $pkgs) -ljpeg -ljbig2dec -lopenjpeg"
56 lablgldir
="$(ocamlfind query lablgl)" ||
exit 1
57 lablglcflags
="-I $lablgldir"
59 lablglcflags
="-I +lablGL"
63 if test $
(uname
-m) = "x86_64"; then
64 cflags
="$cflags -fPIC"
66 if test $buildtype = "native"; then
67 echo "native build type does not work for non x86_64 targets"
72 cflags=$cflags -O $(pkg-config --cflags $pkgs)
74 srcdir=$(cd >/dev/null $(dirname $0) && pwd -P)
78 lablglcflags=$lablglcflags
80 test -e $mupdf/build
/$buildtype/libmujs.a
&& echo 'mujs=-lmujs'
84 echo "ocamlc=ocamlopt.opt"
85 echo "linksocclib=-cclib"
90 echo "ocamlc=ocamlc.opt"
92 echo "customflag=-custom"
97 Configuration results are saved in $(pwd -P)/.config
98 To build - type: ninja$helpcmdl