xref: /freebsd/contrib/libfido2/.actions/build-linux-openssl3-clang (revision a90b9d0159070121c221b966469c3e36d912bf82)
1#!/bin/sh -eux
2
3# Copyright (c) 2022 Yubico AB. All rights reserved.
4# Use of this source code is governed by a BSD-style
5# license that can be found in the LICENSE file.
6# SPDX-License-Identifier: BSD-2-Clause
7
8${CC} --version
9SCAN=scan-build${CC#clang}
10FAKEROOT="$(mktemp -d)"
11
12# Check exports.
13(cd src && ./diff_exports.sh)
14
15# Build and install OpenSSL 3.0.12.
16git clone --branch openssl-3.0.12 \
17	--depth=1 https://github.com/openssl/openssl
18cd openssl
19./Configure linux-x86_64-clang --prefix="${FAKEROOT}" \
20	--openssldir="${FAKEROOT}/openssl" --libdir=lib
21make install_sw
22cd ..
23
24# Build, analyze, and install libfido2.
25for T in Debug Release; do
26	mkdir build-$T
27	export PKG_CONFIG_PATH="${FAKEROOT}/lib/pkgconfig"
28	(cd build-$T && ${SCAN} --use-cc="${CC}" \
29		cmake -DCMAKE_BUILD_TYPE=$T ..)
30	${SCAN} --use-cc="${CC}" --status-bugs make -C build-$T
31	make -C build-$T regress
32	sudo make -C build-$T install
33done
34