1 diff --git a/build.bash b/build.bash
2 index 9f72c04..6462b11 100755
5 @@ -33,9 +33,7 @@ test -n "${1-}" || die "usage: $0 build-directory"
9 -muinc="-I $mudir/include -I $mudir/thirdparty/freetype/include"
11 -test -d $mudir || die muPDF wasn\'t found in $outd/, consult $srcd/BUILDING
12 +mudeps=('freetype2' 'gumbo' 'harfbuzz' 'libjpeg' 'libopenjp2' 'x11' 'zlib')
14 mkdir -p $outd/{$wsid,lablGL}
16 @@ -45,8 +43,6 @@ mbt=${mbt:-release}
17 test -n "${gmk:-}" && gmk=false || gmk=true
19 mulibs="$mudir/build/$mbt/libmupdf.a $mudir/build/$mbt/libmupdf-third.a"
20 -make="make -C "$mudir" build=$mbt -j $mjobs libs"
25 @@ -85,7 +81,7 @@ cflags() {
26 version.o) f=-DLLPP_VERSION=$ver;;
27 lablGL/*.o) f="-g -Wno-pointer-sign -Werror -O2";;
29 - f="-g -std=c11 $muinc -Wall -Werror -Wextra -pedantic "
30 + f="$CFLAGS -g -std=c11 $(pkg-config --cflags "${mudeps[@]}") -Wall -Werror -Wextra -pedantic "
31 test "${mbt-}" = "debug" || f+="-O2 "
32 $darwin && f+="-DMACOS -D_GNU_SOURCE -DGL_H='<OpenGL/gl.h>'" \
33 || f+="-D_POSIX_C_SOURCE -DGL_H='<GL/gl.h>'"
34 @@ -104,39 +100,6 @@ mflags() {
37 overs=$(ocamlc -vnum 2>/dev/null) || overs=""
38 -if test "$overs" != "4.13.0"; then
39 - url=https://caml.inria.fr/pub/distrib/ocaml-4.13/ocaml-4.13.0.tar.xz
40 - txz=$outd/$(basename $url)
41 - keycmd="printf $url; digest $txz;"
42 - isfresh $txz "$(eval $keycmd)" || {
43 - if executable_p wget; then dl() { wget "$1" -O "$2"; }
44 - elif executable_p curl; then dl() { curl -L "$1" -o "$2"; }
45 - else die "no program to fetch remote urls found"
48 - eval $keycmd >$txz.past
49 - } && vecho "fresh $txz"
50 - absprefix=$(realpath $outd)
51 - export PATH=$absprefix/bin:$PATH
52 - ocamlc=$absprefix/bin/ocamlc
53 - keycmd="printf $url; digest $ocamlc;"
54 - isfresh $ocamlc "$(eval $keycmd)" || (
55 - # This will needlessly re{configure,make} ocaml since "past"
56 - # of configure/make is hard to ascertain. "Better safe than
57 - # sorry" approach is taken here. The check will work for a
58 - # single ocaml url/version, but _will_ redo _everything_
59 - # otherwise (even if fully built artifacts are available)
60 - tar xf $txz -C $outd
62 - cd $outd/${bn%.tar.xz}
63 - ./configure --disable-ocamldoc --disable-ocamltest \
64 - --enable-debugger=no --prefix=$absprefix
65 - make -j $mjobs world
67 - eval $keycmd >$absprefix/bin/ocamlc.past
68 - ) && vecho "fresh ocamlc"
69 - overs=$(ocamlc -vnum 2>/dev/null)
74 @@ -307,7 +270,7 @@ for m in ml_gl ml_glarray ml_raw; do
77 libs="str.cma unix.cma"
78 -clibs="-L$mudir/build/$mbt -lmupdf -lmupdf-third -lpthread"
79 +clibs="-ljbig2dec $(pkg-config --libs "${mudeps[@]}") -lmupdf -lmupdf-third -lpthread"
82 clibs+=" -framework Cocoa -framework OpenGL"