Skip to content

Commit

Permalink
Update kcodecs to use KF6 and Qt6 (#12145)
Browse files Browse the repository at this point in the history
  • Loading branch information
tsdgeos authored Jul 4, 2024
1 parent 3d3331a commit 4c5a853
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
8 changes: 4 additions & 4 deletions projects/kcodecs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
################################################################################

FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get install --yes cmake
RUN apt-get update && apt-get install --yes cmake ninja-build
RUN curl -L http://ftp.gnu.org/pub/gnu/gperf/gperf-3.1.tar.gz -O
RUN git clone --depth 1 --branch=5.15 git://code.qt.io/qt/qtbase.git
RUN git clone --depth 1 -b kf5 https://invent.kde.org/frameworks/kcodecs.git
RUN git clone --depth 1 -b kf5 https://invent.kde.org/frameworks/extra-cmake-modules.git
RUN git clone --depth 1 --branch=dev git://code.qt.io/qt/qtbase.git
RUN git clone --depth 1 -b master https://invent.kde.org/frameworks/extra-cmake-modules.git
RUN git clone --depth 1 -b master https://invent.kde.org/frameworks/kcodecs.git
RUN git clone --depth 1 https://gitlab.freedesktop.org/uchardet/uchardet.git
COPY build.sh $SRC
COPY kcodecs_fuzzer.cc $SRC
Expand Down
25 changes: 8 additions & 17 deletions projects/kcodecs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,19 @@ make install

cd $SRC
cd qtbase
# add the flags to Qt build too
# Use ~ as sed delimiters instead of the usual "/" because C(XX)FLAGS may
# contain paths with slashes.
sed -i -e "s~QMAKE_CXXFLAGS += -stdlib=libc++~QMAKE_CXXFLAGS += -stdlib=libc++ $CXXFLAGS\nQMAKE_CFLAGS += $CFLAGS~g" mkspecs/linux-clang-libc++/qmake.conf
sed -i -e "s~QMAKE_LFLAGS += -stdlib=libc++~QMAKE_LFLAGS += -stdlib=libc++ -lpthread $CXXFLAGS~g" mkspecs/linux-clang-libc++/qmake.conf
# make qmake compile faster
sed -i -e "s/MAKE\")/MAKE\" -j$(nproc))/g" configure
./configure --zlib=qt --glib=no --libpng=qt -opensource -confirm-license -static -no-opengl -no-icu -platform linux-clang-libc++ -v
cd src
../bin/qmake -o Makefile src.pro
make sub-corelib sub-rcc -j$(nproc)
./configure -no-glib -qt-libpng -qt-pcre -opensource -confirm-license -static -no-opengl -no-icu -platform linux-clang-libc++ -debug -prefix /usr -no-feature-gui -no-feature-sql -no-feature-network -no-feature-xml -no-feature-dbus -no-feature-printsupport
cmake --build . --parallel $(nproc)
cmake --install .

cd $SRC
cd kcodecs
rm -rf poqm
cmake . -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$SRC/qtbase
cmake . -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug
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 \
-lQt5Core -lm -lqtpcre2 -ldl -lpthread $LIB_FUZZING_ENGINE -lKF5Codecs
$CXX $CXXFLAGS -fPIC -std=c++17 $SRC/kcodecs_fuzzer.cc -o $OUT/kcodecs_fuzzer \
-I /usr/include/QtCore/ -I $SRC/kcodecs/src \
-I $SRC/kcodecs/src/probers -L $SRC/kcodecs/lib \
-lQt6Core -lm -lQt6BundledPcre2 -lQt6BundledZLIB -ldl -lpthread $LIB_FUZZING_ENGINE -lKF6Codecs

zip -qr $OUT/kcodecs_fuzzer_seed_corpus.zip $SRC/uchardet/test/ $SRC/kcodecs/autotests/data

0 comments on commit 4c5a853

Please sign in to comment.