xref: /freebsd/contrib/libfido2/src/diff_exports.sh (revision f81cdf24ba5436367377f7c8e8f51f6df2a75ca7)
1#!/bin/sh -u
2
3# Copyright (c) 2018 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
8for f in export.gnu export.llvm export.msvc; do
9	if [ ! -f "${f}" ]; then
10		exit 1
11	fi
12done
13
14TMPDIR="$(mktemp -d)"
15GNU="${TMPDIR}/gnu"
16LLVM="${TMPDIR}/llvm"
17MSVC="${TMPDIR}/msvc"
18
19awk '/^[^*{}]+;$/' export.gnu | tr -d '\t;' | sort > "${GNU}"
20sed 's/^_//' export.llvm | sort > "${LLVM}"
21grep -v '^EXPORTS$' export.msvc | sort > "${MSVC}"
22diff -u "${GNU}" "${LLVM}" && diff -u "${MSVC}" "${LLVM}"
23ERROR=$?
24rm "${GNU}" "${LLVM}" "${MSVC}"
25rmdir "${TMPDIR}"
26
27exit ${ERROR}
28