diff options
author | Bhargava Shastry <bshas3@gmail.com> | 2018-10-19 22:54:15 +0200 |
---|---|---|
committer | jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com> | 2018-10-19 13:54:15 -0700 |
commit | c6a08db58c359e83f63c592f3103caf71bcbf55d (patch) | |
tree | 69a76f292f0fab2a2f7e917536d160ef6782255a /projects/bzip2/build.sh | |
parent | 36d4c69e69fc6c5fd3c3888772939e5d15e401aa (diff) |
bzip2: Add bzip2 to oss-fuzz (#1887)
Diffstat (limited to 'projects/bzip2/build.sh')
-rwxr-xr-x | projects/bzip2/build.sh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/projects/bzip2/build.sh b/projects/bzip2/build.sh new file mode 100755 index 00000000..0cf248e2 --- /dev/null +++ b/projects/bzip2/build.sh @@ -0,0 +1,37 @@ +#!/bin/bash -eu +# Copyright 2018 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +tar xzf bzip2-*.tar.gz && rm -f bzip2-*.tar.gz +cd bzip2-* +SRCL=(blocksort.o huffman.o crctable.o randtable.o compress.o decompress.o bzlib.o) + +for source in ${SRCL[@]}; do + name=$(basename $source .o) + $CC $CFLAGS -c ${name}.c +done +rm -f libbz2.a +ar cq libbz2.a ${SRCL[@]} && ranlib libbz2.a + +# build fuzzers +for file in $SRC/*.c; +do + name=$(basename $file .c) + $CC $CFLAGS -c -I . $SRC/${name}.c -o $OUT/${name}.o + $CXX $CXXFLAGS -o $OUT/${name} $OUT/${name}.o -lFuzzingEngine \ + libbz2.a + rm -f $OUT/${name}.o +done |