xref: /aosp_15_r20/external/wayland/egl/wayland-egl-symbols-check (revision 84e872a0dc482bffdb63672969dd03a827d67c73)
1*84e872a0SLloyd Pique#!/bin/sh
2*84e872a0SLloyd Piqueset -eu
3*84e872a0SLloyd Pique
4*84e872a0SLloyd PiqueRET=0
5*84e872a0SLloyd PiqueLIB=${WAYLAND_EGL_LIB}
6*84e872a0SLloyd Pique
7*84e872a0SLloyd Piqueif ! test -f "$LIB"; then
8*84e872a0SLloyd Pique	echo "Test binary \"$LIB\" does not exist"
9*84e872a0SLloyd Pique	exit 99
10*84e872a0SLloyd Piquefi
11*84e872a0SLloyd Pique
12*84e872a0SLloyd Piqueif ! test -n "$NM"; then
13*84e872a0SLloyd Pique	echo "nm environment variable not set"
14*84e872a0SLloyd Pique	exit 99
15*84e872a0SLloyd Piquefi
16*84e872a0SLloyd Pique
17*84e872a0SLloyd PiqueAVAIL_FUNCS="$($NM -D --format=bsd --defined-only $LIB | awk '{print $3}')"
18*84e872a0SLloyd Pique
19*84e872a0SLloyd Pique# Official ABI, taken from the header.
20*84e872a0SLloyd PiqueREQ_FUNCS="wl_egl_window_resize
21*84e872a0SLloyd Piquewl_egl_window_create
22*84e872a0SLloyd Piquewl_egl_window_destroy
23*84e872a0SLloyd Piquewl_egl_window_get_attached_size
24*84e872a0SLloyd Pique"
25*84e872a0SLloyd Pique
26*84e872a0SLloyd PiqueNEW_ABI=$(echo "$AVAIL_FUNCS" | while read func; do
27*84e872a0SLloyd Pique    echo "$func" | grep -q "^_" && continue
28*84e872a0SLloyd Pique    echo "$REQ_FUNCS" | grep -q "^$func$" && continue
29*84e872a0SLloyd Pique
30*84e872a0SLloyd Pique    echo $func
31*84e872a0SLloyd Piquedone)
32*84e872a0SLloyd Pique
33*84e872a0SLloyd Piqueif test -n "$NEW_ABI"; then
34*84e872a0SLloyd Pique	echo "New ABI detected - If intentional, update the test."
35*84e872a0SLloyd Pique	echo "$NEW_ABI"
36*84e872a0SLloyd Pique	RET=1
37*84e872a0SLloyd Piquefi
38*84e872a0SLloyd Pique
39*84e872a0SLloyd PiqueREMOVED_ABI=$(echo "$REQ_FUNCS" | while read func; do
40*84e872a0SLloyd Pique    echo "$AVAIL_FUNCS" | grep -q "^$func$" && continue
41*84e872a0SLloyd Pique
42*84e872a0SLloyd Pique    echo $func
43*84e872a0SLloyd Piquedone)
44*84e872a0SLloyd Pique
45*84e872a0SLloyd Piqueif test -n "$REMOVED_ABI"; then
46*84e872a0SLloyd Pique	echo "ABI break detected - Required symbol(s) no longer exported!"
47*84e872a0SLloyd Pique	echo "$REMOVED_ABI"
48*84e872a0SLloyd Pique	RET=1
49*84e872a0SLloyd Piquefi
50*84e872a0SLloyd Pique
51*84e872a0SLloyd Piqueexit $RET
52