5 test $
(uname
-m) = "x86_64" && buildtype
=native || buildtype
=release
10 usage: $0 [-F] [-b build-type] [-O] [-n]
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
22 while getopts nFb
:O opt
; do
24 F
) fontconfig
=true
; cflags
="$cflags -DUSE_FONTCONFIG";;
25 b
) buildtype
="$OPTARG";;
32 pkgs
="freetype2 zlib openssl" # j(peg|big2dec)?
33 test $fontconfig && pkgs
="$pkgs fontconfig" || true
36 expr >/dev
/null
"$0" : "/.*" && {
39 helpcmdl
=" -f $(dirname $path)/build.ninja"
46 builddir
=$
(cd $builddir >/dev
/null
$builddir && pwd -P)
48 libs
="$(pkg-config --libs $pkgs) -ljpeg -ljbig2dec -lopenjpeg"
51 lablgldir
="$(ocamlfind query lablgl)" ||
exit 1
52 lablglcflags
="-I $lablgldir"
54 lablglcflags
="-I +lablGL"
58 if test $
(uname
-m) = "x86_64"; then
59 cflags
="$cflags -fPIC"
61 if test $buildtype = "native"; then
62 echo "native build type does not work for non x86_64 targets"
67 cflags=$cflags -O $(pkg-config --cflags $pkgs)
69 srcdir=$(cd >/dev/null $(dirname $0) && pwd -P)
72 lablglcflags=$lablglcflags
74 test -e mupdf
/build
/$buildtype/libmujs.a
&& echo 'mujs=-lmujs'
78 command 2>&1 >/dev
/null
-v ocamlopt.opt
&& optsuf
=".opt" || optsuf
=""
79 echo "ocamlc=ocamlopt$optsuf"
80 echo "linksocclib=-cclib"
85 command 2>&1 >/dev
/null
-v ocamlc.opt
&& optsuf
=".opt" || optsuf
=""
86 echo "ocamlc=ocamlc$optsuf"
88 echo "customflag=-custom"
93 Configuration results are saved in $(pwd -P)/.config
94 To build - type: ninja$helpcmdl