• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#      http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13#
14################################################################################
15#https://github.com/linux-on-ibm-z/docs/wiki/Building-Xerces
16set -e
17cd $SRC/xerces-c
18./reconf
19./configure --disable-shared
20make -j
21
22cd $SRC
23$CXX $CXXFLAGS $LIB_FUZZING_ENGINE -std=c++11 \
24        -I. -Ixerces-c/src \
25        xerces_fuzz_common.cpp parse_target.cpp -o $OUT/parse_target \
26        xerces-c/src/.libs/libxerces-c.a
27
28if [[ $CFLAGS != *sanitize=memory* ]]; then
29	rm -rf genfiles && mkdir genfiles && LPM/external.protobuf/bin/protoc xml.proto --cpp_out=genfiles
30
31	$CXX $CXXFLAGS $LIB_FUZZING_ENGINE -std=c++11 \
32	        -I. -I xerces-c/src -Ixerces-c/build/src genfiles/xml.pb.cc xmlProtoConverter.cpp xerces_fuzz_common.cpp parse_target_proto.cpp \
33	        -I libprotobuf-mutator/ \
34	        -I genfiles \
35	        -I LPM/external.protobuf/include \
36	        -o $OUT/parse_target_proto xerces-c/src/.libs/libxerces-c.a \
37	        LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
38	        LPM/src/libprotobuf-mutator.a \
39	        LPM/external.protobuf/lib/libprotobuf.a
40fi
41