xref: /freebsd/contrib/libfido2/src/diff_exports.sh (revision 2ccfa855b2fc331819953e3de1b1c15ce5b95a7e)
10afa8e06SEd Maste#!/bin/sh -u
20afa8e06SEd Maste
30afa8e06SEd Maste# Copyright (c) 2018 Yubico AB. All rights reserved.
40afa8e06SEd Maste# Use of this source code is governed by a BSD-style
50afa8e06SEd Maste# license that can be found in the LICENSE file.
6*2ccfa855SEd Maste# SPDX-License-Identifier: BSD-2-Clause
70afa8e06SEd Maste
80afa8e06SEd Mastefor f in export.gnu export.llvm export.msvc; do
90afa8e06SEd Maste	if [ ! -f "${f}" ]; then
100afa8e06SEd Maste		exit 1
110afa8e06SEd Maste	fi
120afa8e06SEd Mastedone
130afa8e06SEd Maste
140afa8e06SEd MasteTMPDIR="$(mktemp -d)"
150afa8e06SEd MasteGNU="${TMPDIR}/gnu"
160afa8e06SEd MasteLLVM="${TMPDIR}/llvm"
170afa8e06SEd MasteMSVC="${TMPDIR}/msvc"
180afa8e06SEd Maste
190afa8e06SEd Masteawk '/^[^*{}]+;$/' export.gnu | tr -d '\t;' | sort > "${GNU}"
200afa8e06SEd Mastesed 's/^_//' export.llvm | sort > "${LLVM}"
210afa8e06SEd Mastegrep -v '^EXPORTS$' export.msvc | sort > "${MSVC}"
220afa8e06SEd Mastediff -u "${GNU}" "${LLVM}" && diff -u "${MSVC}" "${LLVM}"
230afa8e06SEd MasteERROR=$?
240afa8e06SEd Masterm "${GNU}" "${LLVM}" "${MSVC}"
250afa8e06SEd Mastermdir "${TMPDIR}"
260afa8e06SEd Maste
270afa8e06SEd Masteexit ${ERROR}
28