From 94f8d80b6a012f02654d305908514f466e858f66 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Mon, 25 May 2015 04:38:08 +0400 Subject: [PATCH] Add OS X support to abicheck.sh Make abicheck.sh work with *.dylib files and the nm that comes with Xcode. --- lib/abicheck.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/abicheck.sh b/lib/abicheck.sh index e66828ddad..74e5c537c5 100755 --- a/lib/abicheck.sh +++ b/lib/abicheck.sh @@ -9,19 +9,27 @@ expected_abi_file="expected_abi" actual_abi_file="actual_abi" +if [[ "$(uname)" == "Darwin" ]]; then + file_mask=*.dylib + nm_options="-g -U" +else + file_mask=*.so + nm_options="-D -g --defined-only" +fi + if [[ "$1" == "--generate" ]]; then # IMPORTANT: we need a shared build of wxWidgets to proceed - if [[ $(echo *.so) == "*.so" ]]; then - echo "No shared objects (*.so) were found... aborting" + if [[ $(echo $file_mask) == "$file_mask" ]]; then + echo "No shared objects ($file_mask) were found... aborting" exit 1 fi # generated the "expected ABI" for later comparison rm -f $expected_abi_file - for library in *.so; do + for library in $file_mask; do # NOTE: don't use -C option as otherwise cut won't work correctly - nm -D -g --defined-only $library | cut -d ' ' -f 3 | sort >>$expected_abi_file + nm $nm_options $library | cut -d ' ' -f 3 | sort >>$expected_abi_file done echo "Expected wxWidgets ABI generated in \"$expected_abi_file\"..." @@ -37,15 +45,15 @@ elif [[ -z "$1" ]]; then echo "Comparing actual ABI with the expected ABI (loading it from \"$expected_abi_file\")..." # IMPORTANT: we need a shared build of wxWidgets to do the check - if [[ $(echo *.so) == "*.so" ]]; then - echo "No shared objects (*.so) were found... aborting" + if [[ $(echo $file_mask) == "*$file_mask" ]]; then + echo "No shared objects ($file_mask) were found... aborting" exit 1 fi rm -f $actual_abi_file - for library in *.so; do + for library in $file_mask; do # NOTE: don't use -C option as otherwise cut won't work correctly - nm -D -g --defined-only $library | cut -d ' ' -f 3 | sort >>$actual_abi_file + nm $nm_options $library | cut -d ' ' -f 3 | sort >>$actual_abi_file done result=`diff -u $expected_abi_file $actual_abi_file`