From 091477d8535121aa6bbcf17981a7526c02259fcb Mon Sep 17 00:00:00 2001
From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com>
Date: Tue, 5 Oct 2021 08:04:26 +0530
Subject: [PATCH 1/3] merge bitcoin#19817: macOS toolchain bump

---
 .gitlab-ci.yml                                |  4 +--
 contrib/gitian-build.py                       |  4 +--
 contrib/gitian-descriptors/gitian-osx.yml     |  4 +--
 contrib/macdeploy/README.md                   | 16 ++++++------
 depends/hosts/darwin.mk                       | 19 +++++---------
 depends/packages/native_cctools.mk            |  9 ++-----
 depends/packages/native_libtapi.mk            |  4 +--
 .../ld64_disable_threading.patch              | 26 -------------------
 doc/build-cross.md                            |  4 +--
 9 files changed, 27 insertions(+), 63 deletions(-)
 delete mode 100644 depends/patches/native_cctools/ld64_disable_threading.patch

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 976f287a714f..804b5a85b365 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -37,8 +37,8 @@ builder-image:
   image: $CI_REGISTRY_IMAGE:builder-$CI_COMMIT_REF_SLUG
   variables:
     SDK_URL: https://bitcoincore.org/depends-sources/sdks
-    XCODE_VERSION: 11.3.1
-    XCODE_BUILD_ID: 11C505
+    XCODE_VERSION: "12.1"
+    XCODE_BUILD_ID: 12A7403
     MAKEJOBS: -j4
   before_script:
     - echo HOST=$HOST
diff --git a/contrib/gitian-build.py b/contrib/gitian-build.py
index ef1733daa7b6..d6ed090b426c 100755
--- a/contrib/gitian-build.py
+++ b/contrib/gitian-build.py
@@ -71,8 +71,8 @@ def build():
 
     if args.macos:
         print('\nCompiling ' + args.version + ' MacOS')
-        subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://bitcoincore.org/depends-sources/sdks/Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz'])
-        subprocess.check_output(["echo '436df6dfc7073365d12f8ef6c1fdb060777c720602cc67c2dcf9a59d94290e38 inputs/Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz' | sha256sum -c"], shell=True)
+        subprocess.check_call(['wget', '-N', '-P', 'inputs', 'https://bitcoincore.org/depends-sources/sdks/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz'])
+        subprocess.check_output(["echo 'be17f48fd0b08fb4dcd229f55a6ae48d9f781d210839b4ea313ef17dd12d6ea5 inputs/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz' | sha256sum -c"], shell=True)
         subprocess.check_call(['bin/gbuild', '-j', args.jobs, '-m', args.memory, '--commit', 'dash='+args.commit, '--url', 'dash='+args.url, '../dash/contrib/gitian-descriptors/gitian-osx.yml'])
         subprocess.check_call(['bin/gsign', '-p', args.sign_prog, '--signer', args.signer, '--release', args.version+'-osx-unsigned', '--destination', '../gitian.sigs/', '../dash/contrib/gitian-descriptors/gitian-osx.yml'])
         subprocess.check_call('mv build/out/dashcore-*-osx-unsigned.tar.gz inputs/', shell=True)
diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml
index 3ce4e63cb8ad..b2fbfe540e86 100644
--- a/contrib/gitian-descriptors/gitian-osx.yml
+++ b/contrib/gitian-descriptors/gitian-osx.yml
@@ -33,7 +33,7 @@ remotes:
 - "url": "https://github.com/dashpay/dash.git"
   "dir": "dash"
 files:
-- "Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz"
+- "Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz"
 script: |
   set -e -o pipefail
 
@@ -109,7 +109,7 @@ script: |
   BASEPREFIX="${PWD}/depends"
 
   mkdir -p ${BASEPREFIX}/SDKs
-  tar -C ${BASEPREFIX}/SDKs -xf ${BUILD_DIR}/Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz
+  tar -C ${BASEPREFIX}/SDKs -xf ${BUILD_DIR}/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz
 
   # Build dependencies for each host
   for i in $HOSTS; do
diff --git a/contrib/macdeploy/README.md b/contrib/macdeploy/README.md
index fb0e0f5dd2b0..c9e1f44231f8 100644
--- a/contrib/macdeploy/README.md
+++ b/contrib/macdeploy/README.md
@@ -17,9 +17,9 @@ When complete, it will have produced `Dash-Qt.dmg`.
 ### Step 1: Obtaining `Xcode.app`
 
 Our current macOS SDK
-(`Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz`) can be
+(`Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz`) can be
 extracted from
-[Xcode_11.3.1.xip](https://download.developer.apple.com/Developer_Tools/Xcode_11.3.1/Xcode_11.3.1.xip).
+[Xcode_12.1.xip](https://download.developer.apple.com/Developer_Tools/Xcode_12.1/Xcode_12.1.xip).
 An Apple ID is needed to download this.
 
 After Xcode version 7.x, Apple started shipping the `Xcode.app` in a `.xip`
@@ -31,25 +31,25 @@ approach (tested on Debian Buster) is outlined below:
 apt install cpio
 git clone https://github.com/bitcoin-core/apple-sdk-tools.git
 
-# Unpack Xcode_11.3.1.xip and place the resulting Xcode.app in your current
+# Unpack Xcode_12.1.xip and place the resulting Xcode.app in your current
 # working directory
-python3 apple-sdk-tools/extract_xcode.py -f Xcode_11.3.1.xip | cpio -d -i
+python3 apple-sdk-tools/extract_xcode.py -f Xcode_12.1.xip | cpio -d -i
 ```
 
 On macOS the process is more straightforward:
 
 ```bash
-xip -x Xcode_11.3.1.xip
+xip -x Xcode_12.1.xip
 ```
 
-### Step 2: Generating `Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz` from `Xcode.app`
+### Step 2: Generating `Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz` from `Xcode.app`
 
-To generate `Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz`, run
+To generate `Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz`, run
 the script [`gen-sdk`](./gen-sdk) with the path to `Xcode.app` (extracted in the
 previous stage) as the first argument.
 
 ```bash
-# Generate a Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz from
+# Generate a Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz from
 # the supplied Xcode.app
 ./contrib/macdeploy/gen-sdk '/path/to/Xcode.app'
 ```
diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk
index 50c9a8e13d68..c7120872edd5 100644
--- a/depends/hosts/darwin.mk
+++ b/depends/hosts/darwin.mk
@@ -1,8 +1,8 @@
 OSX_MIN_VERSION=10.14
-OSX_SDK_VERSION=10.15.1
-XCODE_VERSION=11.3.1
-XCODE_BUILD_ID=11C505
-LD64_VERSION=530
+OSX_SDK_VERSION=10.15.6
+XCODE_VERSION=12.1
+XCODE_BUILD_ID=12A7403
+LD64_VERSION=609
 
 OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers
 
@@ -60,16 +60,11 @@ $(foreach TOOL,$(cctools_TOOLS),$(eval darwin_$(TOOL) = $$(build_prefix)/bin/$$(
 #         Explicitly point to our binaries (e.g. cctools) so that they are
 #         ensured to be found and preferred over other possibilities.
 #
-#     -stdlib=libc++ -nostdinc++ -Xclang -cxx-isystem$(OSX_SDK)/usr/include/c++/v1
+#     -stdlib=libc++ -stdlib++-isystem$(OSX_SDK)/usr/include/c++/v1
 #
 #         Forces clang to use the libc++ headers from our SDK and completely
 #         forget about the libc++ headers from the standard directories
 #
-#         TODO: Once we start requiring a clang version that has the
-#         -stdlib++-isystem<directory> flag first introduced here:
-#         https://reviews.llvm.org/D64089, we should use that instead. Read the
-#         differential summary there for more details.
-#
 #     -Xclang -*system<path_a> \
 #     -Xclang -*system<path_b> \
 #     -Xclang -*system<path_c> ...
@@ -109,8 +104,8 @@ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
              $(clangxx_prog) --target=$(host) -mmacosx-version-min=$(OSX_MIN_VERSION) \
                -B$(build_prefix)/bin -mlinker-version=$(LD64_VERSION) \
                -isysroot$(OSX_SDK) \
-               -stdlib=libc++ -nostdinc++ \
-               -Xclang -cxx-isystem$(OSX_SDK)/usr/include/c++/v1 \
+               -stdlib=libc++ \
+               -stdlib++-isystem$(OSX_SDK)/usr/include/c++/v1 \
                -Xclang -internal-externc-isystem$(clang_resource_dir)/include \
                -Xclang -internal-externc-isystem$(OSX_SDK)/usr/include
 
diff --git a/depends/packages/native_cctools.mk b/depends/packages/native_cctools.mk
index c789dab74cb8..885207fce9af 100644
--- a/depends/packages/native_cctools.mk
+++ b/depends/packages/native_cctools.mk
@@ -1,10 +1,9 @@
 package=native_cctools
-$(package)_version=55562e4073dea0fbfd0b20e0bf69ffe6390c7f97
+$(package)_version=2ef2e931cf641547eb8a68cfebde61003587c9fd
 $(package)_download_path=https://github.com/tpoechtrager/cctools-port/archive
 $(package)_file_name=$($(package)_version).tar.gz
-$(package)_sha256_hash=e51995a843533a3dac155dd0c71362dd471597a2d23f13dff194c6285362f875
+$(package)_sha256_hash=6b73269efdf5c58a070e7357b66ee760501388549d6a12b423723f45888b074b
 $(package)_build_subdir=cctools
-$(package)_patches=ld64_disable_threading.patch
 $(package)_dependencies=native_libtapi
 
 define $(package)_set_vars
@@ -17,10 +16,6 @@ define $(package)_set_vars
   $(package)_cxx=$(clangxx_prog)
 endef
 
-define $(package)_preprocess_cmds
-  patch -p1 < $($(package)_patch_dir)/ld64_disable_threading.patch
-endef
-
 define $(package)_config_cmds
   $($(package)_autoconf)
 endef
diff --git a/depends/packages/native_libtapi.mk b/depends/packages/native_libtapi.mk
index d7ac4156a747..60b898da5f2f 100644
--- a/depends/packages/native_libtapi.mk
+++ b/depends/packages/native_libtapi.mk
@@ -1,9 +1,9 @@
 package=native_libtapi
-$(package)_version=3efb201881e7a76a21e0554906cf306432539cef
+$(package)_version=664b8414f89612f2dfd35a9b679c345aa5389026
 $(package)_download_path=https://github.com/tpoechtrager/apple-libtapi/archive
 $(package)_download_file=$($(package)_version).tar.gz
 $(package)_file_name=$($(package)_version).tar.gz
-$(package)_sha256_hash=380c1ca37cfa04a8699d0887a8d3ee1ad27f3d08baba78887c73b09485c0fbd3
+$(package)_sha256_hash=62e419c12d1c9fad67cc1cd523132bc00db050998337c734c15bc8d73cc02b61
 
 ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
 $(package)_dependencies=native_clang
diff --git a/depends/patches/native_cctools/ld64_disable_threading.patch b/depends/patches/native_cctools/ld64_disable_threading.patch
deleted file mode 100644
index d6c58c102fb3..000000000000
--- a/depends/patches/native_cctools/ld64_disable_threading.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-commit 584668415039adeed073decee7e04de28248afd3
-Author: fanquake <fanquake@gmail.com>
-Date:   Tue Aug 18 01:20:24 2020 +0000
-
-    Disable threading to fix non-determinism
-
-    A bug in the file parser can cause dependencies to be calculated
-    differently based on which files have already been parsed. This is more
-    likely to occur on systems with more CPUs.
-
-    Just disable threading for now. There is no noticable slowdown.
-
-    See #9891.
-
-diff --git a/cctools/ld64/src/ld/InputFiles.h b/cctools/ld64/src/ld/InputFiles.h
-index ef9c756..90a70b6 100644
---- a/cctools/ld64/src/ld/InputFiles.h
-+++ b/cctools/ld64/src/ld/InputFiles.h
-@@ -25,7 +25,6 @@
- #ifndef __INPUT_FILES_H__
- #define __INPUT_FILES_H__
-
--#define HAVE_PTHREADS 1
-
- #include <stdlib.h>
- #include <sys/types.h>
diff --git a/doc/build-cross.md b/doc/build-cross.md
index 43785958bcd9..bf760ab2b9e5 100644
--- a/doc/build-cross.md
+++ b/doc/build-cross.md
@@ -19,8 +19,8 @@ Additionally, the Mac OSX SDK must be downloaded and extracted manually:
 ```bash
 $ mkdir -p depends/sdk-sources
 $ mkdir -p depends/SDKs
-$ curl https://bitcoincore.org/depends-sources/sdks/Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz -o depends/sdk-sources/Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz
-$ tar -C depends/SDKs -xf depends/sdk-sources/Xcode-11.3.1-11C505-extracted-SDK-with-libcxx-headers.tar.gz
+$ curl https://bitcoincore.org/depends-sources/sdks/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz -o depends/sdk-sources/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz
+$ tar -C depends/SDKs -xf depends/sdk-sources/Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz
 ```
 
 When building the dependencies, as described in [build-generic](build-generic.md), use

From fd03a23e85b3244d8f777049b9e9df68708cf6e5 Mon Sep 17 00:00:00 2001
From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com>
Date: Fri, 25 Sep 2020 21:18:01 -0400
Subject: [PATCH 2/3] merge bitcoin#20470: Replace genisoimage with xorriso

---
 .gitignore                                    |  1 +
 Makefile.am                                   |  9 +-
 ci/Dockerfile.builder                         |  2 +-
 configure.ac                                  |  3 +-
 .../gitian-descriptors/gitian-osx-signer.yml  |  5 +-
 contrib/gitian-descriptors/gitian-osx.yml     | 11 ++-
 contrib/macdeploy/README.md                   | 14 ++-
 depends/packages/native_cdrkit.mk             | 27 ------
 depends/packages/packages.mk                  |  2 +-
 .../native_cdrkit/cdrkit-deterministic.patch  | 86 -------------------
 10 files changed, 25 insertions(+), 135 deletions(-)
 delete mode 100644 depends/packages/native_cdrkit.mk
 delete mode 100644 depends/patches/native_cdrkit/cdrkit-deterministic.patch

diff --git a/.gitignore b/.gitignore
index d8124490a4d3..8548dfca3a93 100644
--- a/.gitignore
+++ b/.gitignore
@@ -74,6 +74,7 @@ libconftest.dylib*
 *.log
 *.trs
 *.dmg
+*.iso
 
 *.json.h
 *.raw.h
diff --git a/Makefile.am b/Makefile.am
index a48d3a6c28ea..92f1b51be0dd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,6 +34,7 @@ space := $(empty) $(empty)
 OSX_APP=Dash-Qt.app
 OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME))
 OSX_DMG = $(OSX_VOLNAME).dmg
+OSX_TEMP_ISO = $(OSX_DMG:.dmg=).temp.iso
 OSX_BACKGROUND_SVG=background.svg
 OSX_BACKGROUND_IMAGE=background.tiff
 OSX_BACKGROUND_IMAGE_DPIS=36 72
@@ -144,8 +145,12 @@ $(APP_DIST_DIR)/Applications:
 
 $(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Dash-Qt
 
-$(OSX_DMG): $(APP_DIST_EXTRAS)
-	$(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -apple -o $@ dist
+.INTERMEDIATE: $(OSX_TEMP_ISO)
+$(OSX_TEMP_ISO): $(APP_DIST_EXTRAS)
+	$(XORRISOFS) -D -l -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -o $@ dist
+
+$(OSX_DMG): $(OSX_TEMP_ISO)
+	$(DMG) dmg "$<" "$@"
 
 dpi%.$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_SVG)
 	sed 's/PACKAGE_NAME/$(PACKAGE_NAME)/' < "$<" | $(RSVG_CONVERT) -f png -d $* -p $* | $(IMAGEMAGICK_CONVERT) - $@
diff --git a/ci/Dockerfile.builder b/ci/Dockerfile.builder
index 7f7a611acbfd..abbe621ca918 100644
--- a/ci/Dockerfile.builder
+++ b/ci/Dockerfile.builder
@@ -38,7 +38,7 @@ RUN dpkg --add-architecture i386
 RUN apt-get update && apt-get install $APT_ARGS g++-7-multilib && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install $APT_ARGS g++-arm-linux-gnueabihf && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install $APT_ARGS g++-mingw-w64-x86-64 && rm -rf /var/lib/apt/lists/*
-RUN apt-get update && apt-get install $APT_ARGS wine-stable wine32 wine64 bc nsis && rm -rf /var/lib/apt/lists/*
+RUN apt-get update && apt-get install $APT_ARGS wine-stable wine32 wine64 bc nsis xorriso && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install $APT_ARGS python3-zmq && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install $APT_ARGS shellcheck cppcheck && rm -rf /var/lib/apt/lists/*
 RUN apt-get update && apt-get install $APT_ARGS imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools && rm -rf /var/lib/apt/lists/*
diff --git a/configure.ac b/configure.ac
index d2eaaed9dca9..c907d8a3c40a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -645,7 +645,8 @@ case $host in
            AC_PATH_TOOL([DSYMUTIL], [dsymutil], dsymutil)
            AC_PATH_TOOL([INSTALLNAMETOOL], [install_name_tool], install_name_tool)
            AC_PATH_TOOL([OTOOL], [otool], otool)
-           AC_PATH_PROGS([GENISOIMAGE], [genisoimage mkisofs],genisoimage)
+           AC_PATH_PROGS([XORRISOFS], [xorrisofs], xorrisofs)
+           AC_PATH_PROGS([DMG], [dmg], dmg)
            AC_PATH_PROGS([RSVG_CONVERT], [rsvg-convert rsvg],rsvg-convert)
            AC_PATH_PROGS([IMAGEMAGICK_CONVERT], [convert],convert)
            AC_PATH_PROGS([TIFFCP], [tiffcp],tiffcp)
diff --git a/contrib/gitian-descriptors/gitian-osx-signer.yml b/contrib/gitian-descriptors/gitian-osx-signer.yml
index 838134f48963..98eefecb8068 100644
--- a/contrib/gitian-descriptors/gitian-osx-signer.yml
+++ b/contrib/gitian-descriptors/gitian-osx-signer.yml
@@ -7,6 +7,7 @@ architectures:
 - "amd64"
 packages:
 - "faketime"
+- "xorriso"
 remotes:
 - "url": "https://github.com/dashpay/dash-detached-sigs.git"
   "dir": "signature"
@@ -18,7 +19,7 @@ script: |
   WRAP_DIR=$HOME/wrapped
   mkdir -p ${WRAP_DIR}
   export PATH="$PWD":$PATH
-  FAKETIME_PROGS="dmg genisoimage"
+  FAKETIME_PROGS="dmg xorrisofs"
 
   # Create global faketime wrappers
   for prog in ${FAKETIME_PROGS}; do
@@ -36,5 +37,5 @@ script: |
   tar -xf ${UNSIGNED}
   OSX_VOLNAME="$(cat osx_volname)"
   ./detached-sig-apply.sh ${UNSIGNED} signature/osx
-  ${WRAP_DIR}/genisoimage -no-cache-inodes -D -l -probe -V "${OSX_VOLNAME}" -no-pad -r -dir-mode 0755 -apple -o uncompressed.dmg signed-app
+  ${WRAP_DIR}/xorrisofs -D -l -V "${OSX_VOLNAME}" -no-pad -r -dir-mode 0755 -o uncompressed.dmg signed-app
   ${WRAP_DIR}/dmg dmg uncompressed.dmg ${OUTDIR}/${SIGNED}
diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml
index b2fbfe540e86..e9fdcd18380b 100644
--- a/contrib/gitian-descriptors/gitian-osx.yml
+++ b/contrib/gitian-descriptors/gitian-osx.yml
@@ -29,6 +29,7 @@ packages:
 - "fonts-tuffy"
 - "ccache"
 - "cmake"
+- "xorriso"
 remotes:
 - "url": "https://github.com/dashpay/dash.git"
   "dir": "dash"
@@ -39,9 +40,9 @@ script: |
 
   WRAP_DIR=$HOME/wrapped
   HOSTS="x86_64-apple-darwin18"
-  CONFIGFLAGS="--enable-reduce-exports --disable-miner --disable-bench --disable-gui-tests GENISOIMAGE=$WRAP_DIR/genisoimage --enable-crash-hooks"
+  CONFIGFLAGS="--enable-reduce-exports --disable-miner --disable-bench --disable-gui-tests XORRISOFS=${WRAP_DIR}/xorrisofs DMG=${WRAP_DIR}/dmg --enable-crash-hooks"
   FAKETIME_HOST_PROGS=""
-  FAKETIME_PROGS="ar ranlib date dmg genisoimage"
+  FAKETIME_PROGS="ar ranlib date dmg xorrisofs"
 
   export QT_RCC_TEST=1
   export QT_RCC_SOURCE_DATE_OVERRIDE=1
@@ -161,12 +162,11 @@ script: |
 
     make osx_volname
     make deploydir
-    OSX_VOLNAME="$(cat osx_volname)"
     mkdir -p unsigned-app-${i}
     cp osx_volname unsigned-app-${i}/
     cp contrib/macdeploy/detached-sig-apply.sh unsigned-app-${i}
     cp contrib/macdeploy/detached-sig-create.sh unsigned-app-${i}
-    cp ${BASEPREFIX}/${i}/native/bin/dmg ${BASEPREFIX}/${i}/native/bin/genisoimage unsigned-app-${i}
+    cp ${BASEPREFIX}/${i}/native/bin/dmg unsigned-app-${i}
     cp ${BASEPREFIX}/${i}/native/bin/${i}-codesign_allocate unsigned-app-${i}/codesign_allocate
     cp ${BASEPREFIX}/${i}/native/bin/${i}-pagestuff unsigned-app-${i}/pagestuff
     mv dist unsigned-app-${i}
@@ -174,8 +174,7 @@ script: |
     find . | sort | tar --no-recursion --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > ${OUTDIR}/${DISTNAME}-osx-unsigned.tar.gz
     popd
 
-    make deploy
-    ${WRAP_DIR}/dmg dmg "${OSX_VOLNAME}.dmg" ${OUTDIR}/${DISTNAME}-osx-unsigned.dmg
+    make deploy OSX_DMG="${OUTDIR}/${DISTNAME}-osx-unsigned.dmg"
 
     cd installed
     find . -name "lib*.la" -delete
diff --git a/contrib/macdeploy/README.md b/contrib/macdeploy/README.md
index c9e1f44231f8..d3f05de6077a 100644
--- a/contrib/macdeploy/README.md
+++ b/contrib/macdeploy/README.md
@@ -96,19 +96,15 @@ created using these tools. The build process has been designed to avoid includin
 SDK's files in Gitian's outputs. All interim tarballs are fully deterministic and may be freely
 redistributed.
 
-`genisoimage` is used to create the initial DMG. It is not deterministic as-is, so it has been
-patched. A system `genisoimage` will work fine, but it will not be deterministic because
-the file-order will change between invocations. The patch can be seen here: [cdrkit-deterministic.patch](https://github.com/bitcoin/bitcoin/blob/master/depends/patches/native_cdrkit/cdrkit-deterministic.patch).
-No effort was made to fix this cleanly, so it likely leaks memory badly, however it's only used for
-a single invocation, so that's no real concern.
+[`xorrisofs`](https://www.gnu.org/software/xorriso/) is used to create the DMG.
 
-`genisoimage` cannot compress DMGs, so afterwards, the DMG tool from the
-`libdmg-hfsplus` project is used to compress it. There are several bugs in this tool and its
-maintainer has seemingly abandoned the project.
+`xorrisofs` cannot compress DMGs, so afterwards, the DMG tool from the
+`libdmg-hfsplus` project is used to compress it. There are several bugs in this
+tool and its maintainer has seemingly abandoned the project.
 
 The DMG tool has the ability to create DMGs from scratch as well, but this functionality is
 broken. Only the compression feature is currently used. Ideally, the creation could be fixed
-and `genisoimage` would no longer be necessary.
+and `xorrisofs` would no longer be necessary.
 
 Background images and other features can be added to DMG files by inserting a
 `.DS_Store` before creation. This is generated by the script `contrib/macdeploy/custom_dsstore.py`.
diff --git a/depends/packages/native_cdrkit.mk b/depends/packages/native_cdrkit.mk
deleted file mode 100644
index c50eb0a8f58c..000000000000
--- a/depends/packages/native_cdrkit.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-package=native_cdrkit
-$(package)_version=1.1.11
-$(package)_download_path=http://distro.ibiblio.org/fatdog/source/600/c
-$(package)_file_name=cdrkit-$($(package)_version).tar.bz2
-$(package)_sha256_hash=b50d64c214a65b1a79afe3a964c691931a4233e2ba605d793eb85d0ac3652564
-$(package)_patches=cdrkit-deterministic.patch
-$(package)_dependencies=cmake
-
-define $(package)_preprocess_cmds
-  patch -p1 < $($(package)_patch_dir)/cdrkit-deterministic.patch
-endef
-
-define $(package)_config_cmds
-  $(host_prefix)/bin/cmake -DCMAKE_INSTALL_PREFIX=$(build_prefix)
-endef
-
-define $(package)_build_cmds
-  $(MAKE) genisoimage
-endef
-
-define $(package)_stage_cmds
-  $(MAKE) DESTDIR=$($(package)_staging_dir) -C genisoimage install
-endef
-
-define $(package)_postprocess_cmds
-  rm bin/isovfy bin/isoinfo bin/isodump bin/isodebug bin/devdump
-endef
diff --git a/depends/packages/packages.mk b/depends/packages/packages.mk
index 5c368000b0c3..bcabf33b15a3 100644
--- a/depends/packages/packages.mk
+++ b/depends/packages/packages.mk
@@ -17,7 +17,7 @@ darwin_native_packages = native_biplist native_ds_store native_mac_alias
 $(host_arch)_$(host_os)_native_packages += native_b2
 
 ifneq ($(build_os),darwin)
-darwin_native_packages += native_cctools native_cdrkit native_libtapi native_libdmg-hfsplus
+darwin_native_packages += native_cctools native_libtapi native_libdmg-hfsplus
 
 ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
 darwin_native_packages+= native_clang
diff --git a/depends/patches/native_cdrkit/cdrkit-deterministic.patch b/depends/patches/native_cdrkit/cdrkit-deterministic.patch
deleted file mode 100644
index 8ab0993dc4de..000000000000
--- a/depends/patches/native_cdrkit/cdrkit-deterministic.patch
+++ /dev/null
@@ -1,86 +0,0 @@
---- cdrkit-1.1.11.old/genisoimage/tree.c	2008-10-21 19:57:47.000000000 -0400
-+++ cdrkit-1.1.11/genisoimage/tree.c	2013-12-06 00:23:18.489622668 -0500
-@@ -1139,8 +1139,9 @@
- scan_directory_tree(struct directory *this_dir, char *path, 
- 						  struct directory_entry *de)
- {
--	DIR		*current_dir;
-+        int             current_file;
- 	char		whole_path[PATH_MAX];
-+        struct dirent  **d_list;
- 	struct dirent	*d_entry;
- 	struct directory *parent;
- 	int		dflag;
-@@ -1164,7 +1165,8 @@
- 	this_dir->dir_flags |= DIR_WAS_SCANNED;
- 
- 	errno = 0;	/* Paranoia */
--	current_dir = opendir(path);
-+	//current_dir = opendir(path);
-+        current_file = scandir(path, &d_list, NULL, alphasort);
- 	d_entry = NULL;
- 
- 	/*
-@@ -1173,12 +1175,12 @@
- 	 */
- 	old_path = path;
- 
--	if (current_dir) {
-+	if (current_file >= 0) {
- 		errno = 0;
--		d_entry = readdir(current_dir);
-+		d_entry = d_list[0];
- 	}
- 
--	if (!current_dir || !d_entry) {
-+	if (current_file < 0 || !d_entry) {
- 		int	ret = 1;
- 
- #ifdef	USE_LIBSCHILY
-@@ -1191,8 +1193,8 @@
- 			de->isorec.flags[0] &= ~ISO_DIRECTORY;
- 			ret = 0;
- 		}
--		if (current_dir)
--			closedir(current_dir);
-+		if(d_list)
-+			free(d_list);
- 		return (ret);
- 	}
- #ifdef	ABORT_DEEP_ISO_ONLY
-@@ -1208,7 +1210,7 @@
- 			errmsgno(EX_BAD, "use Rock Ridge extensions via -R or -r,\n");
- 			errmsgno(EX_BAD, "or allow deep ISO9660 directory nesting via -D.\n");
- 		}
--		closedir(current_dir);
-+		free(d_list);
- 		return (1);
- 	}
- #endif
-@@ -1250,13 +1252,13 @@
- 		 * The first time through, skip this, since we already asked
- 		 * for the first entry when we opened the directory.
- 		 */
--		if (dflag)
--			d_entry = readdir(current_dir);
-+		if (dflag && current_file >= 0)
-+			d_entry = d_list[current_file];
- 		dflag++;
- 
--		if (!d_entry)
-+		if (current_file < 0)
- 			break;
--
-+                current_file--;
- 		/* OK, got a valid entry */
- 
- 		/* If we do not want all files, then pitch the backups. */
-@@ -1348,7 +1350,7 @@
- 		insert_file_entry(this_dir, whole_path, d_entry->d_name);
- #endif	/* APPLE_HYB */
- 	}
--	closedir(current_dir);
-+	free(d_list);
- 
- #ifdef APPLE_HYB
- 	/*

From 5856f2c124e5708f7b1772974cd9a9af5acb03fc Mon Sep 17 00:00:00 2001
From: Kittywhiskers Van Gogh <63189531+kittywhiskers@users.noreply.github.com>
Date: Sat, 2 Oct 2021 08:39:55 +0530
Subject: [PATCH 3/3] merge bitcoin#22993: set OSX_MIN_VERSION to 10.15

---
 .gitlab-ci.yml                            | 8 ++++----
 .travis.yml                               | 2 +-
 CMakeLists.txt                            | 2 +-
 ci/matrix.sh                              | 2 +-
 contrib/gitian-descriptors/gitian-osx.yml | 6 +++---
 depends/README.md                         | 2 +-
 depends/hosts/darwin.mk                   | 2 +-
 depends/packages/bls-dash.mk              | 2 +-
 doc/build-cross.md                        | 4 ++--
 doc/build-generic.md                      | 2 +-
 share/qt/Info.plist.in                    | 2 +-
 11 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 804b5a85b365..c04c120816c6 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -43,7 +43,7 @@ builder-image:
   before_script:
     - echo HOST=$HOST
     - |
-      if [ "$HOST" = "x86_64-apple-darwin18" ]; then
+      if [ "$HOST" = "x86_64-apple-darwin19" ]; then
         mkdir -p depends/SDKs
         mkdir -p depends/sdk-sources
         OSX_SDK_BASENAME="Xcode-${XCODE_VERSION}-${XCODE_BUILD_ID}-extracted-SDK-with-libcxx-headers.tar.gz"
@@ -194,12 +194,12 @@ x86_64-unknown-linux-gnu-release:
     HOST: x86_64-unknown-linux-gnu
     DEP_OPTS: "NO_UPNP=1"
 
-x86_64-apple-darwin18:
+x86_64-apple-darwin19:
   extends:
     - .build-depends-template
     - .skip-in-fast-mode-template
   variables:
-    HOST: x86_64-apple-darwin18
+    HOST: x86_64-apple-darwin19
 
 ###
 
@@ -265,7 +265,7 @@ mac-build:
     - .build-template
     - .skip-in-fast-mode-template
   needs:
-    - x86_64-apple-darwin18
+    - x86_64-apple-darwin19
   variables:
     BUILD_TARGET: mac
 
diff --git a/.travis.yml b/.travis.yml
index 71162bcf74e3..34755430e034 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -296,7 +296,7 @@ after_success:
     - stage: test
       name: 'macOS 10.12  [GOAL: deploy]'
       env: >-
-        HOST=x86_64-apple-darwin18
+        HOST=x86_64-apple-darwin19
         PACKAGES="cmake imagemagick libcap-dev librsvg2-bin libz-dev libbz2-dev libtiff-tools python3-dev python3-setuptools"
         export XCODE_VERSION=11.3.1
         export XCODE_BUILD_ID=11C505
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fc11e66d8ff6..cfb1d2fdb088 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,7 +20,7 @@ include_directories(
 if(UNIX AND NOT APPLE)
     set(DEPENDS_PREFIX depends/x86_64-pc-linux-gnu)
 elseif(APPLE)
-    set(DEPENDS_PREFIX depends/x86_64-apple-darwin18)
+    set(DEPENDS_PREFIX depends/x86_64-apple-darwin19)
 elseif(WIN32)
     set(DEPENDS_PREFIX depends/x86_64-w64-mingw32)
 endif()
diff --git a/ci/matrix.sh b/ci/matrix.sh
index adaadbac26e2..cbdf3a186e26 100755
--- a/ci/matrix.sh
+++ b/ci/matrix.sh
@@ -76,7 +76,7 @@ elif [ "$BUILD_TARGET" = "linux64_release" ]; then
   export BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports"
   export PYZMQ=true
 elif [ "$BUILD_TARGET" = "mac" ]; then
-  export HOST=x86_64-apple-darwin18
+  export HOST=x86_64-apple-darwin19
   export BITCOIN_CONFIG="--enable-gui --enable-reduce-exports --disable-miner --enable-werror"
   export XCODE_VERSION=11.3.1
   export XCODE_BUILD_ID=11C505
diff --git a/contrib/gitian-descriptors/gitian-osx.yml b/contrib/gitian-descriptors/gitian-osx.yml
index e9fdcd18380b..7da7273082ce 100644
--- a/contrib/gitian-descriptors/gitian-osx.yml
+++ b/contrib/gitian-descriptors/gitian-osx.yml
@@ -39,7 +39,7 @@ script: |
   set -e -o pipefail
 
   WRAP_DIR=$HOME/wrapped
-  HOSTS="x86_64-apple-darwin18"
+  HOSTS="x86_64-apple-darwin19"
   CONFIGFLAGS="--enable-reduce-exports --disable-miner --disable-bench --disable-gui-tests XORRISOFS=${WRAP_DIR}/xorrisofs DMG=${WRAP_DIR}/dmg --enable-crash-hooks"
   FAKETIME_HOST_PROGS=""
   FAKETIME_PROGS="ar ranlib date dmg xorrisofs"
@@ -187,8 +187,8 @@ script: |
   done
   mkdir -p $OUTDIR/src
   mv $SOURCEDIST $OUTDIR/src
-  mv ${OUTDIR}/${DISTNAME}-x86_64-apple-darwin18.tar.gz ${OUTDIR}/${DISTNAME}-osx64.tar.gz
-  mv ${OUTDIR}/${DISTNAME}-x86_64-apple-darwin18-debug.tar.gz ${OUTDIR}/${DISTNAME}-osx64-debug.tar.gz
+  mv ${OUTDIR}/${DISTNAME}-x86_64-apple-darwin19.tar.gz ${OUTDIR}/${DISTNAME}-osx64.tar.gz
+  mv ${OUTDIR}/${DISTNAME}-x86_64-apple-darwin19-debug.tar.gz ${OUTDIR}/${DISTNAME}-osx64-debug.tar.gz
 
   # Compress ccache (otherwise the assert file will get too huge)
   if [ "$CCACHE_DIR" != "" ]; then
diff --git a/depends/README.md b/depends/README.md
index 246d0549d76b..9a559cdfa18f 100644
--- a/depends/README.md
+++ b/depends/README.md
@@ -21,7 +21,7 @@ created. To use it for Dash:
 Common `host-platform-triplets` for cross compilation are:
 
 - `x86_64-w64-mingw32` for Win64
-- `x86_64-apple-darwin18` for macOS
+- `x86_64-apple-darwin19` for macOS
 - `arm-linux-gnueabihf` for Linux ARM 32 bit
 - `aarch64-linux-gnu` for Linux ARM 64 bit
 - `riscv32-linux-gnu` for Linux RISC-V 32 bit
diff --git a/depends/hosts/darwin.mk b/depends/hosts/darwin.mk
index c7120872edd5..e4b7ca22e260 100644
--- a/depends/hosts/darwin.mk
+++ b/depends/hosts/darwin.mk
@@ -1,4 +1,4 @@
-OSX_MIN_VERSION=10.14
+OSX_MIN_VERSION=10.15
 OSX_SDK_VERSION=10.15.6
 XCODE_VERSION=12.1
 XCODE_BUILD_ID=12A7403
diff --git a/depends/packages/bls-dash.mk b/depends/packages/bls-dash.mk
index bb266f513f5b..74f45b8f61fd 100644
--- a/depends/packages/bls-dash.mk
+++ b/depends/packages/bls-dash.mk
@@ -7,7 +7,7 @@ $(package)_build_subdir=build
 $(package)_sha256_hash=276c8573104e5f18bb5b9fd3ffd49585dda5ba5f6de2de74759dda8ca5a9deac
 $(package)_dependencies=gmp cmake
 $(package)_patches=gcc_alignment_cast.patch
-$(package)_darwin_triplet=x86_64-apple-darwin18
+$(package)_darwin_triplet=x86_64-apple-darwin19
 
 $(package)_relic_version=3a23142be0a5510a3aa93cd6c76fc59d3fc732a5
 $(package)_relic_download_path=https://github.com/relic-toolkit/relic/archive
diff --git a/doc/build-cross.md b/doc/build-cross.md
index bf760ab2b9e5..56932824de1d 100644
--- a/doc/build-cross.md
+++ b/doc/build-cross.md
@@ -26,13 +26,13 @@ $ tar -C depends/SDKs -xf depends/sdk-sources/Xcode-12.1-12A7403-extracted-SDK-w
 When building the dependencies, as described in [build-generic](build-generic.md), use
 
 ```bash
-$ make HOST=x86_64-apple-darwin18 -j4
+$ make HOST=x86_64-apple-darwin19 -j4
 ```
 
 When building Dash Core, use
 
 ```bash
-$ ./configure --prefix=`pwd`/depends/x86_64-apple-darwin18
+$ ./configure --prefix=`pwd`/depends/x86_64-apple-darwin19
 ```
 
 Windows 64bit Cross-compilation
diff --git a/doc/build-generic.md b/doc/build-generic.md
index e0fdf1b1afd9..fa7b7775f2c5 100644
--- a/doc/build-generic.md
+++ b/doc/build-generic.md
@@ -48,7 +48,7 @@ Please replace `<host>` with your local system's `host-platform-triplet`. The fo
 - `i686-pc-linux-gnu` for Linux32
 - `x86_64-pc-linux-gnu` for Linux64
 - `x86_64-w64-mingw32` for Win64
-- `x86_64-apple-darwin18` for MacOSX
+- `x86_64-apple-darwin19` for macOS
 - `arm-linux-gnueabihf` for Linux ARM 32 bit
 - `aarch64-linux-gnu` for Linux ARM 64 bit
 
diff --git a/share/qt/Info.plist.in b/share/qt/Info.plist.in
index bb6c0e9bf3ad..680790dad2f9 100644
--- a/share/qt/Info.plist.in
+++ b/share/qt/Info.plist.in
@@ -3,7 +3,7 @@
 <plist version="0.9">
 <dict>
   <key>LSMinimumSystemVersion</key>
-  <string>10.14.0</string>
+  <string>10.15.0</string>
 
   <key>LSArchitecturePriority</key>
   <array>
