function version { echo "$@" | awk -F. '{ printf("%d%02d%02d\n", $1,$2,$3); }'; }
- local cmake_version="$(cmake --version | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
+ local cmake_version="$(cmake --version | awk '/^cmake version [0-9]+\.[0-9]+\.[0-9]+$/ {print $3}')"
if [[ "$(version "$cmake_version")" -lt "$(version 3.14.2)" ]]; then
echo "Please install CMake 3.14.2 or newer from http://www.cmake.org/download/ or https://apt.kitware.com and ensure it is on your path."; exit 1;
platform=$(uname)
if [[ "$platform" == "FreeBSD" ]]; then
__NumProc=$(sysctl hw.ncpu | awk '{ print $2+1 }')
-elif [[ "$platform" == "NetBSD" ]]; then
+elif [[ "$platform" == "NetBSD" || "$platform" == "SunOS" ]]; then
__NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
elif [[ "$platform" == "Darwin" ]]; then
__NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
# Skip check_pie_supported call on Android as ld from llvm toolchain with NDK API level 21
# complains about missing linker flag `-no-pie` (while level 28's ld does support this flag,
# but since we know that PIE is supported, we can safely skip this redundant check).
- if(NOT CLR_CMAKE_TARGET_ANDROID)
+ #
+ # The default linker on Solaris also does not support PIE.
+ if(NOT CLR_CMAKE_TARGET_ANDROID AND NOT CLR_CMAKE_TARGET_SUNOS)
# All code we build should be compiled as position independent
get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
if("CXX" IN_LIST languages)
message(WARNING "PIE is not supported at link time: ${PIE_SUPPORT_OUTPUT}.\n"
"PIE link options will not be passed to linker.")
endif()
- endif(NOT CLR_CMAKE_TARGET_ANDROID)
+ endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
-endif(NOT CLR_CMAKE_TARGET_EMSCRIPTEN)
+endif()
string(TOLOWER "${CMAKE_BUILD_TYPE}" LOWERCASE_CMAKE_BUILD_TYPE)
if(LOWERCASE_CMAKE_BUILD_TYPE STREQUAL debug)
distroRid="android-$buildArch"
elif [ "$targetOs" = "FreeBSD" ]; then
distroRid="freebsd-$buildArch"
+ elif [ "$targetOs" = "SunOS" ]; then
+ distroRid="sunos-$buildArch"
fi
fi
packageDir=$(<"${CoreDisToolsPackagePathOutputFile}")
# Get library path
-libPath=`find $packageDir | grep $rid | grep -m 1 libcoredistools`
+libPath="$(find "$packageDir" -path "*$rid*libcoredistools*" -print | head -n 1)"
echo "libPath to be used: ${libPath}"
if [ ! -e $libPath ] || [ -z "$libPath" ]; then
set(CMAKE_REQUIRED_INCLUDES ${CROSS_ROOTFS}/usr/local/include)
elseif (CLR_CMAKE_TARGET_NETBSD)
set(PAL_UNIX_NAME \"NETBSD\")
+elseif (CLR_CMAKE_TARGET_SUNOS)
+ set(PAL_UNIX_NAME \"SUNOS\")
+ set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} /opt/local/include)
+ set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /opt/local/lib)
+ include_directories(SYSTEM /opt/local/include)
else ()
message(FATAL_ERROR "Unknown platform. Cannot define PAL_UNIX_NAME, used by RuntimeInformation.")
endif ()