aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Bart Van Assche <bvanassche@users.noreply.github.com>2021-08-30 15:48:15 -0700
committerGravatar GitHub <noreply@github.com>2021-08-30 15:48:15 -0700
commit2f433a1f54352f22523a9a5098919daffc7d881b (patch)
tree2df71b81275c668a6de7e884ea500ee53339a212
parentb556efce05ebbc2c383471a259f6797940c903b3 (diff)
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.
-rw-r--r--projects/net-snmp/Dockerfile4
-rwxr-xr-xprojects/net-snmp/build.sh23
2 files changed, 5 insertions, 22 deletions
diff --git a/projects/net-snmp/Dockerfile b/projects/net-snmp/Dockerfile
index 1893d9bf..324a732b 100644
--- a/projects/net-snmp/Dockerfile
+++ b/projects/net-snmp/Dockerfile
@@ -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/
diff --git a/projects/net-snmp/build.sh b/projects/net-snmp/build.sh
index 28bd4e4f..3753b763 100755
--- a/projects/net-snmp/build.sh
+++ b/projects/net-snmp/build.sh
@@ -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