1 1.1.1.2 christos #!/bin/sh -eux 2 1.1.1.2 christos 3 1.1 christos # Copyright (c) 2019 Yubico AB. All rights reserved. 4 1.1 christos # Use of this source code is governed by a BSD-style 5 1.1 christos # license that can be found in the LICENSE file. 6 1.1 christos 7 1.1.1.2 christos LIBCBOR="$1" 8 1.1.1.2 christos LIBFIDO2="$2" 9 1.1 christos 10 1.1.1.2 christos CC="${CC:-clang}" 11 1.1.1.2 christos CXX="${CXX:-clang++}" 12 1.1.1.2 christos PKG_CONFIG_PATH="${PKG_CONFIG_PATH:-${LIBCBOR}/install/lib/pkgconfig}" 13 1.1 christos export CC PKG_CONFIG_PATH 14 1.1 christos 15 1.1 christos # Clean up. 16 1.1.1.2 christos rm -rf "${LIBCBOR}/build" "${LIBCBOR}/install" "${LIBFIDO2}/build" 17 1.1 christos 18 1.1 christos # Patch, build, and install libcbor. 19 1.1.1.2 christos (cd "${LIBCBOR}" && patch -N -l -s -p0 < "${LIBFIDO2}/fuzz/README") || true 20 1.1.1.2 christos mkdir "${LIBCBOR}/build" "${LIBCBOR}/install" 21 1.1.1.3 christos (cd "${LIBCBOR}/build" && cmake -DBUILD_SHARED_LIBS=ON \ 22 1.1.1.3 christos -DCMAKE_INSTALL_PREFIX="${LIBCBOR}/install" ..) 23 1.1.1.3 christos make -C "${LIBCBOR}/build" VERBOSE=1 all install 24 1.1 christos 25 1.1 christos # Build libfido2. 26 1.1.1.2 christos mkdir -p "${LIBFIDO2}/build" 27 1.1.1.2 christos export CFLAGS="-fprofile-instr-generate -fcoverage-mapping" 28 1.1.1.2 christos export LDFLAGS="${CFLAGS}" 29 1.1.1.3 christos (cd "${LIBFIDO2}/build" && cmake -DFUZZ=ON -DLIBFUZZER=ON \ 30 1.1.1.2 christos -DCMAKE_BUILD_TYPE=Debug ..) 31 1.1.1.2 christos make -C "${LIBFIDO2}/build" 32