Merge macos_dmg-27

This commit is contained in:
Luke Dashjr 2024-06-21 19:28:12 +00:00
commit 6d349df39b
16 changed files with 209 additions and 21 deletions

View File

@ -14,6 +14,8 @@ endif
.PHONY: deploy FORCE .PHONY: deploy FORCE
.INTERMEDIATE: $(COVERAGE_INFO) .INTERMEDIATE: $(COVERAGE_INFO)
export PYTHONPATH
if BUILD_BITCOIN_LIBS if BUILD_BITCOIN_LIBS
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libbitcoinconsensus.pc pkgconfig_DATA = libbitcoinconsensus.pc
@ -35,7 +37,9 @@ space := $(empty) $(empty)
OSX_APP=Bitcoin-Qt.app OSX_APP=Bitcoin-Qt.app
OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME)) OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME))
OSX_DMG = $(OSX_VOLNAME).dmg
OSX_ZIP = $(OSX_VOLNAME).zip OSX_ZIP = $(OSX_VOLNAME).zip
MAKE_DMG_OPEN_FINDER_SCRIPT=$(top_srcdir)/contrib/macdeploy/make-dmg-open-finder
OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed
@ -62,6 +66,7 @@ WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/bitcoin.ico \
$(top_srcdir)/doc/README_windows.txt $(top_srcdir)/doc/README_windows.txt
OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_INSTALLER_ICONS) \ OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_INSTALLER_ICONS) \
$(MAKE_DMG_OPEN_FINDER_SCRIPT) \
$(top_srcdir)/contrib/macdeploy/detached-sig-create.sh $(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
COVERAGE_INFO = $(COV_TOOL_WRAPPER) baseline.info \ COVERAGE_INFO = $(COV_TOOL_WRAPPER) baseline.info \
@ -122,16 +127,20 @@ osx_volname:
echo $(OSX_VOLNAME) >$@ echo $(OSX_VOLNAME) >$@
if BUILD_DARWIN if BUILD_DARWIN
$(OSX_ZIP): $(OSX_APP_BUILT) $(OSX_PACKAGING) $(OSX_DMG) $(OSX_ZIP): $(OSX_APP_BUILT) $(OSX_PACKAGING)
$(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR) -zip $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR) -dmg -zip
deploydir: $(OSX_ZIP) deploydir: $(OSX_DMG) $(OSX_ZIP)
else !BUILD_DARWIN else !BUILD_DARWIN
APP_DIST_DIR=$(top_builddir)/dist APP_DIST_DIR=$(top_builddir)/dist
$(OSX_DMG): deploydir
$(XORRISOFS) -D -l -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -hfsplus -o $@ $(APP_DIST_DIR) -- $(if $(SOURCE_DATE_EPOCH),-volume_date all_file_dates =$(SOURCE_DATE_EPOCH))
$(PYTHON) $(MAKE_DMG_OPEN_FINDER_SCRIPT) $@
$(OSX_ZIP): deploydir $(OSX_ZIP): deploydir
if [ -n "$(SOURCE_DATE_EPOCH)" ]; then find $(APP_DIST_DIR) -exec touch -d @$(SOURCE_DATE_EPOCH) {} +; fi if [ -n "$(SOURCE_DATE_EPOCH)" ]; then find $(APP_DIST_DIR) -exec touch -d @$(SOURCE_DATE_EPOCH) {} +; fi
cd $(APP_DIST_DIR) && find . | sort | $(ZIP) -X@ $@ cd $(APP_DIST_DIR) && find . | sort | $(ZIP) --temp-path .. -X@ $@
$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING) $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
INSTALL_NAME_TOOL=$(INSTALL_NAME_TOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR) INSTALL_NAME_TOOL=$(INSTALL_NAME_TOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR)
@ -139,7 +148,7 @@ $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PAC
deploydir: $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt deploydir: $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
endif !BUILD_DARWIN endif !BUILD_DARWIN
deploy: $(OSX_ZIP) deploy: $(OSX_DMG) $(OSX_ZIP)
endif endif
$(BITCOIN_QT_BIN): FORCE $(BITCOIN_QT_BIN): FORCE
@ -316,7 +325,7 @@ EXTRA_DIST += \
test/util/data/txreplacesingleinput.hex \ test/util/data/txreplacesingleinput.hex \
test/util/rpcauth-test.py test/util/rpcauth-test.py
CLEANFILES = $(OSX_ZIP) $(BITCOIN_WIN_INSTALLER) CLEANFILES = $(OSX_DMG) $(OSX_ZIP) $(BITCOIN_WIN_INSTALLER)
DISTCHECK_CONFIGURE_FLAGS = --enable-man DISTCHECK_CONFIGURE_FLAGS = --enable-man

View File

@ -11,7 +11,7 @@ export SDK_URL=${SDK_URL:-https://bitcoincore.org/depends-sources/sdks}
export CONTAINER_NAME=ci_macos_cross export CONTAINER_NAME=ci_macos_cross
export CI_IMAGE_NAME_TAG="docker.io/ubuntu:22.04" export CI_IMAGE_NAME_TAG="docker.io/ubuntu:22.04"
export HOST=x86_64-apple-darwin export HOST=x86_64-apple-darwin
export PACKAGES="zip" export PACKAGES="libz-dev python3-setuptools xorriso zip"
export XCODE_VERSION=15.0 export XCODE_VERSION=15.0
export XCODE_BUILD_ID=15A240d export XCODE_BUILD_ID=15A240d
export RUN_UNIT_TESTS=false export RUN_UNIT_TESTS=false

View File

@ -129,6 +129,8 @@ AC_PATH_TOOL([OBJCOPY], [objcopy])
AC_PATH_PROG([DOXYGEN], [doxygen]) AC_PATH_PROG([DOXYGEN], [doxygen])
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"]) AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
AC_ARG_VAR([PYTHONPATH], [Augments the default search path for python module files])
AC_ARG_ENABLE([wallet], AC_ARG_ENABLE([wallet],
[AS_HELP_STRING([--disable-wallet], [AS_HELP_STRING([--disable-wallet],
[disable wallet (enabled by default)])], [disable wallet (enabled by default)])],
@ -819,6 +821,7 @@ case $host in
AC_PATH_TOOL([DSYMUTIL], [dsymutil], [dsymutil]) AC_PATH_TOOL([DSYMUTIL], [dsymutil], [dsymutil])
AC_PATH_TOOL([INSTALL_NAME_TOOL], [install_name_tool], [install_name_tool]) AC_PATH_TOOL([INSTALL_NAME_TOOL], [install_name_tool], [install_name_tool])
AC_PATH_TOOL([OTOOL], [otool], [otool]) AC_PATH_TOOL([OTOOL], [otool], [otool])
AC_PATH_PROGS([XORRISOFS], [xorrisofs], [xorrisofs])
AC_PATH_PROG([ZIP], [zip], [zip]) AC_PATH_PROG([ZIP], [zip], [zip])
dnl libtool will try to strip the static lib, which is a problem for dnl libtool will try to strip the static lib, which is a problem for
@ -2143,6 +2146,7 @@ AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/spl
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])]) AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])])
AC_CONFIG_LINKS([contrib/devtools/iwyu/bitcoin.core.imp:contrib/devtools/iwyu/bitcoin.core.imp]) AC_CONFIG_LINKS([contrib/devtools/iwyu/bitcoin.core.imp:contrib/devtools/iwyu/bitcoin.core.imp])
AC_CONFIG_LINKS([contrib/filter-lcov.py:contrib/filter-lcov.py]) AC_CONFIG_LINKS([contrib/filter-lcov.py:contrib/filter-lcov.py])
AC_CONFIG_LINKS([contrib/macdeploy/background.tiff.in:contrib/macdeploy/background.tiff.in])
AC_CONFIG_LINKS([src/.bear-tidy-config:src/.bear-tidy-config]) AC_CONFIG_LINKS([src/.bear-tidy-config:src/.bear-tidy-config])
AC_CONFIG_LINKS([src/.clang-tidy:src/.clang-tidy]) AC_CONFIG_LINKS([src/.clang-tidy:src/.clang-tidy])
AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py]) AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py])

View File

@ -315,7 +315,7 @@ mkdir -p "$DISTSRC"
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" \ | gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" \
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" && exit 1 ) || ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" && exit 1 )
) )
make deploy ${V:+V=1} OSX_ZIP="${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip" make deploy ${V:+V=1} OSX_DMG="${OUTDIR}/${DISTNAME}-${HOST}-unsigned.dmg" OSX_ZIP="${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip"
;; ;;
esac esac
( (

View File

@ -24,6 +24,8 @@ if [ -n "$V" ]; then
export VERBOSE="$V" export VERBOSE="$V"
fi fi
SRCDIR="$(realpath "$(dirname "$0")")"
# Check that required environment variables are set # Check that required environment variables are set
cat << EOF cat << EOF
Required environment variables as seen inside the container: Required environment variables as seen inside the container:
@ -91,6 +93,14 @@ mkdir -p "$DISTSRC"
| xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}" | xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}"
find . | sort \ find . | sort \
| zip -X@ "${OUTDIR}/${DISTNAME}-${HOST}.zip" | zip -X@ "${OUTDIR}/${DISTNAME}-${HOST}.zip"
# Make a DMG from dist/
xorrisofs -D -l -V "$(< ../osx_volname)" -no-pad -r -dir-mode 0755 \
-hfsplus \
-o "${OUTDIR}/${DISTNAME}-${HOST}.dmg" \
. \
-- -volume_date all_file_dates ="$SOURCE_DATE_EPOCH"
python3 "${SRCDIR}"/../../macdeploy/make-dmg-open-finder "${OUTDIR}/${DISTNAME}-${HOST}.dmg"
;; ;;
*) *)
exit 1 exit 1

View File

@ -3,6 +3,7 @@
((gnu packages bash) #:select (bash-minimal)) ((gnu packages bash) #:select (bash-minimal))
(gnu packages bison) (gnu packages bison)
((gnu packages certs) #:select (nss-certs)) ((gnu packages certs) #:select (nss-certs))
((gnu packages cdrom) #:select (xorriso))
((gnu packages cmake) #:select (cmake-minimal)) ((gnu packages cmake) #:select (cmake-minimal))
(gnu packages commencement) (gnu packages commencement)
(gnu packages compression) (gnu packages compression)
@ -526,5 +527,5 @@ inspecting signatures in Mach-O binaries.")
((string-contains target "-linux-") ((string-contains target "-linux-")
(list (make-bitcoin-cross-toolchain target))) (list (make-bitcoin-cross-toolchain target)))
((string-contains target "darwin") ((string-contains target "darwin")
(list clang-toolchain-17 binutils cmake-minimal python-signapple zip)) (list clang-toolchain-17 binutils cmake-minimal xorriso python-signapple zip))
(else '()))))) (else '())))))

View File

@ -6,7 +6,7 @@ The `macdeployqtplus` script should not be run manually. Instead, after building
make deploy make deploy
``` ```
When complete, it will have produced `Bitcoin-Core.zip`. When complete, it will have produced `Bitcoin-Core.dmg` and `Bitcoin-Core.zip`.
## SDK Extraction ## SDK Extraction
@ -56,8 +56,8 @@ The `sha256sum` should be `c0c2e7bb92c1fee0c4e9f3a485e4530786732d6c6dd9e9f418c28
## Deterministic macOS App Notes ## Deterministic macOS App Notes
macOS Applications are created in Linux by combining a recent `clang` and the Apple Working macOS DMGs are created in Linux by combining a recent `clang`, the Apple
`binutils` (`ld`, `ar`, etc). `binutils` (`ld`, `ar`, etc) and DMG authoring tools.
Apple uses `clang` extensively for development and has upstreamed the necessary Apple uses `clang` extensively for development and has upstreamed the necessary
functionality so that a vanilla clang can take advantage. It supports the use of `-F`, functionality so that a vanilla clang can take advantage. It supports the use of `-F`,
@ -87,15 +87,20 @@ created using these tools. The build process has been designed to avoid includin
SDK's files in Guix's outputs. All interim tarballs are fully deterministic and may be freely SDK's files in Guix's outputs. All interim tarballs are fully deterministic and may be freely
redistributed. redistributed.
[`xorrisofs`](https://www.gnu.org/software/xorriso/) is used to create the DMG.
A background image is added to DMG files by inserting a `.DS_Store` during creation.
As of OS X 10.9 Mavericks, using an Apple-blessed key to sign binaries is a requirement in As of OS X 10.9 Mavericks, using an Apple-blessed key to sign binaries is a requirement in
order to satisfy the new Gatekeeper requirements. Because this private key cannot be order to satisfy the new Gatekeeper requirements. Because this private key cannot be
shared, we'll have to be a bit creative in order for the build process to remain somewhat shared, we'll have to be a bit creative in order for the build process to remain somewhat
deterministic. Here's how it works: deterministic. Here's how it works:
- Builders use Guix to create an unsigned release. This outputs an unsigned ZIP which - Builders use Guix to create an unsigned release. This outputs an unsigned DMG and ZIP which
users may choose to bless and run. It also outputs an unsigned app structure in the form users may choose to bless and run. It also outputs an unsigned app structure in the form
of a tarball. of a tarball, which also contains all of the tools that have been previously (deterministically)
built in order to create a final DMG.
- The Apple keyholder uses this unsigned app to create a detached signature, using the - The Apple keyholder uses this unsigned app to create a detached signature, using the
script that is also included there. Detached signatures are available from this [repository](https://github.com/bitcoin-core/bitcoin-detached-sigs). script that is also included there. Detached signatures are available from this [repository](https://github.com/bitcoin-core/bitcoin-detached-sigs).
- Builders feed the unsigned app + detached signature back into Guix. It uses the - Builders feed the unsigned app + detached signature back into Guix. It uses the
pre-built tools to recombine the pieces into a deterministic ZIP. pre-built tools to recombine the pieces into a deterministic DMG.

File diff suppressed because one or more lines are too long

View File

@ -16,8 +16,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import base64
import lzma
import sys, re, os, platform, shutil, stat, subprocess, os.path import sys, re, os, platform, shutil, stat, subprocess, os.path
from argparse import ArgumentParser from argparse import ArgumentParser
from ds_store import DSStore
from mac_alias import Alias
from pathlib import Path from pathlib import Path
from subprocess import PIPE, run from subprocess import PIPE, run
from typing import Optional from typing import Optional
@ -383,7 +387,7 @@ def deployPlugins(appBundleInfo: ApplicationBundleInfo, deploymentInfo: Deployme
ap = ArgumentParser(description="""Improved version of macdeployqt. ap = ArgumentParser(description="""Improved version of macdeployqt.
Outputs a ready-to-deploy app in a folder "dist" and optionally wraps it in a .zip file. Outputs a ready-to-deploy app in a folder "dist" and optionally wraps it in a .dmg and/or .zip file.
Note, that the "dist" folder will be deleted before deploying on each run. Note, that the "dist" folder will be deleted before deploying on each run.
Optionally, Qt translation files (.qm) can be added to the bundle.""") Optionally, Qt translation files (.qm) can be added to the bundle.""")
@ -393,6 +397,7 @@ ap.add_argument("appname", nargs=1, metavar="appname", help="name of the app bei
ap.add_argument("-verbose", nargs="?", const=True, help="Output additional debugging information") ap.add_argument("-verbose", nargs="?", const=True, help="Output additional debugging information")
ap.add_argument("-no-plugins", dest="plugins", action="store_false", default=True, help="skip plugin deployment") ap.add_argument("-no-plugins", dest="plugins", action="store_false", default=True, help="skip plugin deployment")
ap.add_argument("-no-strip", dest="strip", action="store_false", default=True, help="don't run 'strip' on the binaries") ap.add_argument("-no-strip", dest="strip", action="store_false", default=True, help="don't run 'strip' on the binaries")
ap.add_argument("-dmg", nargs="?", const="", metavar="basename", help="create a .dmg disk image")
ap.add_argument("-translations-dir", nargs=1, metavar="path", default=None, help="Path to Qt's translations. Base translations will automatically be added to the bundle's resources.") ap.add_argument("-translations-dir", nargs=1, metavar="path", default=None, help="Path to Qt's translations. Base translations will automatically be added to the bundle's resources.")
ap.add_argument("-zip", nargs="?", const="", metavar="zip", help="create a .zip containing the app bundle") ap.add_argument("-zip", nargs="?", const="", metavar="zip", help="create a .zip containing the app bundle")
@ -415,7 +420,14 @@ if os.path.exists("dist"):
print("+ Removing existing dist folder +") print("+ Removing existing dist folder +")
shutil.rmtree("dist") shutil.rmtree("dist")
if os.path.exists(appname + ".zip"): if config.dmg is not None and os.path.exists(appname + ".dmg"):
print("+ Removing existing DMG +")
os.unlink(appname + ".dmg")
if os.path.exists(appname + ".temp.dmg"):
os.unlink(appname + ".temp.dmg")
if config.zip is not None and os.path.exists(appname + ".zip"):
print("+ Removing existing .zip +") print("+ Removing existing .zip +")
os.unlink(appname + ".zip") os.unlink(appname + ".zip")
@ -492,9 +504,103 @@ with open(os.path.join(applicationBundle.resourcesPath, "qt.conf"), "wb") as f:
# ------------------------------------------------ # ------------------------------------------------
print("+ Generating .DS_Store +")
output_file = os.path.join("dist", ".DS_Store")
ds = DSStore.open(output_file, 'w+')
ds['.']['bwsp'] = {
'WindowBounds': '{{300, 280}, {500, 343}}',
'PreviewPaneVisibility': False,
}
icvp = {
'gridOffsetX': 0.0,
'textSize': 12.0,
'viewOptionsVersion': 1,
'backgroundImageAlias': b'\x00\x00\x00\x00\x02\x1e\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd1\x94\\\xb0H+\x00\x05\x00\x00\x00\x98\x0fbackground.tiff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x99\xd19\xb0\xf8\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\r\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0b.background\x00\x00\x10\x00\x08\x00\x00\xd1\x94\\\xb0\x00\x00\x00\x11\x00\x08\x00\x00\xd19\xb0\xf8\x00\x00\x00\x01\x00\x04\x00\x00\x00\x98\x00\x0e\x00 \x00\x0f\x00b\x00a\x00c\x00k\x00g\x00r\x00o\x00u\x00n\x00d\x00.\x00t\x00i\x00f\x00f\x00\x0f\x00\x02\x00\x00\x00\x12\x00\x1c/.background/background.tiff\x00\x14\x01\x06\x00\x00\x00\x00\x01\x06\x00\x02\x00\x00\x0cMacintosh HD\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xce\x97\xab\xc3H+\x00\x00\x01\x88[\x88\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02u\xab\x8d\xd1\x94\\\xb0devrddsk\xff\xff\xff\xff\x00\x00\t \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07bitcoin\x00\x00\x10\x00\x08\x00\x00\xce\x97\xab\xc3\x00\x00\x00\x11\x00\x08\x00\x00\xd1\x94\\\xb0\x00\x00\x00\x01\x00\x14\x01\x88[\x88\x00\x16\xa9\t\x00\x08\xfaR\x00\x08\xfaQ\x00\x02d\x8e\x00\x0e\x00\x02\x00\x00\x00\x0f\x00\x1a\x00\x0c\x00M\x00a\x00c\x00i\x00n\x00t\x00o\x00s\x00h\x00 \x00H\x00D\x00\x13\x00\x01/\x00\x00\x15\x00\x02\x00\x14\xff\xff\x00\x00\xff\xff\x00\x00',
'backgroundColorBlue': 1.0,
'iconSize': 96.0,
'backgroundColorGreen': 1.0,
'arrangeBy': 'none',
'showIconPreview': True,
'gridSpacing': 100.0,
'gridOffsetY': 0.0,
'showItemInfo': False,
'labelOnBottom': True,
'backgroundType': 2,
'backgroundColorRed': 1.0
}
alias = Alias().from_bytes(icvp['backgroundImageAlias'])
alias.volume.name = appname
alias.volume.posix_path = '/Volumes/' + appname
icvp['backgroundImageAlias'] = alias.to_bytes()
ds['.']['icvp'] = icvp
ds['.']['vSrn'] = ('long', 1)
ds['Applications']['Iloc'] = (370, 156)
ds['Bitcoin-Qt.app']['Iloc'] = (128, 156)
ds.flush()
ds.close()
# ------------------------------------------------
if platform.system() == "Darwin": if platform.system() == "Darwin":
subprocess.check_call(f"codesign --deep --force --sign - {target}", shell=True) subprocess.check_call(f"codesign --deep --force --sign - {target}", shell=True)
print("+ Installing background.tiff +")
bg_path = os.path.join('dist', '.background', 'background.tiff')
os.mkdir(os.path.dirname(bg_path))
tiff_in_path = os.path.join('contrib', 'macdeploy', 'background.tiff.in')
with open(tiff_in_path, 'r') as tiff_in:
with open(bg_path, 'wb') as bg:
bg.write(lzma.decompress(base64.b85decode(tiff_in.read())))
# ------------------------------------------------
print("+ Generating symlink for /Applications +")
os.symlink("/Applications", os.path.join('dist', "Applications"))
# ------------------------------------------------
if config.dmg is not None:
print("+ Preparing .dmg disk image +")
if verbose:
print("Determining size of \"dist\"...")
size = 0
for path, dirs, files in os.walk("dist"):
for file in files:
size += os.path.getsize(os.path.join(path, file))
size += int(size * 0.15)
if verbose:
print("Creating temp image for modification...")
tempname: str = appname + ".temp.dmg"
run(["hdiutil", "create", tempname, "-srcfolder", "dist", "-format", "UDRW", "-size", str(size), "-volname", appname], check=True, text=True)
if verbose:
print("Attaching temp image...")
output = run(["hdiutil", "attach", tempname, "-readwrite"], check=True, text=True, stdout=PIPE).stdout
print("+ Finalizing .dmg disk image +")
run(["hdiutil", "detach", f"/Volumes/{appname}"], text=True)
run(["hdiutil", "convert", tempname, "-format", "UDZO", "-o", appname, "-imagekey", "zlib-level=9"], check=True, text=True)
os.unlink(tempname)
# ------------------------------------------------ # ------------------------------------------------
if config.zip is not None: if config.zip is not None:

View File

@ -0,0 +1,15 @@
#!/usr/bin/env python3
# Copyright (c) 2023 Luke Dashjr
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import sys
with open(sys.argv[1], "r+b") as dmg:
# Ensure HFS+ header is where we expect it
dmg.seek(0x10400)
assert dmg.read(4) == b'\x48\x2b\0\x04'
# Set Finder info to open directory ID 2 when mounted
dmg.seek(0x10458)
dmg.write(b'\0\0\0\x02')

View File

@ -48,7 +48,7 @@ The paths are automatically configured and no other options are needed unless ta
#### For macOS cross compilation #### For macOS cross compilation
sudo apt-get install curl bsdmainutils cmake zip sudo apt-get install curl bsdmainutils cmake libz-dev python3-setuptools xorriso zip
Note: You must obtain the macOS SDK before proceeding with a cross-compile. Note: You must obtain the macOS SDK before proceeding with a cross-compile.
Under the depends directory, create a subdirectory named `SDKs`. Under the depends directory, create a subdirectory named `SDKs`.

View File

@ -96,6 +96,7 @@ fi
if test -n "@CXX@" -a -z "${CXX}"; then if test -n "@CXX@" -a -z "${CXX}"; then
CXX="@CXX@" CXX="@CXX@"
fi fi
PYTHONPATH="${depends_prefix}/native/lib/python3/dist-packages${PYTHONPATH:+${PATH_SEPARATOR}}${PYTHONPATH}"
if test -n "@AR@"; then if test -n "@AR@"; then
AR="@AR@" AR="@AR@"

View File

@ -0,0 +1,15 @@
package=native_ds_store
$(package)_version=1.3.0
$(package)_download_path=https://github.com/dmgbuild/ds_store/archive/
$(package)_file_name=v$($(package)_version).tar.gz
$(package)_sha256_hash=76b3280cd4e19e5179defa23fb594a9dd32643b0c80d774bd3108361d94fb46d
$(package)_install_libdir=$(build_prefix)/lib/python3/dist-packages
define $(package)_build_cmds
python3 setup.py build
endef
define $(package)_stage_cmds
mkdir -p $($(package)_install_libdir) && \
python3 setup.py install --root=$($(package)_staging_dir) --prefix=$(build_prefix) --install-lib=$($(package)_install_libdir)
endef

View File

@ -0,0 +1,15 @@
package=native_mac_alias
$(package)_version=2.2.0
$(package)_download_path=https://github.com/dmgbuild/mac_alias/archive/
$(package)_file_name=v$($(package)_version).tar.gz
$(package)_sha256_hash=421e6d7586d1f155c7db3e7da01ca0dacc9649a509a253ad7077b70174426499
$(package)_install_libdir=$(build_prefix)/lib/python3/dist-packages
define $(package)_build_cmds
python3 setup.py build
endef
define $(package)_stage_cmds
mkdir -p $($(package)_install_libdir) && \
python3 setup.py install --root=$($(package)_staging_dir) --prefix=$(build_prefix) --install-lib=$($(package)_install_libdir)
endef

View File

@ -27,7 +27,7 @@ multiprocess_native_packages = native_libmultiprocess native_capnp
usdt_linux_packages=systemtap usdt_linux_packages=systemtap
darwin_native_packages = darwin_native_packages = native_ds_store native_mac_alias
ifneq ($(build_os),darwin) ifneq ($(build_os),darwin)
darwin_native_packages += native_cctools native_libtapi darwin_native_packages += native_cctools native_libtapi

View File

@ -177,9 +177,15 @@ brew install python
#### Deploy Dependencies #### Deploy Dependencies
You can deploy a `.zip` containing the Bitcoin Core application using `make deploy`. You can deploy a `.dmg` and `.zip` containing the Bitcoin Core application using `make deploy`.
It is required that you have `python` installed. It is required that you have `python` installed.
Ensuring that `python` is installed, you can install the deploy dependencies by running the following commands in your terminal:
``` bash
pip3 install ds_store mac_alias
```
## Building Bitcoin Core ## Building Bitcoin Core
### 1. Configuration ### 1. Configuration
@ -237,7 +243,7 @@ make check # Run tests if Python 3 is available
### 3. Deploy (optional) ### 3. Deploy (optional)
You can also create a `.zip` containing the `.app` bundle by running the following command: You can also create a `.dmg` and `.zip` containing the `.app` bundle by running the following command:
``` bash ``` bash
make deploy make deploy