Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
gruve-p committed Sep 23, 2023
2 parents e199e4f + b000ed5 commit 304885c
Show file tree
Hide file tree
Showing 56 changed files with 596 additions and 435 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
run: clang --version

- name: Install Homebrew packages
run: brew install boost libevent qt@5 miniupnpc libnatpmp ccache zeromq qrencode libtool automake gnu-getopt
run: brew install automake libtool pkg-config gnu-getopt ccache boost libevent miniupnpc libnatpmp zeromq qt@5 qrencode

- name: Set Ccache directory
run: echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ src/qt/groestlcoin-qt.includes

*.log
*.trs
*.dmg
*.zip

*.json.h
*.raw.h
Expand Down
17 changes: 9 additions & 8 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ space := $(empty) $(empty)

OSX_APP=Groestlcoin-Qt.app
OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME))
OSX_DMG = $(OSX_VOLNAME).dmg
OSX_ZIP = $(OSX_VOLNAME).zip
OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/groestlcoin.icns
OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed
Expand Down Expand Up @@ -123,23 +123,24 @@ osx_volname:
echo $(OSX_VOLNAME) >$@

if BUILD_DARWIN
$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING)
$(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR) -dmg
$(OSX_ZIP): $(OSX_APP_BUILT) $(OSX_PACKAGING)
$(PYTHON) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) $(OSX_VOLNAME) -translations-dir=$(QT_TRANSLATION_DIR) -zip

deploydir: $(OSX_DMG)
deploydir: $(OSX_ZIP)
else !BUILD_DARWIN
APP_DIST_DIR=$(top_builddir)/dist

$(OSX_DMG): deploydir
$(XORRISOFS) -D -l -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -o $@ $(APP_DIST_DIR) -- $(if $(SOURCE_DATE_EPOCH),-volume_date all_file_dates =$(SOURCE_DATE_EPOCH))
$(OSX_ZIP): deploydir
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@ $@

$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Groestlcoin-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)

deploydir: $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Groestlcoin-Qt
endif !BUILD_DARWIN

deploy: $(OSX_DMG)
deploy: $(OSX_ZIP)
endif

$(GROESTLCOIN_QT_BIN): FORCE
Expand Down Expand Up @@ -312,7 +313,7 @@ EXTRA_DIST += \
test/util/data/txcreatesignv2.hex \
test/util/rpcauth-test.py

CLEANFILES = $(OSX_DMG) $(GROESTLCOIN_WIN_INSTALLER)
CLEANFILES = $(OSX_ZIP) $(GROESTLCOIN_WIN_INSTALLER)

DISTCHECK_CONFIGURE_FLAGS = --enable-man

Expand Down
2 changes: 1 addition & 1 deletion ci/test/00_setup_env_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export SDK_URL=${SDK_URL:-https://bitcoincore.org/depends-sources/sdks}
export CONTAINER_NAME=ci_macos_cross
export CI_IMAGE_NAME_TAG="docker.io/ubuntu:22.04"
export HOST=x86_64-apple-darwin
export PACKAGES="cmake libz-dev python3-setuptools xorriso"
export PACKAGES="cmake libz-dev python3-setuptools zip"
export XCODE_VERSION=12.2
export XCODE_BUILD_ID=12B45b
export RUN_UNIT_TESTS=false
Expand Down
6 changes: 3 additions & 3 deletions ci/test/01_base_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
-DLLVM_ENABLE_RUNTIMES="compiler-rt;libcxx;libcxxabi;libunwind" \
-S /msan/llvm-project/llvm

ninja -C /msan/clang_build/ "$MAKEJOBS"
ninja -C /msan/clang_build/ "-j$( nproc )" # Use nproc, because MAKEJOBS is the default in docker image builds
ninja -C /msan/clang_build/ install-runtimes

update-alternatives --install /usr/bin/clang++ clang++ /msan/clang_build/bin/clang++ 100
Expand All @@ -69,13 +69,13 @@ if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
-DLIBCXX_HARDENING_MODE=debug \
-S /msan/llvm-project/runtimes

ninja -C /msan/cxx_build/ "$MAKEJOBS"
ninja -C /msan/cxx_build/ "-j$( nproc )" # Use nproc, because MAKEJOBS is the default in docker image builds
fi

if [[ "${RUN_TIDY}" == "true" ]]; then
git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_16 /include-what-you-use
cmake -B /iwyu-build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-16 -S /include-what-you-use
make -C /iwyu-build/ install "$MAKEJOBS"
make -C /iwyu-build/ install "-j$( nproc )" # Use nproc, because MAKEJOBS is the default in docker image builds
fi

mkdir -p "${DEPENDS_DIR}/SDKs" "${DEPENDS_DIR}/sdk-sources"
Expand Down
3 changes: 1 addition & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ case $host in
AC_PATH_TOOL([DSYMUTIL], [dsymutil], [dsymutil])
AC_PATH_TOOL([INSTALL_NAME_TOOL], [install_name_tool], [install_name_tool])
AC_PATH_TOOL([OTOOL], [otool], [otool])
AC_PATH_PROGS([XORRISOFS], [xorrisofs], [xorrisofs])
AC_PATH_PROG([ZIP], [zip], [zip])

dnl libtool will try to strip the static lib, which is a problem for
dnl cross-builds because strip attempts to call a hard-coded ld,
Expand Down Expand Up @@ -1936,7 +1936,6 @@ AC_CONFIG_FILES([contrib/devtools/split-debug.sh],[chmod +x contrib/devtools/spl
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])])
AC_CONFIG_LINKS([contrib/devtools/iwyu/groestlcoin.core.imp:contrib/devtools/iwyu/groestlcoin.core.imp])
AC_CONFIG_LINKS([contrib/filter-lcov.py:contrib/filter-lcov.py])
AC_CONFIG_LINKS([contrib/macdeploy/background.tiff:contrib/macdeploy/background.tiff])
AC_CONFIG_LINKS([src/.bear-tidy-config:src/.bear-tidy-config])
AC_CONFIG_LINKS([src/.clang-tidy:src/.clang-tidy])
dnl !!!P AC_CONFIG_LINKS([test/functional/test_runner.py:test/functional/test_runner.py])
Expand Down
2 changes: 1 addition & 1 deletion contrib/guix/libexec/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ mkdir -p "$DISTSRC"
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" \
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" && exit 1 )
)
make deploy ${V:+V=1} OSX_DMG="${OUTDIR}/${DISTNAME}-${HOST}-unsigned.dmg"
make deploy ${V:+V=1} OSX_ZIP="${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip"
;;
esac
(
Expand Down
7 changes: 2 additions & 5 deletions contrib/guix/libexec/codesign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,8 @@ mkdir -p "$DISTSRC"
# Apply detached codesignatures to dist/ (in-place)
signapple apply dist/Groestlcoin-Qt.app codesignatures/osx/dist

# Make a DMG from dist/
xorrisofs -D -l -V "$(< osx_volname)" -no-pad -r -dir-mode 0755 \
-o "${OUTDIR}/${DISTNAME}-${HOST}.dmg" \
dist \
-- -volume_date all_file_dates ="$SOURCE_DATE_EPOCH"
# Make a .zip from dist/
zip "${OUTDIR}/${DISTNAME}-${HOST}.zip" dist/*
;;
*)
exit 1
Expand Down
3 changes: 1 addition & 2 deletions contrib/guix/manifest.scm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
((gnu packages bash) #:select (bash-minimal))
(gnu packages bison)
((gnu packages certs) #:select (nss-certs))
((gnu packages cdrom) #:select (xorriso))
((gnu packages cmake) #:select (cmake-minimal))
(gnu packages commencement)
(gnu packages compression)
Expand Down Expand Up @@ -606,5 +605,5 @@ inspecting signatures in Mach-O binaries.")
((string-contains target "-linux-")
(list (make-groestlcoin-cross-toolchain target)))
((string-contains target "darwin")
(list clang-toolchain-15 binutils cmake-minimal xorriso python-signapple))
(list clang-toolchain-15 binutils cmake-minimal python-signapple zip))
(else '())))))
19 changes: 7 additions & 12 deletions contrib/macdeploy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The `macdeployqtplus` script should not be run manually. Instead, after building
make deploy
```

When complete, it will have produced `Groestlcoin-Core.dmg`.
When complete, it will have produced `Groestlcoin-Core.zip`.

## SDK Extraction

Expand Down Expand Up @@ -60,10 +60,10 @@ previous stage) as the first argument.

The `sha256sum` of the generated TAR.GZ archive should be `df75d30ecafc429e905134333aeae56ac65fac67cb4182622398fd717df77619`.

## Deterministic macOS DMG Notes
## Deterministic macOS App Notes

Working macOS DMGs are created in Linux by combining a recent `clang`, the Apple
`binutils` (`ld`, `ar`, etc) and DMG authoring tools.
macOS Applications are created in Linux by combining a recent `clang` and the Apple
`binutils` (`ld`, `ar`, etc).

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`,
Expand Down Expand Up @@ -93,20 +93,15 @@ 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
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
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
deterministic. Here's how it works:

- Builders use Guix to create an unsigned release. This outputs an unsigned DMG which
- Builders use Guix to create an unsigned release. This outputs an unsigned ZIP which
users may choose to bless and run. It also outputs an unsigned app structure in the form
of a tarball, which also contains all of the tools that have been previously (deterministically)
built in order to create a final DMG.
of a tarball.
- 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/groestlcoin/groestlcoin-detached-sigs).
- Builders feed the unsigned app + detached signature back into Guix. It uses the
pre-built tools to recombine the pieces into a deterministic DMG.
pre-built tools to recombine the pieces into a deterministic ZIP.
Binary file removed contrib/macdeploy/background.tiff
Binary file not shown.
105 changes: 7 additions & 98 deletions contrib/macdeploy/macdeployqtplus
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import sys, re, os, platform, shutil, stat, subprocess, os.path
from argparse import ArgumentParser
from ds_store import DSStore
from mac_alias import Alias
from pathlib import Path
from subprocess import PIPE, run
from typing import List, Optional
Expand Down Expand Up @@ -385,7 +383,7 @@ def deployPlugins(appBundleInfo: ApplicationBundleInfo, deploymentInfo: Deployme

ap = ArgumentParser(description="""Improved version of macdeployqt.
Outputs a ready-to-deploy app in a folder "dist" and optionally wraps it in a .dmg file.
Outputs a ready-to-deploy app in a folder "dist" and optionally wraps it in a .zip file.
Note, that the "dist" folder will be deleted before deploying on each run.
Optionally, Qt translation files (.qm) can be added to the bundle.""")
Expand All @@ -395,8 +393,8 @@ 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("-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("-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("-zip", nargs="?", const="", metavar="zip", help="create a .zip containing the app bundle")

config = ap.parse_args()

Expand All @@ -417,12 +415,9 @@ if os.path.exists("dist"):
print("+ Removing existing dist folder +")
shutil.rmtree("dist")

if 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 os.path.exists(appname + ".zip"):
print("+ Removing existing .zip +")
os.unlink(appname + ".zip")

# ------------------------------------------------

Expand Down Expand Up @@ -497,99 +492,13 @@ 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['Groestlcoin-Qt.app']['Iloc'] = (128, 156)

ds.flush()
ds.close()

# ------------------------------------------------

if platform.system() == "Darwin":
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_path = os.path.join('contrib', 'macdeploy', 'background.tiff')
shutil.copy2(tiff_path, bg_path)

# ------------------------------------------------

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:
shutil.make_archive('{}'.format(appname), format='zip', root_dir='dist', base_dir='Groestlcoin-Qt.app')

# ------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion depends/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The paths are automatically configured and no other options are needed unless ta

#### For macOS cross compilation

sudo apt-get install curl bsdmainutils cmake libz-dev python3-setuptools xorriso
sudo apt-get install curl bsdmainutils cmake libz-dev python3-setuptools zip

Note: You must obtain the macOS SDK before proceeding with a cross-compile.
Under the depends directory, create a subdirectory named `SDKs`.
Expand Down
15 changes: 0 additions & 15 deletions depends/packages/native_ds_store.mk

This file was deleted.

15 changes: 0 additions & 15 deletions depends/packages/native_mac_alias.mk

This file was deleted.

2 changes: 1 addition & 1 deletion depends/packages/packages.mk
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ multiprocess_native_packages = native_libmultiprocess native_capnp

usdt_linux_packages=systemtap

darwin_native_packages = native_ds_store native_mac_alias
darwin_native_packages =

ifneq ($(build_os),darwin)
darwin_native_packages += native_cctools native_libtapi
Expand Down
Loading

0 comments on commit 304885c

Please sign in to comment.