Make Mac SDK into a regular depends package

This commit is contained in:
Howard Chu 2022-05-05 16:29:11 +01:00
parent e81ab9bc2c
commit 7ea1e214c5
No known key found for this signature in database
GPG Key ID: FD2A70B44AB11BA7
11 changed files with 17 additions and 54 deletions

View File

@ -2,7 +2,6 @@
SOURCES_PATH ?= $(BASEDIR)/sources SOURCES_PATH ?= $(BASEDIR)/sources
BASE_CACHE ?= $(BASEDIR)/built BASE_CACHE ?= $(BASEDIR)/built
SDK_PATH ?= $(BASEDIR)/SDKs
FALLBACK_DOWNLOAD_PATH ?= https://downloads.getmonero.org/depends-sources FALLBACK_DOWNLOAD_PATH ?= https://downloads.getmonero.org/depends-sources
BUILD = $(shell ./config.guess) BUILD = $(shell ./config.guess)
@ -185,7 +184,6 @@ $(host_prefix)/share/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_
-e 's|@build_tests@|$(build_tests)|' \ -e 's|@build_tests@|$(build_tests)|' \
-e 's|@depends@|$(host_cmake)|' \ -e 's|@depends@|$(host_cmake)|' \
-e 's|@prefix@|$($(host_arch)_$(host_os)_prefix)|'\ -e 's|@prefix@|$($(host_arch)_$(host_os)_prefix)|'\
-e 's|@sdk@|$(SDK_PATH)|'\
-e 's|@arch@|$(host_arch)|'\ -e 's|@arch@|$(host_arch)|'\
$< > $@ $< > $@
$(AT)touch $@ $(AT)touch $@

View File

@ -30,7 +30,7 @@ Common `host-platform-triplets` for cross compilation are:
- `i686-w64-mingw32` for Win32 - `i686-w64-mingw32` for Win32
- `x86_64-w64-mingw32` for Win64 - `x86_64-w64-mingw32` for Win64
- `x86_64-apple-darwin11` for MacOSX - `x86_64-apple-darwin11` for MacOSX x86_64
- `arm-linux-gnueabihf` for Linux ARM 32 bit - `arm-linux-gnueabihf` for Linux ARM 32 bit
- `aarch64-linux-gnu` for Linux ARM 64 bit - `aarch64-linux-gnu` for Linux ARM 64 bit
- `riscv64-linux-gnu` for Linux RISCV 64 bit - `riscv64-linux-gnu` for Linux RISCV 64 bit
@ -43,7 +43,6 @@ The following can be set when running make: make FOO=bar
``` ```
SOURCES_PATH: downloaded sources will be placed here SOURCES_PATH: downloaded sources will be placed here
BASE_CACHE: built packages will be placed here BASE_CACHE: built packages will be placed here
SDK_PATH: Path where sdk's can be found (used by OSX)
FALLBACK_DOWNLOAD_PATH: If a source file can't be fetched, try here before giving up FALLBACK_DOWNLOAD_PATH: If a source file can't be fetched, try here before giving up
DEBUG: disable some optimizations and enable more runtime checking DEBUG: disable some optimizations and enable more runtime checking
HOST_ID_SALT: Optional salt to use when generating host package ids HOST_ID_SALT: Optional salt to use when generating host package ids
@ -59,14 +58,6 @@ download-win: run 'make download-win' to fetch all sources needed for win builds
download-linux: run 'make download-linux' to fetch all sources needed for linux builds download-linux: run 'make download-linux' to fetch all sources needed for linux builds
``` ```
#Darwin (macos) builds:
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 MacOSX11.1.sdk folder in it. The depends build will then pick it up automatically
(without requiring SDK_PATH).
#Mingw builds #Mingw builds
Building for 32/64bit mingw requires switching alternatives to a posix mode Building for 32/64bit mingw requires switching alternatives to a posix mode

View File

@ -1,14 +1,12 @@
OSX_MIN_VERSION=10.8 OSX_MIN_VERSION=10.8
OSX_SDK_VERSION=11.1
OSX_SDK=$(SDK_PATH)/MacOSX$(OSX_SDK_VERSION).sdk
LD64_VERSION=609 LD64_VERSION=609
ifeq (aarch64, $(host_arch)) ifeq (aarch64, $(host_arch))
CC_target=arm64-apple-darwin11 CC_target=arm64-apple-darwin11
else else
CC_target=$(host) CC_target=$(host)
endif 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_CC=clang -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/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_CXX=clang++ -target $(CC_target) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(host_prefix)/native/SDK/ -mlinker-version=$(LD64_VERSION) -stdlib=libc++ -B$(host_prefix)/native/bin/$(host)-
darwin_CFLAGS=-pipe darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS) darwin_CXXFLAGS=$(darwin_CFLAGS)
@ -20,4 +18,4 @@ darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)
darwin_debug_CFLAGS=-O1 darwin_debug_CFLAGS=-O1
darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS) darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS)
darwin_native_toolchain=native_cctools darwin_native_toolchain=native_cctools darwin_sdk

View File

@ -0,0 +1,10 @@
package=darwin_sdk
$(package)_version=11.1
$(package)_download_path=https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/
$(package)_file_name=MacOSX$($(package)_version).sdk.tar.xz
$(package)_sha256_hash=68797baaacb52f56f713400de306a58a7ca00b05c3dc6d58f0a8283bcac721f8
define $(package)_stage_cmds
mkdir -p $($(package)_staging_dir)/$(host_prefix)/native/SDK &&\
mv * $($(package)_staging_dir)/$(host_prefix)/native/SDK
endef

View File

@ -34,6 +34,6 @@ mingw32_packages = icu4c sodium $(hardware_packages)
mingw32_native_packages = $(hardware_native_packages) mingw32_native_packages = $(hardware_native_packages)
ifneq ($(build_os),darwin) ifneq ($(build_os),darwin)
darwin_native_packages += native_clang native_cctools native_libtapi darwin_native_packages += darwin_sdk native_clang native_cctools native_libtapi
endif endif

View File

@ -95,7 +95,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(BUILD_64 ON) SET(BUILD_64 ON)
SET(BREW OFF) SET(BREW OFF)
SET(PORT OFF) SET(PORT OFF)
SET(CMAKE_OSX_SYSROOT "@sdk@/MacOSX11.1.sdk/") SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK/")
SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.08") SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.08")
SET(CMAKE_CXX_STANDARD 14) SET(CMAKE_CXX_STANDARD 14)
SET(LLVM_ENABLE_PIC OFF) SET(LLVM_ENABLE_PIC OFF)

View File

@ -30,12 +30,6 @@ git clone https://github.com/monero-project/monero.git
cd monero/contrib/gitian cd monero/contrib/gitian
``` ```
If you want Mac binaries included in your build, you need to obtain the MacOS SDK:
```bash
curl -O https://bitcoincore.org/depends-sources/sdks/MacOSX10.11.sdk.tar.gz
```
Other User Preparation Other User Preparation
---------------------- ----------------------

View File

@ -165,15 +165,6 @@ popd
Build the binaries Build the binaries
------------------ ------------------
**Note:** if you intend to build MacOS binaries, please follow [these instructions](https://github.com/bitcoin-core/docs/blob/master/gitian-building/gitian-building-mac-os-sdk.md) to get the required SDK.
Currently working MacOS solution:
```bash
curl -O https://bitcoincore.org/depends-sources/sdks/MacOSX10.11.sdk.tar.gz
mv MacOSX10.11.sdk.tar.gz builder/inputs
```
To build the most recent tag (pass in `--docker` if using docker): To build the most recent tag (pass in `--docker` if using docker):
```bash ```bash

View File

@ -53,11 +53,6 @@ docker build --pull -f ${TAG}.Dockerfile -t $TAG .
cd .. cd ..
docker run -v /var/run/docker.sock:/var/run/docker.sock -d --name gitrun $TAG docker run -v /var/run/docker.sock:/var/run/docker.sock -d --name gitrun $TAG
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
fi fi

View File

@ -59,9 +59,6 @@ def rebuild():
for i in args.os: for i in args.os:
if i is 'm' and args.nomac:
continue
os_name = platforms[i][0] os_name = platforms[i][0]
tag_name = platforms[i][1] tag_name = platforms[i][1]
suffix = platforms[i][2] suffix = platforms[i][2]
@ -160,13 +157,6 @@ def main():
if not 'LXC_GUEST_IP' in os.environ.keys(): if not 'LXC_GUEST_IP' in os.environ.keys():
os.environ['LXC_GUEST_IP'] = '10.0.2.5' os.environ['LXC_GUEST_IP'] = '10.0.2.5'
# Disable MacOS build if no SDK found
args.nomac = False
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
script_name = os.path.basename(sys.argv[0]) script_name = os.path.basename(sys.argv[0])
# Signer and version shouldn't be empty # Signer and version shouldn't be empty
if args.signer == '': if args.signer == '':

View File

@ -26,8 +26,7 @@ packages:
remotes: remotes:
- "url": "https://github.com/monero-project/monero.git" - "url": "https://github.com/monero-project/monero.git"
"dir": "monero" "dir": "monero"
files: files: []
- "MacOSX11.1.sdk.tar.xz"
script: | script: |
WRAP_DIR=$HOME/wrapped WRAP_DIR=$HOME/wrapped
HOSTS="x86_64-apple-darwin11 aarch64-apple-darwin11" HOSTS="x86_64-apple-darwin11 aarch64-apple-darwin11"
@ -88,9 +87,6 @@ script: |
BASEPREFIX=`pwd`/contrib/depends BASEPREFIX=`pwd`/contrib/depends
mkdir -p ${BASEPREFIX}/SDKs
tar -C ${BASEPREFIX}/SDKs -xf ${BUILD_DIR}/MacOSX11.1.sdk.tar.xz
# Build dependencies for each host # Build dependencies for each host
export TAR_OPTIONS=--mtime=2000-01-01T12:00:00 export TAR_OPTIONS=--mtime=2000-01-01T12:00:00
for i in $HOSTS; do for i in $HOSTS; do