xref: /freebsd/contrib/libfido2/src/diff_exports.sh (revision 0afa8e065e14bb8fd338d75690e0238c00167d40)
1*0afa8e06SEd Maste#!/bin/sh -u
2*0afa8e06SEd Maste
3*0afa8e06SEd Maste# Copyright (c) 2018 Yubico AB. All rights reserved.
4*0afa8e06SEd Maste# Use of this source code is governed by a BSD-style
5*0afa8e06SEd Maste# license that can be found in the LICENSE file.
6*0afa8e06SEd Maste
7*0afa8e06SEd Mastefor f in export.gnu export.llvm export.msvc; do
8*0afa8e06SEd Maste	if [ ! -f "${f}" ]; then
9*0afa8e06SEd Maste		exit 1
10*0afa8e06SEd Maste	fi
11*0afa8e06SEd Mastedone
12*0afa8e06SEd Maste
13*0afa8e06SEd MasteTMPDIR="$(mktemp -d)"
14*0afa8e06SEd MasteGNU="${TMPDIR}/gnu"
15*0afa8e06SEd MasteLLVM="${TMPDIR}/llvm"
16*0afa8e06SEd MasteMSVC="${TMPDIR}/msvc"
17*0afa8e06SEd Maste
18*0afa8e06SEd Masteawk '/^[^*{}]+;$/' export.gnu | tr -d '\t;' | sort > "${GNU}"
19*0afa8e06SEd Mastesed 's/^_//' export.llvm | sort > "${LLVM}"
20*0afa8e06SEd Mastegrep -v '^EXPORTS$' export.msvc | sort > "${MSVC}"
21*0afa8e06SEd Mastediff -u "${GNU}" "${LLVM}" && diff -u "${MSVC}" "${LLVM}"
22*0afa8e06SEd MasteERROR=$?
23*0afa8e06SEd Masterm "${GNU}" "${LLVM}" "${MSVC}"
24*0afa8e06SEd Mastermdir "${TMPDIR}"
25*0afa8e06SEd Maste
26*0afa8e06SEd Masteexit ${ERROR}
27