-
-
Notifications
You must be signed in to change notification settings - Fork 231
Expand file tree
/
Copy pathMakefile
More file actions
196 lines (157 loc) · 5.98 KB
/
Copy pathMakefile
File metadata and controls
196 lines (157 loc) · 5.98 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
BUILD_DIR := build
BIN_DIR := build/bin
RM := rm
TAG := $(shell git describe --tags --abbrev=0)
APPIMAGE_BUILD_ENV_DIR := ./scripts/runners/appimage/
APPIMAGE_BUILD_ENV_IMAGE_TAG := vicinae/appimage-build-env
FIGURA_CC := $(BIN_DIR)/figura
SHELL := /bin/sh
release:
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLTO=ON -B $(BUILD_DIR)
cmake --build $(BUILD_DIR)
.PHONY: release
host-optimized:
CXXFLAGS="${CXXFLAGS} -march=native" cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLTO=ON -B build
cmake --build $(BUILD_DIR)
.PHONY: optimized
preview:
cmake -G Ninja -DENABLE_PREVIEW_FEATURES=ON -DCMAKE_BUILD_TYPE=Release -B $(BUILD_DIR)
cmake --build $(BUILD_DIR)
.PHONY: preview
debug:
cmake -GNinja -DLTO=OFF -DENABLE_PREVIEW_FEATURES=ON -DENABLE_SANITIZERS=ON -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -B $(BUILD_DIR)
cmake --build $(BUILD_DIR) --parallel
.PHONY: debug
mac-bundle:
./scripts/macdeploy.sh $(BUILD_DIR)
.PHONY: mac-bundle
mac-deps:
@./scripts/macos-setup.sh
.PHONY: mac-deps
debug-tidy:
# we need to run tidy with clang to avoid false positives
CC=clang CXX=clang++ cmake -G Ninja -DLTO=OFF -DENABLE_PREVIEW_FEATURES=ON -DENABLE_SANITIZERS=ON -DENABLE_CLANG_TIDY=ON -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -B $(BUILD_DIR)
cmake --build $(BUILD_DIR)
.PHONY: debug-tidy
genicon:
node scripts/generate-icons.js
.PHONY: genicon
install:
cmake --install $(BUILD_DIR)
.PHONY: install
strip:
strip -s ./build/vicinae/vicinae
.PHONY: strip
test:
./$(BIN_DIR)/vicinae-glyph-tests
./$(BIN_DIR)/vicinae-fuzzy-tests
./$(BIN_DIR)/vicinae-server-tests
./$(BIN_DIR)/xdgpp-tests
./$(BIN_DIR)/scriptcommand-tests
./$(BIN_DIR)/vicinae-file-indexer-tests
.PHONY: test
static:
cmake -G Ninja -DPREFER_STATIC_LIBS=ON -DCMAKE_BUILD_TYPE=Release -B $(BUILD_DIR)
cmake --build $(BUILD_DIR)
.PHONY: static
# things we can't really do in cmake. should be run with elevated privileges
postbuild:
setcap "cap_dac_override+ep" ./build/bin/vicinae-input-server
.PHONY: postbuild
# optimize for portability (build problematic libs statically)
# this will increase compile time as more libraries will have to be compiled from source,
# but the resulting binary will be more portable across different distros, especially the ones
# shipping older packages.
portable:
cmake -G Ninja -DUSE_SYSTEM_CMARK_GFM=OFF -B $(BUILD_DIR)
cmake --build $(BUILD_DIR)
.PHONY: portable
appimage:
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=./build/install -DVICINAE_PROVENANCE=appimage -B $(BUILD_DIR)
cmake --build $(BUILD_DIR)
cmake --install $(BUILD_DIR)
./scripts/mkappimage.sh ./build/install AppDir
.PHONY: appimage
appimage-build-env-run:
docker run -v$(PWD):/work --cap-add SYS_ADMIN --device /dev/fuse -it $(APPIMAGE_BUILD_ENV_IMAGE_TAG)
.PHONY: appimage-dev
appimage-build-env:
docker build -f $(APPIMAGE_BUILD_ENV_DIR)/AppImageBuilder.Dockerfile $(APPIMAGE_BUILD_ENV_DIR) -t $(APPIMAGE_BUILD_ENV_IMAGE_TAG)
.PHONY: appimage-build-env
appimage-build-gh-runner: appimage-build-env
docker build -f $(APPIMAGE_BUILD_ENV_DIR)/gh-runner.Dockerfile $(APPIMAGE_BUILD_ENV_DIR) -t vicinae/appimage-gh-runner
.PHONY: appimage-build-gh-runner
appimage-build-env-push:
docker push $(APPIMAGE_BUILD_ENV_IMAGE_TAG)
.PHONY: appimage-build-env-push
depot-push-arch:
depot build --save --save-tag arch-latest --platform linux/amd64 -f scripts/runners/arch/base.Dockerfile scripts/runners/arch
.PHONY: depot-push-arch
depot-push-appimage-amd64:
depot build --save --save-tag appimage-amd64-latest --platform linux/amd64 -f scripts/runners/appimage/AppImageBuilder.Dockerfile scripts/runners/appimage
.PHONY: depot-push-appimage-amd64
depot-push-appimage-arm64:
depot build --save --save-tag appimage-arm64-latest --platform linux/arm64 -f scripts/runners/appimage/AppImageBuilder.Dockerfile scripts/runners/appimage
.PHONY: depot-push-appimage-arm64
NPROC := $(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
CLANG_FORMAT := $(shell command -v clang-format 2>/dev/null || echo /opt/homebrew/opt/llvm/bin/clang-format)
qmlformat:
find ./src -type f -name '*.qml' -print0 | xargs -0 -n 10 -P $(NPROC) qmlformat -i
.PHONY: qmlformat
tsfmt:
cd src/typescript && biome format --write .
.PHONY: tsfmt
clang-format:
find ./src -type f \( -name '*.cpp' -o -name '*.hpp' \) -print0 | xargs -0 -n 10 -P $(NPROC) clang-format -i
.PHONY: clang-format
format: qmlformat tsfmt clang-format
.PHONY: format
check-format:
find ./src -type f \( -name '*.cpp' -o -name '*.hpp' \) -print0 | xargs -0 -n 10 -P $(NPROC) $(CLANG_FORMAT) --dry-run -Werror
.PHONY: check-format
bump-patch:
./scripts/bump_version.sh patch
.PHONY: bump-patch
bump-minor:
./scripts/bump_version.sh minor
.PHONY: bump-minor
bump-major:
./scripts/bump_version.sh major
.PHONY: bump-major
nix-hash:
$(SHELL) scripts/update-nix-npm-hashes.sh
.PHONY: nix-hashes
nix-hash-check:
$(SHELL) scripts/update-nix-npm-hashes.sh --check
.PHONY: nix-hash-check
# if we need to manually create a release
gh-release:
mkdir -p dist
cmake -G Ninja -DCMAKE_INSTALL_PREFIX=dist -DCMAKE_BUILD_TYPE=Release -B $(BUILD_DIR)
cmake --build $(BUILD_DIR)
cmake --install build
tar -czvf vicinae-linux-x86_64-$(TAG).tar.gz -C dist .
.PHONY: gh-release
run-limited:
systemd-run --user --scope -p MemoryMax=1G -p MemorySwapMax=0 ./$(BIN_DIR)/vicinae-server server --frontend=qml
.PHONY: run-limited
clean:
rm -rf $(BUILD_DIR)
$(RM) -rf ./src/typescript/api/node_modules
$(RM) -rf ./src/typescript/api/dist
$(RM) -rf ./src/typescript/api/src/proto
$(RM) -rf ./src/typescript/extension-manager/dist/
$(RM) -rf ./src/typescript/extension-manager/node_modules
$(RM) -rf ./src/typescript/extension-manager/src/proto
$(RM) -rf ./scripts/.tmp
$(RM) -rf ./src/lib/*/build
.PHONY: clean
figen:
$(FIGURA_CC) compile ./figura/tsapi.fig --client typescript --output ./src/typescript/api/src/api/proto/api.ts
$(FIGURA_CC) compile ./figura/tsapi.fig --client typescript --output ./src/typescript/extension-manager/src/proto/api.ts
.PHONY:
figen
re: clean release
.PHONY: re
redev: clean dev
.PHONY: redev