2018-08-16 01:01:25 +03:00
|
|
|
#!/bin/bash
|
2016-09-01 16:07:01 +03:00
|
|
|
|
2018-08-16 01:01:25 +03:00
|
|
|
# Optionally get revision from cmd line
|
|
|
|
# Changelog: https://reviews.llvm.org/source/compiler-rt/history/compiler-rt/trunk/lib/fuzzer/
|
2019-04-18 11:28:29 +03:00
|
|
|
[ $1 ] && REVISION=$1 || REVISION=356365
|
2016-11-07 17:58:20 +03:00
|
|
|
|
2018-08-16 01:01:25 +03:00
|
|
|
mkdir tmp
|
2019-04-18 11:28:29 +03:00
|
|
|
svn co -qr $REVISION https://llvm.org/svn/llvm-project/compiler-rt/trunk tmp || exit
|
2018-08-16 01:01:25 +03:00
|
|
|
|
|
|
|
if [ $1 ]; then
|
|
|
|
# libFuzzer source files
|
|
|
|
CPPS=($(ls -rv tmp/lib/fuzzer/*.cpp))
|
|
|
|
CPPS=(${CPPS[@]##*/})
|
|
|
|
CPPS=(${CPPS[@]##FuzzerMain*}) # ignored
|
|
|
|
|
|
|
|
# Update SOURCES entries
|
|
|
|
sed -e "/^SOURCES/,/^]/ {/'/d}" -i moz.build
|
|
|
|
for CPP in ${CPPS[@]}; do sed -e "/^SOURCES/ a \\\t'${CPP}'," -i moz.build; done
|
|
|
|
|
|
|
|
# Remove previous files
|
|
|
|
rm *.{cpp,h,def}
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Copy files
|
|
|
|
cp tmp/lib/fuzzer/*.{cpp,h,def} .
|
2016-11-07 17:58:20 +03:00
|
|
|
|
|
|
|
# Remove the temporary directory
|
|
|
|
rm -Rf tmp/
|
2018-08-16 01:01:25 +03:00
|
|
|
|
|
|
|
[ $1 ] && echo "Updated libFuzzer to ${REVISION}"
|
|
|
|
|