1#!/bin/bash -eu 2# Copyright 2021 Google LLC 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 18unset CPP 19unset CXX 20 21git apply --ignore-space-change --ignore-whitespace $SRC/patches.diff 22 23# Download apr and place in httpd srclib folder. Apr-2.0 includes apr-utils 24svn checkout https://svn.apache.org/repos/asf/apr/apr/trunk/ srclib/apr 25 26# Build httpd 27./buildconf 28./configure --with-included-apr --enable-pool-debug 29make 30 31# Build the fuzzers 32for fuzzname in utils parse tokenize addr_parse uri request preq; do 33 $CC $CFLAGS $LIB_FUZZING_ENGINE \ 34 -I$SRC/fuzz-headers/lang/c -I./include -I./os/unix \ 35 -I./srclib/apr/include -I./srclib/apr-util/include/ \ 36 $SRC/fuzz_${fuzzname}.c -o $OUT/fuzz_${fuzzname} \ 37 ./modules.o buildmark.o \ 38 -Wl,--start-group ./server/.libs/libmain.a \ 39 ./modules/core/.libs/libmod_so.a \ 40 ./modules/http/.libs/libmod_http.a \ 41 ./server/mpm/event/.libs/libevent.a \ 42 ./os/unix/.libs/libos.a \ 43 ./srclib/apr/.libs/libapr-2.a \ 44 -Wl,--end-group -luuid -lpcre -lcrypt -lexpat 45done 46