llpp/tbs
malc 79b35587bf Make obscured optimization optional and disabled by default
At least CBZ[1] can contain images with alpha which which leads to
"funny" results, those adventurous enough can still compile with
OBSCURED_OPT defined to get whatever speed increase that gives...

[1] For instance CBZ containing just this image http://xkcd.com/1110/
2012-10-09 14:56:27 +04:00

46 lines
1 KiB
Bash

#!/bin/sh
#set -x
set -e
h=$(readlink -f $(dirname $0))
t=$(readlink -f ..)/tbs
d=MD5
export OCAMLRUNPARAM=b
if test $h = $PWD; then
mkdir -p build
cd build
fi
if ! md5sum --status -c $d; then
md5sum $h/build.ml $h/tbs $t/tbs.cma >$d.tmp
ocamlc.opt -o build.cmo -c -g -I $t $h/build.ml
ocamlc.opt -g -thread -I $t unix.cma threads.cma tbs.cma build.cmo -o b
mv $d.tmp $d
fi
mupdf=/home/malc/x/rcs/git/mupdf
ccopt="-std=c89 -Wall -Werror"
ccopt="$ccopt -I$mupdf/fitz -I$mupdf/pdf -I$mupdf/xps -I$mupdf/cbz"
ccopt="$ccopt $(freetype-config --cflags) -include ft2build.h"
targets="llpp"
libs="-lfitz"
libs="$libs -lopenjpeg -ljbig2dec -ljpeg -lz -lfreetype -lX11"
if test $(hostname) = "linmac"; then
cc=gcc-4.6.0
#ccopt="$ccopt -maltivec -O -D_GNU_SOURCE"
ccopt="$ccopt -maltivec -D_GNU_SOURCE -DOBSCURED_OPT"
else
cc=cc
ccopt="$ccopt -O -D_GNU_SOURCE -fPIC"
fi
lpath=$mupdf/build/release
./b -O src:$h -r -O ccopt:"$ccopt" -O cc:"$cc" \
-O "mupdflibpath:$lpath" \
-O "libs:$libs" \
$* $targets