net-snmp: Simplify the build scripts (#6231)

Use the Net-SNMP continuous integration script ci/install.sh to install
development packages. Use the Net-SNMP script ci/build.sh to compile the
Net-SNMP source code.
This commit is contained in:
Bart Van Assche 2021-08-30 15:48:15 -07:00 committed by GitHub
parent b556efce05
commit 2f433a1f54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 22 deletions

View File

@ -15,7 +15,7 @@
################################################################################
FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y pkg-config make autoconf libtool libssl-dev libnl-genl-3-dev libnl-3-dev libnl-route-3-dev pkg-config
RUN git clone https://github.com/net-snmp/net-snmp net-snmp
RUN git clone -q --depth 1 https://github.com/net-snmp/net-snmp net-snmp
RUN net-snmp/ci/install.sh
WORKDIR net-snmp
COPY build.sh $SRC/

View File

@ -15,23 +15,6 @@
#
################################################################################
sed -i 's/#define NETSNMP_SELECT_TIMEVAL ${arg_type}/#define NETSNMP_SELECT_TIMEVAL struct timeval/g' ./configure
rm testing/fuzzing/build.sh && echo "echo 0" >> testing/fuzzing/build.sh && chmod +x ./testing/fuzzing/build.sh
./configure --with-openssl=/usr --with-defaults --with-logfile="/dev/null" --with-persistent-directory="/dev/null"
# net-snmp build is not parallel-make safe; do not add -j
make
# build fuzzers and link statically
fuzzers=$(find ./testing/fuzzing -name "*_fuzzer.c")
suffix="_fuzzer\.c"
for fuzzer in ${fuzzers}; do
fuzzname=$(basename -- ${fuzzer%$suffix})
$CC $CFLAGS -c -Iinclude -Iagent/mibgroup/agentx ./testing/fuzzing/${fuzzname}_fuzzer.c -o $WORK/${fuzzname}_fuzzer.o
$CXX $CXXFLAGS $WORK/${fuzzname}_fuzzer.o \
$LIB_FUZZING_ENGINE snmplib/.libs/libnetsnmp.a \
agent/.libs/libnetsnmpagent.a \
-Wl,-Bstatic -lcrypto -Wl,-Bdynamic -lm \
-o $OUT/${fuzzname}_fuzzer
done
# Configure and build Net-SNMP and the fuzzers.
export CC CXX CFLAGS CXXFLAGS SRC WORK OUT LIB_FUZZING_ENGINE
ci/build.sh