summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild.sh8
-rw-r--r--functions.cmake16
-rw-r--r--src/corefx/System.Globalization.Native/CMakeLists.txt6
-rwxr-xr-xverify-so.sh20
4 files changed, 42 insertions, 8 deletions
diff --git a/build.sh b/build.sh
index 61b5ab1120..1017d5caab 100755
--- a/build.sh
+++ b/build.sh
@@ -218,14 +218,6 @@ build_coreclr()
exit 1
fi
- echo "Verifying System.Globalization.Native.so dependencies"
-
- ldd -r $__BinDir/System.Globalization.Native.so | awk 'BEGIN {count=0} /undefined symbol:/ { if (count==0) {print "Undefined symbol(s) found:"} print " " $3; count++ } END {if (count>0) exit(1)}'
- if [ $? != 0 ]; then
- echo "Failed. System.Globalization.Native.so has undefined dependencies. These are likely ICU APIs that need to be added to icushim.h"
- exit 1
- fi
-
popd
}
diff --git a/functions.cmake b/functions.cmake
index f8a2eeae04..bac20e8bc6 100644
--- a/functions.cmake
+++ b/functions.cmake
@@ -216,3 +216,19 @@ function(_install)
install(${ARGV})
endif()
endfunction()
+
+function(verify_dependencies targetName errorMessage)
+ # We don't need to verify dependencies on OSX, since missing dependencies
+ # result in link error over there.
+ if (NOT CLR_CMAKE_PLATFORM_DARWIN)
+ add_custom_command(
+ TARGET ${targetName}
+ POST_BUILD
+ VERBATIM
+ COMMAND ${CMAKE_SOURCE_DIR}/verify-so.sh
+ $<TARGET_FILE:${targetName}>
+ ${errorMessage}
+ COMMENT "Verifying ${targetName} dependencies"
+ )
+ endif()
+endfunction()
diff --git a/src/corefx/System.Globalization.Native/CMakeLists.txt b/src/corefx/System.Globalization.Native/CMakeLists.txt
index 5892856dfe..90f50671cd 100644
--- a/src/corefx/System.Globalization.Native/CMakeLists.txt
+++ b/src/corefx/System.Globalization.Native/CMakeLists.txt
@@ -93,5 +93,11 @@ else()
add_definitions(-DU_DISABLE_RENAMING=1)
endif()
+verify_dependencies(
+ System.Globalization.Native
+ "Verification failed. System.Globalization.Native.so has undefined dependencies. These are likely ICU APIs that need to be added to icushim.h."
+)
+
# add the install targets
install_clr(System.Globalization.Native)
+
diff --git a/verify-so.sh b/verify-so.sh
new file mode 100755
index 0000000000..3907cf1db0
--- /dev/null
+++ b/verify-so.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+# $1 contains full path to the .so to verify
+# $2 contains message to print when the verification fails
+
+OSName=$(uname -s)
+case $OSName in
+ Linux)
+ source /etc/os-release
+ # TODO: add support for verification on Alpine Linux
+ if [ "$ID" != "alpine" ]; then
+ ldd -r $1 | awk 'BEGIN {count=0} /undefined symbol:/ { if (count==0) {print "Undefined symbol(s) found:"} print " " $3; count++ } END {if (count>0) exit(1)}'
+ if [ $? != 0 ]; then
+ echo "$2"
+ exit 1
+ fi
+ fi
+ ;;
+esac
+
+# TODO: add support for verification on non-Linux Unixes (except of OSX)