Skip to content

Commit aafbd23

Browse files
committed
guix: Apply codesignatures to all MacOS binaries
1 parent 3656b82 commit aafbd23

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

contrib/guix/libexec/codesign.sh

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
55
export LC_ALL=C
66
set -e -o pipefail
7+
8+
# Environment variables for determinism
9+
export TAR_OPTIONS="--owner=0 --group=0 --numeric-owner --mtime='@${SOURCE_DATE_EPOCH}' --sort=name"
710
export TZ=UTC
811

912
# Although Guix _does_ set umask when building its own packages (in our case,
@@ -82,15 +85,32 @@ mkdir -p "$DISTSRC"
8285
done
8386
;;
8487
*darwin*)
85-
# Apply detached codesignatures to dist/ (in-place)
86-
signapple apply dist/Bitcoin-Qt.app codesignatures/osx/dist/Bitcoin-Qt.app
88+
case "$HOST" in
89+
arm64*) ARCH="arm64" ;;
90+
x86_64*) ARCH="x86_64" ;;
91+
esac
92+
93+
# Apply detached codesignatures (in-place)
94+
signapple apply dist/Bitcoin-Qt.app codesignatures/osx/"${HOST}"/dist/Bitcoin-Qt.app
95+
find "${DISTNAME}" -wholename "*/bin/*" -type f | while read -r bin
96+
do
97+
signapple apply "${bin}" "codesignatures/osx/${HOST}/${bin}.${ARCH}sign"
98+
done
8799

88100
# Make a .zip from dist/
89101
cd dist/
90102
find . -print0 \
91103
| xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}"
92104
find . | sort \
93105
| zip -X@ "${OUTDIR}/${DISTNAME}-${HOST}.zip"
106+
cd ..
107+
108+
# Make a .tar.gz from bins
109+
find "${DISTNAME}" -print0 \
110+
| sort --zero-terminated \
111+
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \
112+
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}.tar.gz" \
113+
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}.tar.gz" && exit 1 )
94114
;;
95115
*)
96116
exit 1

0 commit comments

Comments
 (0)