diff --git a/contrib/depends/hosts/darwin.mk b/contrib/depends/hosts/darwin.mk index 58ff5dc32c..cea4f74305 100644 --- a/contrib/depends/hosts/darwin.mk +++ b/contrib/depends/hosts/darwin.mk @@ -2,14 +2,26 @@ OSX_MIN_VERSION=10.13 OSX_SDK_VERSION=11.0 XCODE_VERSION=12.2 XCODE_BUILD_ID=12B45b -LD64_VERSION=609 +LD64_VERSION=711 OSX_SDK=$(host_prefix)/native/SDK -darwin_native_toolchain=darwin_sdk native_cctools +darwin_native_toolchain=darwin_sdk -clang_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang") -clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++") + +clang_prog=clang +clangxx_prog=clang++ +llvm_config_prog=llvm-config + +llvm_lib_dir=$(shell $(llvm_config_prog) --libdir) + +darwin_AR=llvm-ar +darwin_DSYMUTIL=dsymutil +darwin_NM=llvm-nm +darwin_OBJDUMP=llvm-objdump +darwin_RANLIB=llvm-ranlib +darwin_STRIP=llvm-strip +darwin_LIBTOOL=llvm-libtool-darwin # Flag explanations: # @@ -37,23 +49,23 @@ clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++") darwin_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \ -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \ -u LIBRARY_PATH \ - $(clang_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \ - -B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \ - -isysroot$(OSX_SDK) \ + $(clang_prog) --target=$(host) \ + -B$(build_prefix)/bin \ -isysroot$(OSX_SDK) -nostdlibinc \ -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \ -u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \ -u LIBRARY_PATH \ - $(clangxx_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \ - -B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \ + $(clangxx_prog) --target=$(host) \ + -B$(build_prefix)/bin \ -isysroot$(OSX_SDK) -nostdlibinc \ -iwithsysroot/usr/include/c++/v1 \ -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks -darwin_CFLAGS=-pipe -darwin_CXXFLAGS=$(darwin_CFLAGS) +darwin_CFLAGS=-pipe -mmacosx-version-min=$(OSX_MIN_VERSION) -mlinker-version=$(LD64_VERSION) +darwin_CXXFLAGS=-pipe -mmacosx-version-min=$(OSX_MIN_VERSION) -mlinker-version=$(LD64_VERSION) +darwin_LDFLAGS=-Wl,-platform_version,macos,$(OSX_MIN_VERSION),$(OSX_SDK_VERSION) -Wl,-no_adhoc_codesign -fuse-ld=lld darwin_ARFLAGS=cr darwin_release_CFLAGS=-O2 diff --git a/contrib/depends/packages/libusb.mk b/contrib/depends/packages/libusb.mk index 53c91134c8..a4b24f8263 100644 --- a/contrib/depends/packages/libusb.mk +++ b/contrib/depends/packages/libusb.mk @@ -3,8 +3,10 @@ $(package)_version=1.0.27 $(package)_download_path=https://github.com/libusb/libusb/releases/download/v$($(package)_version) $(package)_file_name=$(package)-$($(package)_version).tar.bz2 $(package)_sha256_hash=ffaa41d741a8a3bee244ac8e54a72ea05bf2879663c098c82fc5757853441575 +$(package)_patches=fix-c11-check.patch define $(package)_preprocess_cmds + patch -p1 < $($(package)_patch_dir)/fix-c11-check.patch && \ cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub . && \ autoreconf -i endef diff --git a/contrib/depends/packages/native_cctools.mk b/contrib/depends/packages/native_cctools.mk deleted file mode 100644 index a019b1649e..0000000000 --- a/contrib/depends/packages/native_cctools.mk +++ /dev/null @@ -1,37 +0,0 @@ -package=native_cctools -$(package)_version=04663295d0425abfac90a42440a7ec02d7155fea -$(package)_download_path=https://github.com/tpoechtrager/cctools-port/archive -$(package)_download_file=$($(package)_version).tar.gz -$(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=70a7189418c2086d20c299c5d59250cf5940782c778892ccc899c66516ed240e -$(package)_build_subdir=cctools -$(package)_patches=no-build-date.patch -$(package)_dependencies=native_libtapi - -define $(package)_set_vars -$(package)_config_opts=--target=$(host) --disable-lto-support --with-libtapi=$(host_prefix) -$(package)_ldflags+=-Wl,-rpath=\\$$$$$$$$\$$$$$$$$ORIGIN/../lib -$(package)_cc=$(clang_prog) -$(package)_cxx=$(clangxx_prog) -endef - -define $(package)_preprocess_cmds - cp -f $(BASEDIR)/config.guess $(BASEDIR)/config.sub cctools -endef - -define $(package)_preprocess_cmds - patch -p1 < $($(package)_patch_dir)/no-build-date.patch -endef - -define $(package)_config_cmds - $($(package)_autoconf) -endef - -define $(package)_build_cmds - $(MAKE) -endef - -define $(package)_stage_cmds - $(MAKE) DESTDIR=$($(package)_staging_dir) install && \ - cp $($(package)_extract_dir)/cctools/misc/install_name_tool $($(package)_staging_prefix_dir)/bin/ -endef diff --git a/contrib/depends/packages/native_libtapi.mk b/contrib/depends/packages/native_libtapi.mk deleted file mode 100644 index 36234a001c..0000000000 --- a/contrib/depends/packages/native_libtapi.mk +++ /dev/null @@ -1,19 +0,0 @@ -package=native_libtapi -$(package)_version=664b8414f89612f2dfd35a9b679c345aa5389026 -$(package)_download_path=https://github.com/tpoechtrager/apple-libtapi/archive -$(package)_download_file=$($(package)_version).tar.gz -$(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=62e419c12d1c9fad67cc1cd523132bc00db050998337c734c15bc8d73cc02b61 -$(package)_patches=no_embed_git_rev.patch - -define $(package)_preprocess_cmds - patch -p1 -i $($(package)_patch_dir)/no_embed_git_rev.patch -endef - -define $(package)_build_cmds - CC=$(clang_prog) CXX=$(clangxx_prog) INSTALLPREFIX=$($(package)_staging_prefix_dir) ./build.sh -endef - -define $(package)_stage_cmds - ./install.sh -endef diff --git a/contrib/depends/packages/packages.mk b/contrib/depends/packages/packages.mk index cb4e8e228a..68935608b9 100644 --- a/contrib/depends/packages/packages.mk +++ b/contrib/depends/packages/packages.mk @@ -24,5 +24,5 @@ mingw32_packages = $(hardware_packages) mingw32_native_packages = $(hardware_native_packages) ifneq ($(build_os),darwin) -darwin_native_packages += darwin_sdk native_cctools native_libtapi +darwin_native_packages += darwin_sdk endif diff --git a/contrib/depends/packages/zeromq.mk b/contrib/depends/packages/zeromq.mk index 669d06d839..106b5678ec 100644 --- a/contrib/depends/packages/zeromq.mk +++ b/contrib/depends/packages/zeromq.mk @@ -8,7 +8,6 @@ define $(package)_set_vars $(package)_config_opts=--without-documentation --disable-shared --without-libsodium --disable-curve $(package)_config_opts_linux=--with-pic $(package)_config_opts_freebsd=--with-pic - $(package)_cxxflags=-std=c++11 endef define $(package)_config_cmds diff --git a/contrib/depends/patches/libusb/fix-c11-check.patch b/contrib/depends/patches/libusb/fix-c11-check.patch new file mode 100644 index 0000000000..93b005763e --- /dev/null +++ b/contrib/depends/patches/libusb/fix-c11-check.patch @@ -0,0 +1,22 @@ +diff --git a/configure.ac b/configure.ac +index 6dc7c698..eebe10a1 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -46,7 +46,7 @@ dnl note that we don't just check if the compiler accepts '-std=x11' + dnl but also that it supports the _Thread_local keyword because some compilers + dnl (e.g. gcc 4.8) accept the command line option but do not implement TLS + saved_CFLAGS="${CFLAGS}" +-CFLAGS="-std=gnu11" ++CFLAGS="${saved_CFLAGS} -std=gnu11" + AC_MSG_CHECKING([if $CC supports -std=gnu11]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_Thread_local int x;], [x = 42;])], + [AC_MSG_RESULT([yes]) +@@ -55,7 +55,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_Thread_local int x;], [x = 42;])], + c_dialect=]) + if test "x$c_dialect" != xgnu; then + dnl fallback check for -std=c11 compiler support (required) +- CFLAGS="-std=c11" ++ CFLAGS="${saved_CFLAGS} -std=c11" + AC_MSG_CHECKING([if $CC supports -std=c11]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_Thread_local int x;], [x = 42;])], + [AC_MSG_RESULT([yes])], diff --git a/contrib/depends/patches/native_cctools/no-build-date.patch b/contrib/depends/patches/native_cctools/no-build-date.patch deleted file mode 100644 index 8b7d1e1f76..0000000000 --- a/contrib/depends/patches/native_cctools/no-build-date.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/cctools/ld64/src/ld/Options.cpp b/cctools/ld64/src/ld/Options.cpp -index 3bb8324..033760d 100644 ---- a/cctools/ld64/src/ld/Options.cpp -+++ b/cctools/ld64/src/ld/Options.cpp -@@ -4279,7 +4279,6 @@ void Options::buildSearchPaths(int argc, const char* argv[]) - fVerbose = true; - extern const char ldVersionString[]; - fprintf(stderr, "%s", ldVersionString); -- fprintf(stderr, "BUILD " __TIME__ " " __DATE__"\n"); - fprintf(stderr, "configured to support archs: %s\n", ALL_SUPPORTED_ARCHS); - // if only -v specified, exit cleanly - if ( argc == 2 ) { diff --git a/contrib/depends/patches/native_libtapi/no_embed_git_rev.patch b/contrib/depends/patches/native_libtapi/no_embed_git_rev.patch deleted file mode 100644 index b898ccb43f..0000000000 --- a/contrib/depends/patches/native_libtapi/no_embed_git_rev.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/src/llvm/CMakeLists.txt b/src/llvm/CMakeLists.txt -index ab92717c8..4ad621ea3 100644 ---- a/src/llvm/CMakeLists.txt -+++ b/src/llvm/CMakeLists.txt -@@ -752,9 +752,10 @@ set(LLVM_SRPM_USER_BINARY_SPECFILE ${CMAKE_CURRENT_SOURCE_DIR}/llvm.spec.in - set(LLVM_SRPM_BINARY_SPECFILE ${CMAKE_CURRENT_BINARY_DIR}/llvm.spec) - set(LLVM_SRPM_DIR "${CMAKE_CURRENT_BINARY_DIR}/srpm") - --# SVN_REVISION and GIT_COMMIT get set by the call to add_version_info_from_vcs. --# DUMMY_VAR contains a version string which we don't care about. --add_version_info_from_vcs(DUMMY_VAR) -+# A call to add_version_info_from_vcs() was removed, leaving SVN_REVISION -+# and GIT_COMMIT unset. Accordingly, LLVM_RPM_SPEC_REVISION is left empty. -+# This variable appears to be unused. Since it may be used in a future -+# update of native_libtapi this change serves as a precautionairy measure. - if ( SVN_REVISION ) - set(LLVM_RPM_SPEC_REVISION "r${SVN_REVISION}") - elseif ( GIT_COMMIT ) -diff --git a/src/llvm/cmake/modules/GenerateVersionFromCVS.cmake b/src/llvm/cmake/modules/GenerateVersionFromCVS.cmake -index 6b1c71983..e16326ed6 100644 ---- a/src/llvm/cmake/modules/GenerateVersionFromCVS.cmake -+++ b/src/llvm/cmake/modules/GenerateVersionFromCVS.cmake -@@ -24,7 +24,7 @@ include(VersionFromVCS) - set(ENV{TERM} "dumb") - - function(append_info name path) -- add_version_info_from_vcs(REVISION ${path}) -+ set(REVISION "git-0000000") - string(STRIP "${REVISION}" REVISION) - file(APPEND "${HEADER_FILE}.txt" - "#define ${name} \"${REVISION}\"\n") diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in index f5a7264e3e..da3922ebe2 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in @@ -80,12 +80,16 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") SET(_CMAKE_TOOLCHAIN_PREFIX @prefix@/native/bin/${CONF_TRIPLE}-) SET(CMAKE_C_COMPILER @CC@) SET(CMAKE_C_COMPILER_TARGET ${CLANG_TARGET}) - SET(CMAKE_C_FLAGS_INIT -B${_CMAKE_TOOLCHAIN_PREFIX}) + SET(CMAKE_C_FLAGS "@CFLAGS@") SET(CMAKE_CXX_COMPILER @CXX@ -stdlib=libc++) SET(CMAKE_CXX_COMPILER_TARGET ${CLANG_TARGET}) - SET(CMAKE_CXX_FLAGS_INIT -B${_CMAKE_TOOLCHAIN_PREFIX}) + SET(CMAKE_CXX_FLAGS "@CXXFLAGS@") + set(CMAKE_EXE_LINKER_FLAGS "@LDFLAGS@") + set(CMAKE_MODULE_LINKER_FLAGS "@LDFLAGS@") + set(CMAKE_SHARED_LINKER_FLAGS "@LDFLAGS@") + set(CMAKE_INSTALL_NAME_TOOL llvm-install-name-tool) SET(CMAKE_ASM_COMPILER clang) - SET(CMAKE_ASM-ATT_COMPILER as) + SET(CMAKE_ASM-ATT_COMPILER llvm-as) SET(CMAKE_ASM_COMPILER_TARGET ${CLANG_TARGET}) SET(CMAKE_ASM-ATT_COMPILER_TARGET ${CLANG_TARGET}) SET(APPLE True) @@ -95,8 +99,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") SET(CMAKE_OSX_SYSROOT "@prefix@/native/SDK/") SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.13") SET(CMAKE_CXX_STANDARD 17) - SET(LLVM_ENABLE_PIC OFF) - SET(LLVM_ENABLE_PIE OFF) elseif(CMAKE_SYSTEM_NAME STREQUAL "Android") SET(ANDROID TRUE) if(ARCHITECTURE STREQUAL "arm") diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index 63b88bcee0..cb08e6e54b 100644 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -164,20 +164,7 @@ for p in "${PATHS[@]}"; do done # Disable Guix ld auto-rpath behavior -case "$HOST" in - *darwin*) - # The auto-rpath behavior is necessary for darwin builds as some native - # tools built by depends refer to and depend on Guix-built native - # libraries - # - # After the native packages in depends are built, the ld wrapper should - # no longer affect our build, as clang would instead reach for - # x86_64-apple-darwin-ld from cctools - ;; - *android*) - ;; - *) export GUIX_LD_WRAPPER_DISABLE_RPATH=yes ;; -esac +export GUIX_LD_WRAPPER_DISABLE_RPATH=yes # Make /usr/bin if it doesn't exist [ -e /usr/bin ] || mkdir -p /usr/bin @@ -220,16 +207,6 @@ export GLIBC_DYNAMIC_LINKER=${glibc_dynamic_linker} # Environment variables for determinism export TAR_OPTIONS="--owner=0 --group=0 --numeric-owner --mtime='@${SOURCE_DATE_EPOCH}' --sort=name" export TZ="UTC" -case "$HOST" in - *darwin*) - # cctools AR, unlike GNU binutils AR, does not have a deterministic mode - # or a configure flag to enable determinism by default, it only - # understands if this env-var is set or not. See: - # - # https://github.com/tpoechtrager/cctools-port/blob/55562e4073dea0fbfd0b20e0bf69ffe6390c7f97/cctools/ar/archive.c#L334 - export ZERO_AR_DATE=yes - ;; -esac #################### # Depends Building # diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 247531d4ca..a76a7c9cde 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -308,6 +308,7 @@ chain for " target " development.")) ((string-contains target "darwin") (list gcc-toolchain-10 - clang-toolchain-11 - binutils)) + clang-toolchain-17 + lld-17 + (make-lld-wrapper lld-17 #:lld-as-ld? #t))) (else '())))))