提交 d3230412 编写于 作者: V Viktor Hofer 提交者: GitHub

Remove root cross folder in favor of eng/common/cross (dotnet/corefx#42434)

* Manual darc update from build '20191106.10'

* Remove root cross folder in favor of common/cross


Commit migrated from https://github.com/dotnet/corefx/commit/f9eb7fdbdfbde3bfc525c3be3a67713b3f5a75a1
上级 7699e7ef
...@@ -68,7 +68,7 @@ if [[ -n "$CROSSCOMPILE" ]]; then ...@@ -68,7 +68,7 @@ if [[ -n "$CROSSCOMPILE" ]]; then
exit 1 exit 1
fi fi
if [[ -z "$CONFIG_DIR" ]]; then if [[ -z "$CONFIG_DIR" ]]; then
CONFIG_DIR=$repo_root/cross CONFIG_DIR="$repo_root/eng/common/cross"
fi fi
export TARGET_BUILD_ARCH=$build_arch export TARGET_BUILD_ARCH=$build_arch
cmake_extra_defines="$cmake_extra_defines -C $scriptroot/tryrun.cmake" cmake_extra_defines="$cmake_extra_defines -C $scriptroot/tryrun.cmake"
......
...@@ -139,7 +139,7 @@ if [ "$CROSSCOMPILE" = "1" ]; then ...@@ -139,7 +139,7 @@ if [ "$CROSSCOMPILE" = "1" ]; then
exit 1 exit 1
fi fi
if [ -z "$CONFIG_DIR" ]; then if [ -z "$CONFIG_DIR" ]; then
CONFIG_DIR="$2/cross" CONFIG_DIR="$repo_root/eng/common/cross"
fi fi
export TARGET_BUILD_ARCH=$build_arch export TARGET_BUILD_ARCH=$build_arch
cmake_extra_defines="$cmake_extra_defines -C $scriptroot/tryrun.cmake" cmake_extra_defines="$cmake_extra_defines -C $scriptroot/tryrun.cmake"
......
set(CROSS_NDK_TOOLCHAIN $ENV{ROOTFS_DIR}/..)
set(CROSS_ROOTFS ${CROSS_NDK_TOOLCHAIN}/sysroot)
set(CLR_CMAKE_PLATFORM_ANDROID "Android")
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR arm)
## Specify the toolchain
set(TOOLCHAIN "arm-linux-androideabi")
set(CMAKE_PREFIX_PATH ${CROSS_NDK_TOOLCHAIN})
find_program(CMAKE_C_COMPILER ${TOOLCHAIN}-clang)
find_program(CMAKE_CXX_COMPILER ${TOOLCHAIN}-clang++)
find_program(CMAKE_ASM_COMPILER ${TOOLCHAIN}-clang)
find_program(CMAKE_OBJCOPY ${TOOLCHAIN}-objcopy)
find_program(CMAKE_OBJDUMP ${TOOLCHAIN}-objdump)
add_compile_options(--sysroot=${CROSS_ROOTFS})
add_compile_options(-fPIE)
# Some libraries, like libcurl, check for the __ANDROID__ flag to include some required headers.
add_compile_options(-D__ANDROID__)
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B ${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}")
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/lib/${TOOLCHAIN}")
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} --sysroot=\"${CROSS_ROOTFS}\"")
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -fPIE -pie")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CROSS_NDK_TOOLCHAIN $ENV{ROOTFS_DIR}/..)
set(CROSS_ROOTFS ${CROSS_NDK_TOOLCHAIN}/sysroot)
set(CLR_CMAKE_PLATFORM_ANDROID "Android")
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
## Specify the toolchain
set(TOOLCHAIN "aarch64-linux-android")
set(CMAKE_PREFIX_PATH ${CROSS_NDK_TOOLCHAIN})
find_program(CMAKE_C_COMPILER ${TOOLCHAIN}-clang)
find_program(CMAKE_CXX_COMPILER ${TOOLCHAIN}-clang++)
find_program(CMAKE_ASM_COMPILER ${TOOLCHAIN}-clang)
find_program(CMAKE_OBJCOPY ${TOOLCHAIN}-objcopy)
find_program(CMAKE_OBJDUMP ${TOOLCHAIN}-objdump)
add_compile_options(--sysroot=${CROSS_ROOTFS})
add_compile_options(-fPIE)
# Some libraries, like libcurl, check for the __ANDROID__ flag to include some required headers.
add_compile_options(-D__ANDROID__)
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -B ${CROSS_ROOTFS}/usr/lib/gcc/${TOOLCHAIN}")
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -L${CROSS_ROOTFS}/lib/${TOOLCHAIN}")
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} --sysroot=\"${CROSS_ROOTFS}\"")
set(CROSS_LINK_FLAGS "${CROSS_LINK_FLAGS} -fPIE -pie")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${CROSS_LINK_FLAGS}" CACHE STRING "" FORCE)
set(CMAKE_FIND_ROOT_PATH "${CROSS_ROOTFS}")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
#!/bin/bash
#Usage message
function usage {
echo 'ARM Emulator Cross Build Script'
echo 'This script cross builds corefx source'
echo ''
echo 'Typical usage:'
echo ' corefx source is at ~/cfx'
echo '$ cd ~/cfx'
echo '$ ./scripts/arm32_ci_script.sh'
echo ' --buildConfig=Release'
echo ' --armel'
echo ' --verbose'
echo ''
echo 'Required Arguments:'
echo ' --buildConfig=<config> : The value of config should be either Debug or Release'
echo ' Any other value is not accepted'
echo 'Optional Arguments:'
echo ' --mode=<mode> : docker (default) or emulator'
echo ' --arm : Build as arm (default)'
echo ' --armel : Build as armel'
echo ' --linuxCodeName=<name> : Code name for Linux: For arm, trusty (default) and xenial. For armel, tizen'
echo ' --skipRootFS : Skip building rootfs'
echo ' --emulatorPath=<path> : Path of the emulator folder (without ending /)'
echo ' <path>/platform/rootfs-t30.ext4 should exist'
echo ' --mountPath=<path> : The desired path for mounting the emulator rootfs (without ending /)'
echo ' This path is created if not already present'
echo ' -v --verbose : Build made verbose'
echo ' -h --help : Prints this usage message and exits'
echo ''
echo 'Any other argument triggers an error and this usage message is displayed'
exit 1
}
#Display error message and exit
function exit_with_error {
set +x
local errorMessage="$1"
local printUsage=$2
echo "ERROR: $errorMessage"
if [ "$printUsage" == "true" ]; then
echo ''
usage
fi
exit 1
}
#Exit if input string is empty
function exit_if_empty {
local inputString="$1"
local errorMessage="$2"
local printUsage=$3
if [ -z "$inputString" ]; then
exit_with_error "$errorMessage" $printUsage
fi
}
#Exit if the input path does not exist
function exit_if_path_absent {
local path="$1"
local errorMessage="$2"
local printUsage=$3
if [ ! -f "$path" -a ! -d "$path" ]; then
exit_with_error "$errorMessage" $printUsage
fi
}
#Check if the git changes were reverted completely
function check_git_head {
local currentGitHead=`git rev-parse --verify HEAD`
if [[ "$__initialGitHead" != "$currentGitHead" ]]; then
exit_with_error "Some changes made to the code history were not completely reverted. Intial Git HEAD: $__initialGitHead, current Git HEAD: $currentGitHead" false
fi
}
function unmount_rootfs {
local rootfsFolder="$1"
#Check if there are any open files in this directory.
if [ -d $rootfsFolder ]; then
#If we find information about the file
if sudo lsof +D $rootfsFolder; then
(set +x; echo 'See above for lsof information. Continuing with the build.')
fi
fi
if mountpoint -q -- "$rootfsFolder"; then
sudo umount "$rootfsFolder"
fi
}
#Unmount the emulator file systems
function unmount_emulator {
(set +x; echo 'Unmounting emulator...')
#Unmount all the mounted emulator file systems
unmount_rootfs "$__ARMRootfsMountPath/proc"
unmount_rootfs "$__ARMRootfsMountPath/dev/pts"
unmount_rootfs "$__ARMRootfsMountPath/dev"
unmount_rootfs "$__ARMRootfsMountPath/run/shm"
unmount_rootfs "$__ARMRootfsMountPath/sys"
unmount_rootfs "$__ARMRootfsMountPath"
}
#Clean the changes made to the environment by the script
function clean_env {
#Check for revert of git changes
check_git_head
}
#Trap Ctrl-C and handle it
function handle_ctrl_c {
set +x
echo 'ERROR: Ctrl-C handled. Script aborted before complete execution.'
exit 1
}
trap handle_ctrl_c INT
#Trap Exit and handle it
function handle_exit {
set +x
echo 'The script is exited. Cleaning environment..'
clean_env
}
trap handle_exit EXIT
#Mount with checking to be already existed
function mount_with_checking {
set +x
local options="$1"
local from="$2"
local rootfsFolder="$3"
if mountpoint -q -- "$rootfsFolder"; then
(set +x; echo "$rootfsFolder is already mounted.")
else {
(set -x; sudo mount $options "$from" "$rootfsFolder")
}
fi
}
#Mount emulator to the target mount path
function mount_emulator {
#Check if the mount path exists and create if neccessary
if [ ! -d "$__ARMRootfsMountPath" ]; then
sudo mkdir -p "$__ARMRootfsMountPath"
fi
set +x
mount_with_checking "" "$__ARMEmulPath/platform/$__ARMRootfsImageBase" "$__ARMRootfsMountPath"
mount_with_checking "-t proc" "/proc" "$__ARMRootfsMountPath/proc"
mount_with_checking "-o bind" "/dev/" "$__ARMRootfsMountPath/dev"
mount_with_checking "-o bind" "/dev/pts" "$__ARMRootfsMountPath/dev/pts"
mount_with_checking "-t tmpfs" "shm" "$__ARMRootfsMountPath/run/shm"
mount_with_checking "-o bind" "/sys" "$__ARMRootfsMountPath/sys"
}
#Cross builds corefx
function cross_build_corefx {
#Apply fixes for armel
if [ "$__buildArch" == "armel" ]; then
#Export the needed environment variables
(set +x; echo 'Exporting LINUX_ARM_* environment variable')
source "$__ARMRootfsMountPath"/dotnet/setenv/setenv_incpath.sh "$__ARMRootfsMountPath"
fi
#Cross building for emulator rootfs
ROOTFS_DIR="$__ARMRootfsMountPath" CPLUS_INCLUDE_PATH=$LINUX_ARM_INCPATH CXXFLAGS=$LINUX_ARM_CXXFLAGS ./src/Native/build-native.sh $__buildArch $__buildConfig cross $__verboseFlag
ROOTFS_DIR="$__ARMRootfsMountPath" CPLUS_INCLUDE_PATH=$LINUX_ARM_INCPATH CXXFLAGS=$LINUX_ARM_CXXFLAGS ./build.sh -$__buildConfig /p:BuildNative=false /p:SkipTests=true /p:BuildPackages=false
}
# Cross builds corefx using Docker image
function cross_build_corefx_with_docker {
__currentWorkingDirectory=`pwd`
# Check build configuration and choose Docker image
if [ "$__buildArch" == "arm" ]; then
# TODO: For arm, we are going to embed RootFS inside Docker image.
case $__linuxCodeName in
trusty)
__dockerImage=" microsoft/dotnet-buildtools-prereqs:ubuntu-14.04-cross-0cd4667-20172211042239"
__skipRootFS=1
__dockerEnvironmentVariables="-e ROOTFS_DIR=/crossrootfs/arm"
__runtimeOS="ubuntu.14.04"
;;
xenial)
__dockerImage=" microsoft/dotnet-buildtools-prereqs:ubuntu-16.04-cross-ef0ac75-20175511035548"
__skipRootFS=1
__dockerEnvironmentVariables="-e ROOTFS_DIR=/crossrootfs/arm"
__runtimeOS="ubuntu.16.04"
;;
*)
exit_with_error "ERROR: $__linuxCodeName is not a supported linux name for $__buildArch" false
;;
esac
elif [ "$__buildArch" == "armel" ]; then
# For armel Tizen, we are going to construct RootFS on the fly.
case $__linuxCodeName in
tizen)
__dockerImage=" tizendotnet/dotnet-buildtools-prereqs:ubuntu-16.04-cross-10fcdcf-20190208200917-tizen-rootfs-5.0m2"
__skipRootFS=1
__dockerEnvironmentVariables+=" -e ROOTFS_DIR=/crossrootfs/armel.tizen.build"
__runtimeOS="tizen.5.0.0"
;;
*)
echo "ERROR: $__linuxCodeName is not a supported linux name for $__buildArch"
exit_with_error "ERROR: $__linuxCodeName is not a supported linux name for $__buildArch" false
;;
esac
else
exit_with_error "ERROR: unknown buildArch $__buildArch" false
fi
__dockerCmd="sudo docker run ${__dockerEnvironmentVariables} --privileged -i --rm -v $__currentWorkingDirectory:/opt/corefx -w /opt/corefx $__dockerImage"
if [ $__skipRootFS == 0 ]; then
# Build rootfs
__buildRootfsCmd="./cross/build-rootfs.sh $__buildArch $__linuxCodeName --skipunmount"
(set +x; echo "Build RootFS for $__buildArch $__linuxCodeName")
$__dockerCmd $__buildRootfsCmd
sudo chown -R $(id -u -n) cross/rootfs
fi
# Cross building corefx with rootfs in Docker
if [ "$__buildArch" == "armel" ]; then
__extraCmd="/p:OverridePackageSource=https://tizen.myget.org/F/dotnet-core/api/v3/index.json"
__portableLinux="/p:PortableBuild=false"
fi
__buildCmd="./build.sh --configuration $__buildConfig /p:ArchGroup=$__buildArch /p:RuntimeOS=$__runtimeOS $__portableLinux $__extraCmd"
$__dockerCmd $__buildCmd
sudo chown -R $(id -u -n) ./artifacts
}
#Define script variables
__ciMode="docker"
__ARMEmulPath=
__ARMRootfsImageBase="rootfs-u1404.ext4"
__ARMRootfsMountPath=
__buildConfig=
__verboseFlag=
__buildArch="arm"
__linuxCodeName="trusty"
__skipRootFS=0
__initialGitHead=`git rev-parse --verify HEAD`
#Parse command line arguments
for arg in "$@"
do
case $arg in
--emulatorPath=*)
__ARMEmulPath=${arg#*=}
;;
--mountPath=*)
__ARMRootfsMountPath=${arg#*=}
;;
--buildConfig=*)
__buildConfig="$(echo ${arg#*=} | awk '{print tolower($0)}')"
if [[ "$__buildConfig" != "debug" && "$__buildConfig" != "release" ]]; then
exit_with_error "--buildConfig can be only Debug or Release" true
fi
;;
--mode=*)
__ciMode=${arg#*=}
;;
--arm)
__ARMRootfsImageBase="rootfs-u1404.ext4"
__buildArch="arm"
;;
--armel)
__ARMRootfsImageBase="rootfs-t30.ext4"
__buildArch="armel"
__linuxCodeName="tizen"
;;
--linuxCodeName=*)
__linuxCodeName=${arg#*=}
;;
--skipRootFS)
__skipRootFS=1
;;
-v|--verbose)
__verboseFlag="verbose"
;;
-h|--help)
usage
;;
*)
exit_with_error "$arg not a recognized argument" true
;;
esac
done
#Check if there are any uncommited changes in the source directory as git adds and removes patches
if [[ $(git status -s) != "" ]]; then
echo 'ERROR: There are some uncommited changes. To avoid losing these changes commit them and try again.'
echo ''
git status
exit 1
fi
exit_if_empty "$__buildConfig" "--buildConfig is a mandatory argument, not provided" true
if [ "$__ciMode" == "emulator" ]; then
#Check if the compulsory arguments have been presented to the script and if the input paths exist
exit_if_empty "$__ARMEmulPath" "--emulatorPath is a mandatory argument, not provided" true
exit_if_empty "$__ARMRootfsMountPath" "--mountPath is a mandatory argument, not provided" true
exit_if_path_absent "$__ARMEmulPath/platform/$__ARMRootfsImageBase" "Path specified in --emulatorPath does not have the rootfs" false
__ARMRootfsMountPath="${__ARMRootfsMountPath}_${__buildArch}"
fi
set -x
set -e
## Begin cross build
(set +x; echo "Git HEAD @ $__initialGitHead")
#Complete the cross build
(set +x; echo 'Building corefx...')
if [ "$__ciMode" == "docker" ]; then
cross_build_corefx_with_docker
else
cross_build_corefx
fi
#Clean the environment
(set +x; echo 'Cleaning environment...')
clean_env
(set +x; echo 'Build complete')
set(CROSS_ROOTFS $ENV{ROOTFS_DIR})
set(TARGET_ARCH_NAME $ENV{TARGET_BUILD_ARCH})
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
if(TARGET_ARCH_NAME STREQUAL "armel")
set(CMAKE_SYSTEM_PROCESSOR armv7l)
set(TOOLCHAIN "arm-linux-gnueabi")
if("$ENV{__DistroRid}" MATCHES "tizen.*")
set(TIZEN_TOOLCHAIN "armv7l-tizen-linux-gnueabi/6.2.1")
endif()
elseif(TARGET_ARCH_NAME STREQUAL "arm")
set(CMAKE_SYSTEM_PROCESSOR armv7l)
if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/armv6-alpine-linux-musleabihf)
set(TOOLCHAIN "armv6-alpine-linux-musleabihf")
else()
set(TOOLCHAIN "arm-linux-gnueabihf")
endif()
elseif(TARGET_ARCH_NAME STREQUAL "arm64")
set(CMAKE_SYSTEM_PROCESSOR aarch64)
if(EXISTS ${CROSS_ROOTFS}/usr/lib/gcc/aarch64-alpine-linux-musl)
set(TOOLCHAIN "aarch64-alpine-linux-musl")
else()
set(TOOLCHAIN "aarch64-linux-gnu")
endif()
elseif(TARGET_ARCH_NAME STREQUAL "x86")
set(CMAKE_SYSTEM_PROCESSOR i686)
set(TOOLCHAIN "i686-linux-gnu")
else()
message(FATAL_ERROR "Arch is ${TARGET_ARCH_NAME}. Only armel, arm, arm64 and x86 are supported!")
endif()
if(DEFINED ENV{TOOLCHAIN})
set(TOOLCHAIN $ENV{TOOLCHAIN})
endif()
# Specify include paths
if(TARGET_ARCH_NAME STREQUAL "armel")
if(DEFINED TIZEN_TOOLCHAIN)
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/)
include_directories(SYSTEM ${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}/include/c++/armv7l-tizen-linux-gnueabi)
endif()
endif()
set(CMAKE_SYSROOT "${CROSS_ROOTFS}")
set(CMAKE_C_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr")
set(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr")
set(CMAKE_ASM_COMPILER_EXTERNAL_TOOLCHAIN "${CROSS_ROOTFS}/usr")
# Specify link flags
if(TARGET_ARCH_NAME STREQUAL "armel")
if(DEFINED TIZEN_TOOLCHAIN) # For Tizen only
add_link_options("-B${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
add_link_options("-L${CROSS_ROOTFS}/lib")
add_link_options("-L${CROSS_ROOTFS}/usr/lib")
add_link_options("-L${CROSS_ROOTFS}/usr/lib/gcc/${TIZEN_TOOLCHAIN}")
endif()
elseif(TARGET_ARCH_NAME STREQUAL "x86")
add_link_options(-m32)
endif()
# Specify compile options
if(TARGET_ARCH_NAME MATCHES "^(arm|armel|arm64)$")
set(CMAKE_C_COMPILER_TARGET ${TOOLCHAIN})
set(CMAKE_CXX_COMPILER_TARGET ${TOOLCHAIN})
set(CMAKE_ASM_COMPILER_TARGET ${TOOLCHAIN})
endif()
if(TARGET_ARCH_NAME MATCHES "^(arm|armel)$")
add_compile_options(-mthumb)
add_compile_options(-mfpu=vfpv3)
if(TARGET_ARCH_NAME STREQUAL "armel")
add_compile_options(-mfloat-abi=softfp)
if(DEFINED TIZEN_TOOLCHAIN)
add_compile_options(-Wno-deprecated-declarations) # compile-time option
add_compile_options(-D__extern_always_inline=inline) # compile-time option
endif()
endif()
elseif(TARGET_ARCH_NAME STREQUAL "x86")
add_compile_options(-m32)
add_compile_options(-Wno-error=unused-command-line-argument)
endif()
# Set LLDB include and library paths for builds that need lldb.
if(TARGET_ARCH_NAME MATCHES "^(arm|armel|x86)$")
if(TARGET_ARCH_NAME STREQUAL "x86")
set(LLVM_CROSS_DIR "$ENV{LLVM_CROSS_HOME}")
else() # arm/armel case
set(LLVM_CROSS_DIR "$ENV{LLVM_ARM_HOME}")
endif()
if(LLVM_CROSS_DIR)
set(WITH_LLDB_LIBS "${LLVM_CROSS_DIR}/lib/" CACHE STRING "")
set(WITH_LLDB_INCLUDES "${LLVM_CROSS_DIR}/include" CACHE STRING "")
set(LLDB_H "${WITH_LLDB_INCLUDES}" CACHE STRING "")
set(LLDB "${LLVM_CROSS_DIR}/lib/liblldb.so" CACHE STRING "")
else()
if(TARGET_ARCH_NAME STREQUAL "x86")
set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/i386-linux-gnu" CACHE STRING "")
set(CHECK_LLVM_DIR "${CROSS_ROOTFS}/usr/lib/llvm-3.8/include")
if(EXISTS "${CHECK_LLVM_DIR}" AND IS_DIRECTORY "${CHECK_LLVM_DIR}")
set(WITH_LLDB_INCLUDES "${CHECK_LLVM_DIR}")
else()
set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include")
endif()
else() # arm/armel case
set(WITH_LLDB_LIBS "${CROSS_ROOTFS}/usr/lib/${TOOLCHAIN}" CACHE STRING "")
set(WITH_LLDB_INCLUDES "${CROSS_ROOTFS}/usr/lib/llvm-3.6/include" CACHE STRING "")
endif()
endif()
endif()
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
\ No newline at end of file
#!/bin/bash
function exit_with_error {
set +x
local errorMessage="$1"
echo "ERROR: $errorMessage"
exit 1
}
#Exit if input string is empty
function exit_if_empty {
local inputString="$1"
local errorMessage="$2"
if [ -z "$inputString" ]; then
exit_with_error "$errorMessage"
fi
}
# Cross builds corefx using Docker image
function cross_build_native_with_docker {
__currentWorkingDirectory=`pwd`
# choose Docker image
__dockerImage=" hseok82/dotnet-buildtools-prereqs:ubuntu-16.04-crossx86-ef0ac75-20175511035548"
__dockerEnvironmentVariables="-e ROOTFS_DIR=/crossrootfs/x86"
__runtimeOS="ubuntu.16.04"
__dockerCmd="docker run ${__dockerEnvironmentVariables} -i --rm -v $__currentWorkingDirectory:/opt/code -w /opt/code $__dockerImage"
# Cross building corefx with rootfs in Docker
__buildNativeCmd="./src/Native/build-native.sh x86 $__buildConfig cross"
$__dockerCmd $__buildNativeCmd
sudo chown -R $(id -u -n) ./artifacts
}
__buildConfig=
for arg in "$@"
do
case $arg in
--buildConfig=*)
__buildConfig="$(echo ${arg#*=} | awk '{print tolower($0)}')"
if [[ "$__buildConfig" != "debug" && "$__buildConfig" != "release" ]]; then
exit_with_error "--buildConfig can be only Debug or Release" true
fi
;;
*)
;;
esac
done
set -x
set -e
exit_if_empty "$__buildConfig" "--buildConfig is a mandatory argument, not provided"
#Complete the cross build
(set +x; echo 'Building corefx...')
cross_build_native_with_docker
(set +x; echo 'Build complete')
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册