-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (67 loc) · 3.22 KB
/
Copy pathMakefile
File metadata and controls
77 lines (67 loc) · 3.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
APP = build/QuikTerm.app
BINARY = .build/release/QuikTermMain
GHOSTTY = vendor/ghostty
# macOS keys permission grants (TCC: removable volumes, automation, …) to the
# code signing identity. Ad-hoc signing mints a fresh identity on every build,
# so each `make app` makes macOS forget every grant and prompt again. Signing
# with a real certificate keeps one identity across rebuilds and the grants
# stick. Auto-detected so this stays portable; override with
# `make app CODESIGN_ID="Apple Development: …"`, or fall back to ad-hoc ("-")
# on a machine with no certificate.
CODESIGN_ID ?= $(shell security find-identity -v -p codesigning 2>/dev/null \
| sed -n 's/.*"\(Developer ID Application: [^"]*\)".*/\1/p' | head -1)
ifeq ($(strip $(CODESIGN_ID)),)
CODESIGN_ID := -
endif
.PHONY: ghostty build app run test check-client clean icon
# Regenerates Resources/AppIcon.icns from the drawing code (run after
# changing Sources/QuikTermCore/App/AppIcon.swift).
icon:
mkdir -p build
swiftc -O scripts/appicon/main.swift Sources/QuikTermCore/App/AppIcon.swift -o build/appicon-gen
rm -rf build/AppIcon.iconset
build/appicon-gen build/AppIcon.iconset
iconutil -c icns build/AppIcon.iconset -o Resources/AppIcon.icns
rm -rf build/AppIcon.iconset build/appicon-gen
ghostty:
./scripts/build-ghosttykit.sh
build:
swift build -c release
test:
swift test
# Syntax-checks and unit-tests the browser client.
#
# The loop is load-bearing: `node --check` parses only its FIRST file
# argument and ignores the rest, so `node --check Resources/remote/*.js`
# reports on addon-fit.js alone and exits 0 however broken the other twelve
# files are. Resources/remote/package.json is the other half — without its
# `"type": "module"` Node resolves these as CommonJS, "detects" the ESM
# syntax, and exits 0 on files it never parsed as modules.
check-client:
@set -e; for f in Resources/remote/*.js; do node --check "$$f" && echo "ok $$f"; done
node --test 'Tests/client/*.test.js'
app: build
rm -rf $(APP)
mkdir -p $(APP)/Contents/MacOS $(APP)/Contents/Resources
cp $(BINARY) $(APP)/Contents/MacOS/QuikTerm
# Named QuikTermCLI (not lowercase "quikterm") inside the bundle: the
# default case-insensitive/case-preserving APFS volume treats
# "QuikTerm" and "quikterm" as the SAME directory entry, so a
# lowercase copy here would silently clobber the GUI binary above.
# installCLI() in AppDelegate symlinks this to the externally-visible
# lowercase `quikterm` name in /usr/local/bin, which is unaffected.
cp .build/release/QuikTermCLI $(APP)/Contents/MacOS/QuikTermCLI
cp .build/release/QuikTermRelay $(APP)/Contents/MacOS/QuikTermRelay
cp Resources/Info.plist $(APP)/Contents/Info.plist
cp Resources/AppIcon.icns $(APP)/Contents/Resources/AppIcon.icns
cp -R $(GHOSTTY)/zig-out/share/terminfo $(APP)/Contents/Resources/terminfo
cp -R $(GHOSTTY)/zig-out/share/ghostty $(APP)/Contents/Resources/ghostty
cp -R Resources/remote $(APP)/Contents/Resources/remote
@echo "codesigning as: $(CODESIGN_ID)"
codesign --force --sign "$(CODESIGN_ID)" $(APP)/Contents/MacOS/QuikTermCLI
codesign --force --sign "$(CODESIGN_ID)" $(APP)/Contents/MacOS/QuikTermRelay
codesign --force --sign "$(CODESIGN_ID)" $(APP)
run: app
$(APP)/Contents/MacOS/QuikTerm
clean:
rm -rf .build build