Debian Codegraph @

fuzzing/scripts/oss-fuzz-build.sh

raw
1 #!/bin/bash -eu
2 #
3 # Copyright (c) 2023 Cedalo GmbH
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Eclipse Public License 2.0
7 # and Eclipse Distribution License v1.0 which accompany this distribution.
8 #
9 # The Eclipse Public License is available at
10 # https://www.eclipse.org/legal/epl-2.0/
11 # and the Eclipse Distribution License is available at
12 # http://www.eclipse.org/org/documents/edl-v10.php.
13 #
14 # SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
15 #
16 # Contributors:
17 # Roger Light - initial implementation and documentation.
18
19 export CC="${CC:-clang}"
20 export CXX="${CXX:-clang++}"
21 export CFLAGS
22 export CXXFLAGS
23 export LDFLAGS
24
25 # Build direct broker dependency - cJSON
26 # Note that other dependencies, i.e. sqlite are not yet built because they are
27 # only used by plugins and not currently otherwise used.
28 cd ${SRC}/cJSON
29 cmake \
30 -DBUILD_SHARED_LIBS=OFF \
31 -DCMAKE_C_FLAGS=-fPIC \
32 -DENABLE_CJSON_TEST=OFF \
33 .
34 make -j $(nproc)
35 make install
36
37 # Build broker and library static libraries
38 cd ${SRC}/mosquitto
39 make \
40 WITH_STATIC_LIBRARIES=yes \
41 WITH_DOCS=no \
42 WITH_FUZZING=yes \
43 WITH_EDITLINE=no \
44 WITH_HTTP_API=no \
45 -j $(nproc)