set -x
MAGICKINCLUDE="appdir/usr/include/ImageMagick-7"
-MAGICKSTATICLIBS="appdir/usr/lib/libMagick++-7.Q16.a appdir/usr/lib/libMagickWand-7.Q16.a appdir/usr/lib/libMagickCore-7.Q16.a libfuzzer/libFuzzer.a"
+MAGICKFUZZERLIBS="-Lappdir/usr/lib -lz -lpng -lfontconfig -lxcb -lX11 -lXext -lbz2 -ljpeg -ljbig -lIlmImf -ldjvulibre -ltiff -llqr-1 -lwmf -lwmflite -lraqm -lxml2 -llzma -llcms2 -lpthread -lfreetype -lMagick++-7.Q16 -lMagickWand-7.Q16 -lMagickCore-7.Q16 libfuzzer/libFuzzer.a"
# Checkout and build libFuzzer
svn co http://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/fuzzer libfuzzer
clang++ -std=c++11 -I$MAGICKINCLUDE "Magick++/fuzz/encoder_list.cc" \
-o "encoder_list" \
- -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 $MAGICKSTATICLIBS -lpthread -lfreetype
+ -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 $MAGICKFUZZERLIBS
for f in Magick++/fuzz/*_fuzzer.cc; do
fuzzer=$(basename "$f" _fuzzer.cc)
fi
clang++ -std=c++11 -I$MAGICKINCLUDE \
"$f" -o "${fuzzer}_fuzzer" \
- -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 $MAGICKSTATICLIBS -lpthread-lfreetype
+ -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 $MAGICKFUZZERLIBS
done
-for encoder in $("./encoder_list"); do
- clang++ -std=c++11 -I$MAGICKINCLUDE \
- "Magick++/fuzz/encoder_fuzzer.cc" -o "encoder_${encoder,,}_fuzzer" \
- -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 \
- "-DFUZZ_IMAGEMAGICK_ENCODER=$encoder" $MAGICKSTATICLIBS -lpthread -lfreetype
-done
+# Build one encoder to confirm it works
+clang++ -std=c++11 -I$MAGICKINCLUDE \
+ "Magick++/fuzz/encoder_fuzzer.cc" -o "encoder_wmf_fuzzer" \
+ -DMAGICKCORE_HDRI_ENABLE=0 -DMAGICKCORE_QUANTUM_DEPTH=16 \
+ "-DFUZZ_IMAGEMAGICK_ENCODER=WMF" $MAGICKFUZZERLIBS