2019-02-05 23:45:03 +00:00
|
|
|
#!/bin/bash -eu
|
|
|
|
# Copyright 2019 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.
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2021-06-22 11:54:18 +00:00
|
|
|
cd $SRC
|
|
|
|
tar xzf gperf*.tar.gz && rm -f gperf*.tar.gz
|
|
|
|
cd gperf*
|
|
|
|
FUZZ_CFLAGS="${CFLAGS}"
|
|
|
|
FUZZ_CXXFLAGS="${CXXFLAGS}"
|
|
|
|
unset CFLAGS
|
|
|
|
unset CXXFLAGS
|
|
|
|
# gperf is a code generator, so no need to sanitize it
|
|
|
|
./configure --prefix=/usr
|
|
|
|
make -j$(nproc) install
|
|
|
|
export CFLAGS="${FUZZ_CFLAGS}"
|
|
|
|
export CXXFLAGS="${FUZZ_CXXFLAGS}"
|
|
|
|
|
|
|
|
|
2019-02-05 23:45:03 +00:00
|
|
|
cd $SRC
|
|
|
|
cd extra-cmake-modules
|
|
|
|
cmake .
|
|
|
|
make install
|
|
|
|
|
|
|
|
cd $SRC
|
|
|
|
cd qtbase
|
2019-09-26 16:17:32 +00:00
|
|
|
# add the flags to Qt build too
|
|
|
|
sed -i -e "s/QMAKE_CXXFLAGS += -stdlib=libc++/QMAKE_CXXFLAGS += -stdlib=libc++ $CXXFLAGS\nQMAKE_CFLAGS += $CFLAGS/g" mkspecs/linux-clang-libc++/qmake.conf
|
2019-02-05 23:45:03 +00:00
|
|
|
sed -i -e "s/QMAKE_LFLAGS += -stdlib=libc++/QMAKE_LFLAGS += -stdlib=libc++ -lpthread $CXXFLAGS/g" mkspecs/linux-clang-libc++/qmake.conf
|
2019-09-26 16:17:32 +00:00
|
|
|
# make qmake compile faster
|
|
|
|
sed -i -e "s/MAKE\")/MAKE\" -j$(nproc))/g" configure
|
2022-09-09 19:12:13 +00:00
|
|
|
./configure --zlib=qt --glib=no --libpng=qt -opensource -confirm-license -static -no-opengl -no-icu -platform linux-clang-libc++ -v
|
2019-02-05 23:45:03 +00:00
|
|
|
cd src
|
|
|
|
../bin/qmake -o Makefile src.pro
|
2019-12-12 23:40:19 +00:00
|
|
|
make sub-corelib sub-rcc -j$(nproc)
|
2019-02-05 23:45:03 +00:00
|
|
|
|
|
|
|
cd $SRC
|
|
|
|
cd kcodecs
|
2022-10-07 22:38:19 +00:00
|
|
|
rm -rf poqm
|
2019-02-05 23:45:03 +00:00
|
|
|
cmake . -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$SRC/qtbase
|
|
|
|
make -j$(nproc) VERBOSE=1
|
|
|
|
|
|
|
|
|
|
|
|
$CXX $CXXFLAGS -fPIC -std=c++11 $SRC/kcodecs_fuzzer.cc -o $OUT/kcodecs_fuzzer \
|
|
|
|
-I $SRC/qtbase/include/QtCore/ -I $SRC/qtbase/include/ -I $SRC/kcodecs/src \
|
|
|
|
-I $SRC/kcodecs/src/probers -L $SRC/qtbase/lib -L $SRC/kcodecs/lib \
|
2019-05-01 15:09:55 +00:00
|
|
|
-lQt5Core -lm -lqtpcre2 -ldl -lpthread $LIB_FUZZING_ENGINE -lKF5Codecs
|
2019-02-05 23:45:03 +00:00
|
|
|
|
|
|
|
zip -qr $OUT/kcodecs_fuzzer_seed_corpus.zip $SRC/uchardet/test/ $SRC/kcodecs/autotests/data
|