• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -eu
2# Copyright 2016 Google Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16################################################################################
17
18# compile libxml2 from source so we can statically link
19DEPS=/deps
20mkdir ${DEPS}
21cd $SRC/libxml2
22./autogen.sh \
23    --without-debug \
24    --without-ftp \
25    --without-http \
26    --without-legacy \
27    --without-python
28make -j$(nproc)
29make install
30cp .libs/libxml2.a ${DEPS}/
31cd $SRC/libarchive
32
33sed -i 's/-Wall//g' ./CMakeLists.txt
34sed -i 's/-Werror//g' ./CMakeLists.txt
35
36mkdir build2
37cd build2
38cmake ../
39make
40
41# build seed
42cp $SRC/libarchive/contrib/oss-fuzz/corpus.zip\
43        $OUT/libarchive_fuzzer_seed_corpus.zip
44
45# build fuzzer(s)
46$CXX $CXXFLAGS -I../libarchive \
47    $SRC/libarchive_fuzzer.cc -o $OUT/libarchive_fuzzer \
48    $LIB_FUZZING_ENGINE ./libarchive/libarchive.a \
49    -lcrypto -lacl -llzma -llz4 -lbz2 -lz ${DEPS}/libxml2.a
50