2019-06-14 14:48:59 +00:00
|
|
|
#!/bin/bash -ex
|
2019-06-13 13:28:38 +00:00
|
|
|
|
|
|
|
# This is used invoked from
|
|
|
|
# https://github.com/google/oss-fuzz/blob/master/projects/qpdf/build.sh
|
|
|
|
|
|
|
|
# It should be run from the top level directory of a clean checkout of
|
2020-10-16 15:17:42 +00:00
|
|
|
# qpdf. It is also exercised in ../build-scripts/build-fuzzer
|
2019-06-13 13:28:38 +00:00
|
|
|
|
2019-06-14 14:48:59 +00:00
|
|
|
if [[ $GITHUB_FORK != "" ]]; then
|
|
|
|
git remote add fork https://github.com/$GITHUB_FORK/qpdf
|
|
|
|
git fetch fork --depth=1
|
|
|
|
CUR_BRANCH=$(git rev-parse --abbrev-ref @)
|
|
|
|
if [[ $GITHUB_BRANCH == "" ]]; then
|
|
|
|
GITHUB_BRANCH=$CUR_BRANCH
|
|
|
|
fi
|
|
|
|
if [[ $GITHUB_BRANCH == $CUR_BRANCH ]]; then
|
|
|
|
git reset --hard fork/$CUR_BRANCH
|
|
|
|
else
|
|
|
|
git branch -f $GITHUB_BRANCH fork/$GITHUB_BRANCH
|
|
|
|
git checkout $GITHUB_BRANCH
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2024-06-18 15:00:44 +00:00
|
|
|
for future in ON OFF; do
|
|
|
|
rm -rf build
|
|
|
|
env CMAKE_PREFIX_PATH=$WORK LDFLAGS="-L$WORK/lib -lpthread" \
|
|
|
|
cmake -S . -B build \
|
|
|
|
-DOSS_FUZZ=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug \
|
|
|
|
-DUSE_IMPLICIT_CRYPTO=OFF -DREQUIRE_CRYPTO_NATIVE=ON \
|
|
|
|
-DFUTURE=$future
|
|
|
|
cmake --build build -j$(nproc) --target fuzzers
|
|
|
|
cmake --install build --component fuzz
|
|
|
|
if [[ $future == ON ]]; then
|
|
|
|
pushd $OUT
|
2024-06-21 16:38:19 +00:00
|
|
|
for i in *_fuzzer*; do mv $i future_$i; done
|
2024-06-18 15:00:44 +00:00
|
|
|
popd
|
|
|
|
fi
|
|
|
|
done
|