Update to MacOSX SDK 11.1, add Mac M1

This commit is contained in:
Howard Chu 2022-05-03 15:51:34 +01:00
parent 67e5ca9ad6
commit a86c4cb75f
No known key found for this signature in database
GPG key ID: FD2A70B44AB11BA7
6 changed files with 38 additions and 20 deletions

View file

@ -61,9 +61,9 @@ download-linux: run 'make download-linux' to fetch all sources needed for linux
#Darwin (macos) builds:
To build with the x86_64-apple-darwin11 you require the mac os developer tools in MacOSX10.11.sdk.
To build with the x86_64-apple-darwin11 you require the mac os developer tools in MacOSX11.1.sdk.
Download it from apple, or search for it on github. Create a new directoty called SDKs in this
directory and place the entire MacOSX10.11.sdk folder in it. The depends build will then pick it up automatically
directory and place the entire MacOSX11.1.sdk folder in it. The depends build will then pick it up automatically
(without requiring SDK_PATH).

View file

@ -1,9 +1,14 @@
OSX_MIN_VERSION=10.8
OSX_SDK_VERSION=10.11
OSX_SDK_VERSION=11.1
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
LD64_VERSION=253.9
darwin_CC=clang -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -B $(host_prefix)/native/bin
darwin_CXX=clang++ -target $(host) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -stdlib=libc++ -B $(host_prefix)/native/bin
ifeq (aarch64, $(host_arch))
CC_target=arm64-apple-darwin11
else
CC_target=$(host)
endif
darwin_CC=clang -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -B$(host_prefix)/native/bin/$(host)-
darwin_CXX=clang++ -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(OSX_SDK) -mlinker-version=$(LD64_VERSION) -stdlib=libc++ -B$(host_prefix)/native/bin/$(host)-
darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS)

View file

@ -69,22 +69,35 @@ set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # Find includes in target
# specify the cross compiler to be used. Darwin uses clang provided by the SDK.
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(CMAKE_C_COMPILER @prefix@/native/bin/clang)
SET(CMAKE_C_COMPILER_TARGET x86_64-apple-darwin11)
SET(CMAKE_CXX_COMPILER @prefix@/native/bin/clang++ -stdlib=libc++)
SET(CMAKE_CXX_COMPILER_TARGET x86_64-apple-darwin11)
SET(CMAKE_ASM_COMPILER_TARGET x86_64-apple-darwin11)
SET(CMAKE_ASM-ATT_COMPILER_TARGET x86_64-apple-darwin11)
SET(_CMAKE_TOOLCHAIN_PREFIX x86_64-apple-darwin11-)
SET(APPLE True)
if(ARCHITECTURE STREQUAL "aarch64")
SET(CLANG_TARGET "arm64-apple-darwin11")
SET(CONF_TRIPLE "aarch64-apple-darwin11")
SET(BUILD_TAG "mac-armv8")
SET(CMAKE_OSX_ARCHITECTURES "arm64")
set(ARM ON)
set(ARM_ID "armv8-a")
else()
SET(CLANG_TARGET "x86_64-apple-darwin11")
SET(CONF_TRIPLE "x86_64-apple-darwin11")
SET(BUILD_TAG "mac-x64")
SET(CMAKE_OSX_ARCHITECTURES "x86_64")
endif()
SET(_CMAKE_TOOLCHAIN_PREFIX @prefix@/native/bin/${CONF_TRIPLE}-)
SET(CMAKE_C_COMPILER @prefix@/native/bin/clang)
SET(CMAKE_C_COMPILER_TARGET ${CLANG_TARGET})
SET(CMAKE_C_FLAGS_INIT -B${_CMAKE_TOOLCHAIN_PREFIX})
SET(CMAKE_CXX_COMPILER @prefix@/native/bin/clang++ -stdlib=libc++)
SET(CMAKE_CXX_COMPILER_TARGET ${CLANG_TARGET})
SET(CMAKE_CXX_FLAGS_INIT -B${_CMAKE_TOOLCHAIN_PREFIX})
SET(CMAKE_ASM_COMPILER_TARGET ${CLANG_TARGET})
SET(CMAKE_ASM-ATT_COMPILER_TARGET ${CLANG_TARGET})
SET(APPLE True)
SET(BUILD_64 ON)
SET(BREW OFF)
SET(PORT OFF)
SET(CMAKE_OSX_SYSROOT "@sdk@/MacOSX10.11.sdk/")
SET(CMAKE_OSX_SYSROOT "@sdk@/MacOSX11.1.sdk/")
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.08")
SET(CMAKE_CXX_STANDARD 14)
SET(CMAKE_OSX_ARCHITECTURES "x86_64")
SET(LLVM_ENABLE_PIC OFF)
SET(LLVM_ENABLE_PIE OFF)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
@ -126,7 +139,7 @@ elseif(ARCHITECTURE STREQUAL "aarch64")
set(ARM_ID "armv8-a")
if(ANDROID)
set(BUILD_TAG "android-armv8")
else()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(BUILD_TAG "linux-armv8")
endif()
set(BUILD_64 ON)

View file

@ -53,8 +53,8 @@ docker build --pull -f ${TAG}.Dockerfile -t $TAG .
cd ..
docker run -v /var/run/docker.sock:/var/run/docker.sock -d --name gitrun $TAG
if [ -f MacOSX10.11.sdk.tar.gz ]; then
docker cp MacOSX10.11.sdk.tar.gz gitrun:$WORKDIR/builder/inputs/
if [ -f MacOSX11.1.sdk.tar.xz ]; then
docker cp MacOSX11.1.sdk.tar.xz gitrun:$WORKDIR/builder/inputs/
else
echo "No MacOS SDK found, Mac builds will be omitted"
fi

View file

@ -162,7 +162,7 @@ def main():
# Disable MacOS build if no SDK found
args.nomac = False
if 'm' in args.os and not os.path.isfile('builder/inputs/MacOSX10.11.sdk.tar.gz'):
if 'm' in args.os and not os.path.isfile('builder/inputs/MacOSX11.1.sdk.tar.xz'):
if args.build:
print('Cannot build for MacOS, SDK does not exist. Will build for other OSes')
args.nomac = True

View file

@ -27,10 +27,10 @@ remotes:
- "url": "https://github.com/monero-project/monero.git"
"dir": "monero"
files:
- "MacOSX10.11.sdk.tar.gz"
- "MacOSX11.1.sdk.tar.xz"
script: |
WRAP_DIR=$HOME/wrapped
HOSTS="x86_64-apple-darwin11"
HOSTS="x86_64-apple-darwin11 aarch64-apple-darwin11"
FAKETIME_HOST_PROGS=""
FAKETIME_PROGS="ar ranlib date dmg genisoimage python"
@ -89,7 +89,7 @@ script: |
BASEPREFIX=`pwd`/contrib/depends
mkdir -p ${BASEPREFIX}/SDKs
tar -C ${BASEPREFIX}/SDKs -xf ${BUILD_DIR}/MacOSX10.11.sdk.tar.gz
tar -C ${BASEPREFIX}/SDKs -xf ${BUILD_DIR}/MacOSX11.1.sdk.tar.xz
# Build dependencies for each host
export TAR_OPTIONS=--mtime=2000-01-01T12:00:00