-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (30 loc) · 1.26 KB
/
Makefile
File metadata and controls
33 lines (30 loc) · 1.26 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
APP_NAME := CroPDF
EXECUTABLE := CroPDFMacOS
CONFIGURATION ?= release
DIST_DIR := $(CURDIR)/dist
APP_DIR := $(DIST_DIR)/$(APP_NAME).app
CONTENTS_DIR := $(APP_DIR)/Contents
MACOS_DIR := $(CONTENTS_DIR)/MacOS
RESOURCES_DIR := $(CONTENTS_DIR)/Resources
DMG_PATH := $(DIST_DIR)/$(APP_NAME).dmg
CREATE_DMG_VERSION ?= 8.0.0
APP_SIGN_IDENTITY ?= -
.PHONY: dmg clean
dmg:
@set -euo pipefail; \
swift build --disable-sandbox -c "$(CONFIGURATION)"; \
BIN_DIR="$$(swift build --disable-sandbox -c "$(CONFIGURATION)" --show-bin-path)"; \
rm -rf "$(APP_DIR)"; \
mkdir -p "$(MACOS_DIR)" "$(RESOURCES_DIR)"; \
cp "$$BIN_DIR/$(EXECUTABLE)" "$(MACOS_DIR)/$(EXECUTABLE)"; \
cp -R "$$BIN_DIR/$(EXECUTABLE)_$(EXECUTABLE).bundle" "$(RESOURCES_DIR)/$(EXECUTABLE)_$(EXECUTABLE).bundle"; \
cp "$(CURDIR)/src/Resources/$(APP_NAME).icns" "$(RESOURCES_DIR)/$(APP_NAME).icns"; \
cp "$(CURDIR)/scripts/Info.plist" "$(CONTENTS_DIR)/Info.plist"; \
codesign --force --deep --sign "$(APP_SIGN_IDENTITY)" "$(APP_DIR)"; \
codesign --verify --deep --strict --verbose=2 "$(APP_DIR)"; \
rm -f "$(DMG_PATH)"; \
npx --yes "create-dmg@$(CREATE_DMG_VERSION)" --overwrite --no-version-in-filename --no-code-sign "$(APP_DIR)" "$(DIST_DIR)"; \
rm -rf "$(APP_DIR)"; \
echo "Built $(DMG_PATH)"
clean:
rm -rf "$(DIST_DIR)"