libphonenumber: upgrade build to base builder (#6480)

* libphonenumber: upgrade build to base builder

* libphonenumber: fix typo

* clean up libphonenumber build

* libphonenumber: minor cleanup

* libphonenumber: last fix
This commit is contained in:
DavidKorczynski 2021-09-18 12:15:19 +01:00 committed by GitHub
parent f369375419
commit eab2c6c21c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 19 deletions

View File

@ -14,17 +14,28 @@
#
################################################################################
# Using Ubuntu 16.04 because of breakage on Ubuntu 20.04.
# See https://github.com/google/oss-fuzz/issues/6291 for more details.
FROM gcr.io/oss-fuzz-base/base-builder:xenial
# Delete line above and uncomment line below to upgrade to 20.04.
# FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y autoconf automake libtool g++ cmake-curses-gui libgtest-dev libre2-dev libicu-dev libboost-dev libboost-thread-dev libboost-system-dev binutils ninja-build liblzma-dev libz-dev pkg-config wget openjdk-8-jdk
FROM gcr.io/oss-fuzz-base/base-builder
WORKDIR $SRC/
RUN apt-get update && apt-get install -y autoconf automake \
cmake cmake-curses-gui libre2-dev \
libicu-dev libboost-dev libboost-thread-dev libboost-system-dev \
libgflags-dev libgoogle-glog-dev libssl-dev \
protobuf-compiler libtool wget default-jre icu-devtools
RUN apt-get install -y libgtest-dev && \
cd /usr/src/googletest/googletest && \
mkdir build && \
cd build && \
cmake .. && \
make && \
mkdir /usr/local/lib/googletest && \
ln -sn /usr/local/lib/googletest/libgtest.a /usr/lib/libgtest.a && \
ln -sn /usr/local/lib/googletest/libgtest_main.a /usr/lib/libgtest_main.a && \
rm /lib/x86_64-linux-gnu/libgtest.a && \
ln -sn /usr/local/lib/googletest/libgtest.a /lib/x86_64-linux-gnu/libgtest.a
RUN wget https://github.com/unicode-org/icu/releases/download/release-66-rc/icu4c-66rc-src.tgz && \
tar xzvf icu4c-66rc-src.tgz
RUN git clone https://github.com/google/libphonenumber
RUN wget https://github.com/unicode-org/icu/releases/download/release-55-2/icu4c-55_2-src.tgz && tar xzvf icu4c-55_2-src.tgz
COPY build.sh $SRC/
COPY phonefuzz.cc $SRC/
WORKDIR $SRC/

View File

@ -68,20 +68,18 @@ sed -i 's/set (BUILD_SHARED_LIB true)/set (BUILD_SHARED_LIB false)/g' CMakeLists
sed -i 's/list (APPEND CMAKE_C_FLAGS "-pthread")/string (APPEND CMAKE_C_FLAGS " -pthread")/g' CMakeLists.txt
mkdir build && cd build
cmake -DUSE_BOOST=OFF -DBUILD_GEOCODER=OFF -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
cmake -DUSE_BOOST=OFF -DBUILD_GEOCODER=OFF \
-DPROTOBUF_LIB="/src/protobuf/src/.libs/libprotobuf.a" \
-DBUILD_STATIC_LIB=ON \
-DICU_UC_INCLUDE_DIR=$SRC/icu/source/comon \
-DICU_UC_LIB=$DEPS_PATH/lib/libicuuc.a \
-DICU_I18N_INCLUDE_DIR=$SRC/icu/source/i18n/ \
-DICU_I18N_LIB=$DEPS_PATH/lib/libicui18n.a ../
-DICU_I18N_LIB=$DEPS_PATH/lib/libicui18n.a \
../
make
cd ../
# Build our fuzzer
cp $SRC/*fuzz.cc .
$CXX -I/src/libphonenumber/cpp/src $CXXFLAGS -o phonefuzz.o -c phonefuzz.cc
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE phonefuzz.o -o phonefuzz \
build/libphonenumber.a $SRC/protobuf/src/.libs/libprotobuf.a \
$CXX -I$SRC/libphonenumber/cpp/src $CXXFLAGS -o phonefuzz.o -c $SRC/phonefuzz.cc
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE phonefuzz.o -o $OUT/phonefuzz \
./libphonenumber.a $SRC/protobuf/src/.libs/libprotobuf.a \
$DEPS_PATH/lib/libicu.a -lpthread
cp phonefuzz $OUT/