GDAL: enable PDF/poppler support (#2688)

This commit is contained in:
Even Rouault 2019-08-12 21:52:31 +02:00 committed by jonathanmetzman
parent 1d86ee21f5
commit 5b8dcb5d94
2 changed files with 41 additions and 6 deletions

View File

@ -18,14 +18,15 @@ FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER even.rouault@spatialys.com
RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y make autoconf automake libtool g++ curl cmake sqlite3
apt-get install -y make autoconf automake libtool g++ curl cmake sqlite3 pkg-config
RUN git clone --depth 1 https://github.com/OSGeo/gdal gdal
RUN git clone --depth 1 https://github.com/OSGeo/proj.4 gdal/proj
RUN git clone --depth 1 https://github.com/curl/curl.git gdal/curl
COPY build.sh NC4_put_propattr_leak_fix.patch libnetcdf_fix_undefined_left_shift_in_ncx_get_size_t.patch $SRC/
COPY NC4_put_propattr_leak_fix.patch libnetcdf_fix_undefined_left_shift_in_ncx_get_size_t.patch $SRC/
RUN curl ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.4.1.1.tar.gz > gdal/netcdf-4.4.1.1.tar.gz && \
cd gdal && \
@ -36,5 +37,9 @@ RUN curl ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4.4.1.1.tar.gz > gdal/netc
patch -p0 < $SRC/libnetcdf_fix_undefined_left_shift_in_ncx_get_size_t.patch && \
cd ../..
RUN git clone --depth 1 https://anongit.freedesktop.org/git/poppler/poppler.git gdal/poppler
COPY build.sh $SRC/
WORKDIR gdal

View File

@ -18,18 +18,46 @@
I386_PACKAGES="zlib1g-dev:i386 libexpat-dev:i386 liblzma-dev:i386 \
libxerces-c-dev:i386 libpng12-dev:i386 libgif-dev:i386 \
libwebp-dev:i386 libicu-dev:i386 libnetcdf-dev:i386 \
libssl-dev:i386 libsqlite3-dev:i386"
libssl-dev:i386 libsqlite3-dev:i386 \
libfreetype6-dev:i386 libfontconfig1-dev:i386"
X64_PACKAGES="zlib1g-dev libexpat-dev liblzma-dev \
libxerces-c-dev libpng12-dev libgif-dev \
libwebp-dev libicu-dev libnetcdf-dev \
libssl-dev libsqlite3-dev"
libssl-dev libsqlite3-dev \
libfreetype6-dev libfontconfig1-dev"
if [ "$ARCHITECTURE" = "i386" ]; then
apt-get install -y $I386_PACKAGES automake libtool autoconf
apt-get install -y $I386_PACKAGES
else
apt-get install -y $X64_PACKAGES
fi
# build poppler
cd poppler
mkdir -p build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$SRC/install \
-DCMAKE_BUILD_TYPE=debug \
-DENABLE_UNSTABLE_API_ABI_HEADERS=ON \
-DBUILD_SHARED_LIBS=OFF \
-DFONT_CONFIGURATION=generic \
-DENABLE_CPP=OFF \
-DENABLE_LIBOPENJPEG=none \
-DENABLE_CMS=none \
-DENABLE_LIBPNG=OFF \
-DENABLE_LIBTIFF=OFF \
-DENABLE_GLIB=OFF \
-DENABLE_LIBCURL=OFF \
-DENABLE_QT5=OFF \
-DENABLE_UTILS=OFF \
-DWITH_Cairo=OFF \
-DWITH_NSS3=OFF
make clean -s
make -j$(nproc) -s
make install
cd ../..
# build libproj.a (proj master required)
cd proj
@ -62,7 +90,7 @@ cd ../..
# build gdal
cd gdal
export LDFLAGS=${CXXFLAGS}
./configure --without-libtool --with-liblzma --with-expat --with-sqlite3 --with-xerces --with-webp --with-netcdf=$SRC/install --with-curl=$SRC/install/bin/curl-config --without-hdf5 --with-jpeg=internal --with-proj=$SRC/install
PKG_CONFIG_PATH=$SRC/install/lib/pkgconfig ./configure --without-libtool --with-liblzma --with-expat --with-sqlite3 --with-xerces --with-webp --with-netcdf=$SRC/install --with-curl=$SRC/install/bin/curl-config --without-hdf5 --with-jpeg=internal --with-proj=$SRC/install --with-poppler
make clean -s
make -j$(nproc) -s static-lib
@ -73,6 +101,8 @@ export EXTRA_LIBS="$EXTRA_LIBS -lxerces-c -licuuc -licudata"
export EXTRA_LIBS="$EXTRA_LIBS -L$SRC/install/lib -lnetcdf -lhdf5_serial_hl -lhdf5_serial -lsz -laec -lz"
# curl related
export EXTRA_LIBS="$EXTRA_LIBS -L$SRC/install/lib -lcurl -lssl -lcrypto -lz"
# poppler related
export EXTRA_LIBS="$EXTRA_LIBS -L$SRC/install/lib -lpoppler -lfreetype -lfontconfig"
export EXTRA_LIBS="$EXTRA_LIBS -Wl,-Bdynamic -ldl -lpthread"
./fuzzers/build_google_oss_fuzzers.sh
./fuzzers/build_seed_corpus.sh