Skip to content

Commit aa4b929

Browse files
staticfloatKristofferC
authored andcommitted
[macOS] Codesign binary-dist tarballs (#44305)
Because we're starting to distribute macOS tarballs as well, let's codesign them by default, when possible. (cherry picked from commit 6b29ebd)
1 parent c3a63ed commit aa4b929

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,21 @@ ifeq ($(OS), Linux)
431431
endif
432432
ifeq ($(OS), WINNT)
433433
cd $(BUILDROOT)/julia-$(JULIA_COMMIT)/bin && rm -f llvm* llc.exe lli.exe opt.exe LTO.dll bugpoint.exe macho-dump.exe
434+
endif
435+
# If we're on macOS, and we have a codesigning identity, then codesign the binary-dist tarball!
436+
ifeq ($(OS),Darwin)
437+
ifneq ($(MACOS_CODESIGN_IDENTITY),)
438+
echo "Codesigning with identity $(MACOS_CODESIGN_IDENTITY)"; \
439+
MACHO_FILES=$$(find "$(BUILDROOT)/julia-$(JULIA_COMMIT)" -type f -perm -0111 | cut -d: -f1); \
440+
for f in $${MACHO_FILES}; do \
441+
echo "Codesigning $${f}..."; \
442+
codesign -s "$(MACOS_CODESIGN_IDENTITY)" --option=runtime --entitlements $(JULIAHOME)/contrib/mac/app/Entitlements.plist -vvv --timestamp --deep --force "$${f}"; \
443+
done
444+
endif
434445
endif
435446
cd $(BUILDROOT) && $(TAR) zcvf $(JULIA_BINARYDIST_FILENAME).tar.gz julia-$(JULIA_COMMIT)
436447

448+
437449
exe:
438450
# run Inno Setup to compile installer
439451
$(call spawn,$(JULIAHOME)/dist-extras/inno/iscc.exe /DAppVersion=$(JULIA_VERSION) /DSourceDir="$(call cygpath_w,$(BUILDROOT)/julia-$(JULIA_COMMIT))" /DRepoDir="$(call cygpath_w,$(JULIAHOME))" /F"$(JULIA_BINARYDIST_FILENAME)" /O"$(call cygpath_w,$(BUILDROOT))" $(INNO_ARGS) $(call cygpath_w,$(JULIAHOME)/contrib/windows/build-installer.iss))

contrib/mac/app/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ dmg/$(APP_NAME): startup.applescript julia.icns
5050
make -C $(JULIAHOME) binary-dist
5151
tar zxf $(JULIAHOME)/$(JULIA_BINARYDIST_FILENAME).tar.gz -C $@/Contents/Resources/julia --strip-components 1
5252
find $@/Contents/Resources/julia -type f -exec chmod -w {} \;
53+
# Even though the tarball may already be signed, we re-sign here to make it easier to add
54+
# unsigned executables (like the app launcher) and whatnot, without needing to maintain lists
55+
# of what is or is not signed. Codesigning is cheap, so might as well do it early and often.
5356
if [ -n "$$MACOS_CODESIGN_IDENTITY" ]; then \
5457
echo "Codesigning with identity $$MACOS_CODESIGN_IDENTITY"; \
5558
MACHO_FILES=$$(find "$@" -type f -perm -0111 | cut -d: -f1); \

0 commit comments

Comments
 (0)