-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
47 lines (37 loc) · 1.5 KB
/
Makefile
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
BINARY_NAME=xopen
ifeq ($(shell uname -m),arm64)
BINARIES_FOLDER=/opt/homebrew/bin
else
BINARIES_FOLDER=/usr/local/bin
endif
EXECUTABLE=$(shell swift build --configuration release --show-bin-path --arch arm64 --arch x86_64)/$(BINARY_NAME)
.PHONY: format lint check-env build install clean release_zip
format:
swift-format format --parallel --in-place --recursive ./Sources --recursive ./Tests
lint:
swift-format lint --parallel --recursive ./Sources --recursive ./Tests
check-env:
if test "$(SIGNING_IDENTIFIER)" = "" ; then \
echo "SIGNING_IDENTIFIER not set"; \
exit 1; \
fi
build:
swift build -c release --arch arm64 --arch x86_64
install: clean build
install -d "$(BINARIES_FOLDER)"
install "$(EXECUTABLE)" "$(BINARIES_FOLDER)"
clean:
swift package clean
# You need to define `SIGNING_IDENTIFIER` environment variable. the value looks like "Developer ID Application: <TEAM NAME> (<TEAM_ID>)". You can see <TEAM NAME> and <TEAM_ID> at https://developer.apple.com/account/#!/membership
release_zip: check-env install
# make sure `xcrun notarytool` exists.
xcrun notarytool --help
rm -rf release_binary
rm -rf release_binary.zip
mkdir release_binary
cp "$(EXECUTABLE)" release_binary
cp "README.md" release_binary
codesign --force --options runtime --deep-verify --verbose --sign "$(SIGNING_IDENTIFIER)" release_binary/"$(BINARY_NAME)"
ditto -c -k --keepParent release_binary release_binary.zip
rm -rf release_binary
xcrun notarytool submit ./release_binary.zip --keychain-profile 'AC_PASSWORD' --wait