]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
depends: make mac sdk a package
authortobtoht <tob@featherwallet.org>
Thu, 16 Mar 2023 01:44:40 +0000 (02:44 +0100)
committertobtoht <tob@featherwallet.org>
Thu, 16 Mar 2023 13:27:54 +0000 (14:27 +0100)
contrib/depends/Makefile
contrib/depends/hosts/darwin.mk
contrib/depends/packages/darwin_sdk.mk [new file with mode: 0644]
contrib/depends/packages/packages.mk
contrib/depends/packages/qt.mk
contrib/depends/patches/qt/MacToolchain.cmake
contrib/depends/toolchain.cmake.in
contrib/guix/README.md
contrib/guix/guix-build
src/CMakeLists.txt

index 70ed3f8d3f0ca34b2d15421894bfce81cb231c36..26e4397515eaf380dbb7da281227ecf82f960ad4 100644 (file)
@@ -31,7 +31,6 @@ MAKEOVERRIDES := $(filter V=%,$(MAKEOVERRIDES))
 SOURCES_PATH ?= $(BASEDIR)/sources
 WORK_PATH = $(BASEDIR)/work
 BASE_CACHE ?= $(BASEDIR)/built
-SDK_PATH ?= $(BASEDIR)/SDKs
 FALLBACK_DOWNLOAD_PATH ?= https://featherwallet.org/files/sources
 
 BUILD = $(shell ./config.guess)
index 6ba716a8db843b897462ed54f49a80a08297be70..87d977668a46e0ca6fccc823b2e76f0e40800a45 100644 (file)
@@ -4,7 +4,7 @@ XCODE_VERSION=12.2
 XCODE_BUILD_ID=12B45b
 LD64_VERSION=609
 
-OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers
+OSX_SDK=$(host_prefix)/native/SDK
 
 darwin_native_binutils=native_cctools
 
@@ -13,7 +13,7 @@ ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
 # from llvm.org
 
 # Clang is a dependency of native_cctools when FORCE_USE_SYSTEM_CLANG is empty
-darwin_native_toolchain=native_cctools
+darwin_native_toolchain=native_cctools darwin_sdk
 
 clang_prog=$(build_prefix)/bin/clang
 clangxx_prog=$(clang_prog)++
@@ -23,7 +23,7 @@ else
 # FORCE_USE_SYSTEM_CLANG is non-empty, so we use the clang from the user's
 # system
 
-darwin_native_toolchain=
+darwin_native_toolchain=darwin_sdk
 
 # We can't just use $(shell command -v clang) because GNU Make handles builtins
 # in a special way and doesn't know that `command` is a POSIX-standard builtin
diff --git a/contrib/depends/packages/darwin_sdk.mk b/contrib/depends/packages/darwin_sdk.mk
new file mode 100644 (file)
index 0000000..0e82fa5
--- /dev/null
@@ -0,0 +1,10 @@
+package=darwin_sdk
+$(package)_version=12.2
+$(package)_download_path=https://featherwallet.org/files/sources/
+$(package)_file_name=Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers.tar.gz
+$(package)_sha256_hash=332477876917786b26dd7c3fc1665d2c5cdca81c72755e6a9754f308de77d33b
+
+define $(package)_stage_cmds
+  mkdir -p $($(package)_staging_dir)/$(host_prefix)/native/SDK &&\
+  mv * $($(package)_staging_dir)/$(host_prefix)/native/SDK
+endef
index 4f31ec295f55242d405025487ec69fb0e420e4b0..e21e4657b81caf8ec14f4a744e19118689253825 100644 (file)
@@ -5,7 +5,7 @@ linux_packages := eudev liblzma libarchive libfuse libsquashfuse libappimage app
 linux_native_packages = native_patchelf
 
 darwin_packages :=
-darwin_native_packages = native_cctools native_libtapi native_clang
+darwin_native_packages = darwin_sdk native_cctools native_libtapi native_clang
 
 mingw32_packages = icu4c
 mingw32_native_packages = native_cmake
index a2f26da5fcfc09fdb88a939aa842b818658bdd18..67f0fb213dd67bf6bc750a2c2161cf0efa930671 100644 (file)
@@ -132,7 +132,7 @@ $(package)_config_opts_darwin += QMAKE_MACOSX_DEPLOYMENT_TARGET=$(OSX_MIN_VERSIO
 
 ifneq ($(build_os),darwin)
 $(package)_config_opts_darwin += -xplatform macx-clang
-$(package)_config_opts_darwin += -device-option MAC_SDK_PATH=$(OSX_SDK)
+$(package)_config_opts_darwin += -device-option MAC_SDK_PATH=$(host_prefix)/native/SDK
 $(package)_config_opts_darwin += -device-option MAC_SDK_VERSION=$(OSX_SDK_VERSION)
 $(package)_config_opts_darwin += -device-option CROSS_COMPILE="$(host)-"
 $(package)_config_opts_darwin += -device-option MAC_TARGET=$(host)
index 15a53fa98d0c56da030a836639e90f7b34bd9d22..041e7edc9b4bf7f831dcdfe902b35d3cd69a51ef 100644 (file)
@@ -2,7 +2,7 @@
 set(CMAKE_SYSTEM_NAME Darwin)
 
 # TODO: don't hardcode this
-set(TARGET_SYSROOT /feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers)
+set(TARGET_SYSROOT /feather/contrib/depends/x86_64-apple-darwin/native/SDK)
 set(CMAKE_SYSROOT ${TARGET_SYSROOT})
 set(CMAKE_OSX_SYSROOT ${TARGET_SYSROOT})
 
@@ -10,8 +10,8 @@ set(CMAKE_C_COMPILER clang)
 set(CMAKE_CXX_COMPILER clang++)
 
 # TODO: don't hardcode this
-set(CMAKE_C_FLAGS "--target=x86_64-apple-darwin -mmacosx-version-min=10.14 -B/feather/contrib/depends/x86_64-apple-darwin/native/bin -mlinker-version=609 -isysroot/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers -Xclang -internal-externc-isystem/gnu/store/rwsysyzpxzwi7g1jv4hxwi3m8i36iwcc-clang-10.0.1/lib/clang/10.0.1/include -Xclang -internal-externc-isystem/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers/usr/include")
-set(CMAKE_CXX_FLAGS "--target=x86_64-apple-darwin -mmacosx-version-min=10.14 -B/feather/contrib/depends/x86_64-apple-darwin/native/bin -mlinker-version=609 -isysroot/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers -stdlib=libc++ -stdlib++-isystem/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers/usr/include/c++/v1 -isystem/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers/usr/include/c++/v1 -isystem/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers/usr/include -Xclang -internal-externc-isystem/gnu/store/rwsysyzpxzwi7g1jv4hxwi3m8i36iwcc-clang-10.0.1/lib/clang/10.0.1/include -Xclang -internal-externc-isystem/feather/contrib/depends/SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers/usr/include")
+set(CMAKE_C_FLAGS "--target=x86_64-apple-darwin -mmacosx-version-min=10.14 -B/feather/contrib/depends/x86_64-apple-darwin/native/bin -mlinker-version=609 -isysroot/feather/contrib/depends/x86_64-apple-darwin/native/SDK -Xclang -internal-externc-isystem/gnu/store/rwsysyzpxzwi7g1jv4hxwi3m8i36iwcc-clang-10.0.1/lib/clang/10.0.1/include -Xclang -internal-externc-isystem/feather/contrib/depends/x86_64-apple-darwin/native/SDK/usr/include")
+set(CMAKE_CXX_FLAGS "--target=x86_64-apple-darwin -mmacosx-version-min=10.14 -B/feather/contrib/depends/x86_64-apple-darwin/native/bin -mlinker-version=609 -isysroot/feather/contrib/depends/x86_64-apple-darwin/native/SDK -stdlib=libc++ -stdlib++-isystem/feather/contrib/depends/x86_64-apple-darwin/native/SDK/usr/include/c++/v1 -isystem/feather/contrib/depends/x86_64-apple-darwin/native/SDK/usr/include/c++/v1 -isystem/feather/contrib/depends/x86_64-apple-darwin/native/SDK/usr/include -Xclang -internal-externc-isystem/gnu/store/rwsysyzpxzwi7g1jv4hxwi3m8i36iwcc-clang-10.0.1/lib/clang/10.0.1/include -Xclang -internal-externc-isystem/feather/contrib/depends/x86_64-apple-darwin/native/SDK/usr/include")
 
 set(CMAKE_INSTALL_NAME_TOOL x86_64-apple-darwin-install_name_tool)
 set(CMAKE_FIND_ROOT_PATH /feather/contrib/depends/x86_64-apple-darwin/)
index 91c3322776ed60913e81d51f92378da021b37c1a..0239be51d81f99433fc3889d537aa442a9b1aaaf 100644 (file)
@@ -15,7 +15,7 @@ SET(BUILD_TESTS @build_tests@)
 SET(TREZOR_DEBUG @build_tests@)
 
 # where is the target environment 
-SET(CMAKE_FIND_ROOT_PATH @prefix@ /feather/contrib/depends/SDKs/ /home/user/.guix-profile/@HOST@)
+SET(CMAKE_FIND_ROOT_PATH @prefix@ /home/user/.guix-profile/@HOST@)
 
 if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND ARCHITECTURE STREQUAL "x86_64")
   SET(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} /home/user/.guix-profile/)
@@ -61,6 +61,8 @@ endif()
 
 endif()
 
+set(ICONV_LIBRARIES @prefix@/lib/libiconv.a)
+
 SET(ZMQ_INCLUDE_PATH @prefix@/include)
 SET(ZMQ_LIB @prefix@/lib/libzmq.a)
 
@@ -111,7 +113,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
   SET(BUILD_64 ON)
   SET(BREW OFF)
   SET(PORT OFF)
-  SET(CMAKE_OSX_SYSROOT "@prefix@/../SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers/")
+  SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK")
   SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
   SET(CMAKE_CXX_STANDARD 14)
   SET(LLVM_ENABLE_PIC OFF)
index b0babbec019ea4f579fdfd41b94d64fcb865b2a3..a0ec561875c36c61ed2059360c11a485305ad191 100644 (file)
@@ -27,29 +27,6 @@ If you don't have Guix installed and set up, please follow the instructions in
 If you haven't considered your security model yet, please read [the relevant
 section](#choosing-your-security-model) before proceeding to perform a build.
 
-## Making the Xcode SDK available for macOS cross-compilation
-
-In order to perform a build for macOS (which is included in the default set of
-platform triples to build), you'll need to extract the macOS SDK tarball using
-tools found in the [`macdeploy` directory](../macdeploy/README.md).
-
-You can then either point to the SDK using the `SDK_PATH` environment variable:
-
-```sh
-# Extract the SDK tarball to /path/to/parent/dir/of/extracted/SDK/Xcode-<foo>-<bar>-extracted-SDK-with-libcxx-headers
-tar -C /path/to/parent/dir/of/extracted/SDK -xaf /path/to/Xcode-<foo>-<bar>-extracted-SDK-with-libcxx-headers.tar.gz
-
-# Indicate where to locate the SDK tarball
-export SDK_PATH=/path/to/parent/dir/of/extracted/SDK
-```
-
-or extract it into `depends/SDKs`:
-
-```sh
-mkdir -p depends/SDKs
-tar -C depends/SDKs -xaf /path/to/SDK/tarball
-```
-
 ## Building
 
 *The author highly recommends at least reading over the [common usage patterns
@@ -79,17 +56,17 @@ worktree to save disk space:
 
 ## Common `guix-build` invocation patterns and examples
 
-### Keeping caches and SDKs outside of the worktree
+### Keeping caches outside of the worktree
 
 If you perform a lot of builds and have a bunch of worktrees, you may find it
-more efficient to keep the depends tree's download cache, build cache, and SDKs
+more efficient to keep the depends tree's download cache and build cache
 outside of the worktrees to avoid duplicate downloads and unnecessary builds. To
 help with this situation, the `guix-build` script honours the `SOURCES_PATH`,
-`BASE_CACHE`, and `SDK_PATH` environment variables and will pass them on to the
+`BASE_CACHE` environment variables and will pass them on to the
 depends tree so that you can do something like:
 
 ```sh
-env SOURCES_PATH="$HOME/depends-SOURCES_PATH" BASE_CACHE="$HOME/depends-BASE_CACHE" SDK_PATH="$HOME/macOS-SDKs" ./contrib/guix/guix-build
+env SOURCES_PATH="$HOME/depends-SOURCES_PATH" BASE_CACHE="$HOME/depends-BASE_CACHE" ./contrib/guix/guix-build
 ```
 
 Note that the paths that these environment variables point to **must be
@@ -190,16 +167,6 @@ details.
   The path that this environment variable points to **must be a directory**, and
   **NOT a symlink to a directory**.
 
-* _**SDK_PATH**_
-
-  Set the path where _extracted_ SDKs can be found. This is passed through to
-  the depends tree. Note that this is should be set to the _parent_ directory of
-  the actual SDK (e.g. `SDK_PATH=$HOME/Downloads/macOS-SDKs` instead of
-  `$HOME/Downloads/macOS-SDKs/Xcode-12.2-12B45b-extracted-SDK-with-libcxx-headers`).
-
-  The path that this environment variable points to **must be a directory**, and
-  **NOT a symlink to a directory**.
-
 * _**JOBS**_
 
   Override the number of jobs to run simultaneously, you might want to do so on
index f01714ae342d2acfb39b59a827c0194ff4a0874d..cd263a9d97418cc352da6ea1851643643bc76699 100755 (executable)
@@ -109,7 +109,7 @@ Hint: To blow everything away, you may want to use:
   $ ./contrib/guix/guix-clean
 
 Specifically, this will remove all files without an entry in the index,
-excluding the SDK directory, the depends download cache, the depends built
+excluding the depends download cache, the depends built
 packages cache, the garbage collector roots for Guix environments, and the
 output directory.
 EOF
@@ -121,25 +121,6 @@ else
     mkdir -p "$DISTSRC_BASE"
 fi
 
-################
-# When building for darwin, the macOS SDK should exist
-################
-
-for host in $HOSTS; do
-    case "$host" in
-        *darwin*)
-            OSX_SDK="$(make -C "${PWD}/contrib/depends" --no-print-directory HOST="$host" print-OSX_SDK | sed 's@^[^=]\+=@@g')"
-            if [ -e "$OSX_SDK" ]; then
-                echo "Found macOS SDK at '${OSX_SDK}', using..."
-                break
-            else
-                echo "macOS SDK does not exist at '${OSX_SDK}', please place the extracted, untarred SDK there to perform darwin builds, or define SDK_PATH environment variable. Exiting..."
-                exit 1
-            fi
-            ;;
-    esac
-done
-
 ################
 # VERSION_BASE should have enough space
 ################
@@ -237,7 +218,7 @@ SOURCE_DATE_EPOCH="1676215618"
 
 # Precious directories are those which should not be cleaned between successive
 # guix builds
-depends_precious_dir_names='SOURCES_PATH BASE_CACHE SDK_PATH'
+depends_precious_dir_names='SOURCES_PATH BASE_CACHE'
 precious_dir_names="${depends_precious_dir_names} OUTDIR_BASE PROFILES_BASE"
 
 # Usage: contains IFS-SEPARATED-LIST ITEM
@@ -332,7 +313,7 @@ Hint: To blow everything away, you may want to use:
   $ ./contrib/guix/guix-clean
 
 Specifically, this will remove all files without an entry in the index,
-excluding the SDK directory, the depends download cache, the depends built
+excluding the depends download cache, the depends built
 packages cache, the garbage collector roots for Guix environments, and the
 output directory.
 EOF
@@ -441,7 +422,6 @@ EOF
                                  --expose="$(git rev-parse --git-common-dir)" \
                                  ${SOURCES_PATH:+--share="$SOURCES_PATH"} \
                                  ${BASE_CACHE:+--share="$BASE_CACHE"} \
-                                 ${SDK_PATH:+--share="$SDK_PATH"} \
                                  --cores="$JOBS" \
                                  --keep-failed \
                                  --fallback \
@@ -457,7 +437,6 @@ EOF
                                         ${V:+V=1} \
                                         ${SOURCES_PATH:+SOURCES_PATH="$SOURCES_PATH"} \
                                         ${BASE_CACHE:+BASE_CACHE="$BASE_CACHE"} \
-                                        ${SDK_PATH:+SDK_PATH="$SDK_PATH"} \
                                         DISTSRC="$(DISTSRC_BASE=/distsrc-base && distsrc_for_host "$host")" \
                                         OUTDIR="$(OUTDIR_BASE=/outdir-base && outdir_for_host "$host")" \
                                         DIST_ARCHIVE_BASE=/outdir-base/dist-archive \
index 0235fb3aa519d5098c4bfe8029344bbb8c995207..ada21ff6a0c577fb2bf79a7cc19359fc3da6e718 100644 (file)
@@ -32,10 +32,6 @@ add_subdirectory(openpgp)
 
 qt_add_resources(RESOURCES assets.qrc assets_tor.qrc)
 
-if (DEPENDS)
-    find_library(ICONV_LIBRARIES iconv)
-endif()
-
 # Compile source files (.h/.cpp)
 file(GLOB SOURCE_FILES
         "*.h"