-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
462 lines (374 loc) · 18.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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
PREFIX ?= $(HOME)/.local
CACHE_DIR ?= .cache
IMPORT_DIR := .godot
ROOTFS ?= $(CACHE_DIR)/rootfs
OGUI_VERSION ?= $(shell grep 'core = ' core/global/version.tres | cut -d '"' -f2)
GODOT ?= godot
GODOT_VERSION ?= $(shell $(GODOT) --version | grep -o '[0-9].*[0-9]\.' | sed 's/.$$//')
GODOT_RELEASE ?= $(shell $(GODOT) --version | grep -oP '^[0-9].*?[a-z]\.' | grep -oP '[a-z]+')
GODOT_REVISION := $(GODOT_VERSION).$(GODOT_RELEASE)
GAMESCOPE ?= gamescope
GAMESCOPE_CMD ?= $(GAMESCOPE) -e --xwayland-count 2 --
BUILD_TYPE ?= release
EXPORT_TEMPLATE ?= $(HOME)/.local/share/godot/export_templates/$(GODOT_REVISION)/linux_$(BUILD_TYPE).x86_64
#EXPORT_TEMPLATE_URL ?= https://downloads.tuxfamily.org/godotengine/$(GODOT_VERSION)/Godot_v$(GODOT_VERSION)-$(GODOT_RELEASE)_export_templates.tpz
EXPORT_TEMPLATE_URL ?= https://github.com/godotengine/godot/releases/download/$(GODOT_VERSION)-$(GODOT_RELEASE)/Godot_v$(GODOT_VERSION)-$(GODOT_RELEASE)_export_templates.tpz
ALL_ADDONS := ./addons/dbus/bin/libdbus.linux.template_$(BUILD_TYPE).x86_64.so ./addons/linuxthread/bin/liblinuxthread.linux.template_$(BUILD_TYPE).x86_64.so ./addons/pty/bin/libpty.linux.template_$(BUILD_TYPE).x86_64.so ./addons/unixsock/bin/libunixsock.linux.template_$(BUILD_TYPE).x86_64.so ./addons/xlib/bin/libxlib.linux.template_$(BUILD_TYPE).x86_64.so
ALL_ADDON_FILES := $(shell find ./addons -regex '.*\(\.cpp\|\.h\|\.hpp\)$$')
ALL_GDSCRIPT := $(shell find ./ -name '*.gd')
ALL_SCENES := $(shell find ./ -name '*.tscn')
ALL_RESOURCES := $(shell find ./ -regex '.*\(\.tres\|\.svg\|\.png\)$$')
PROJECT_FILES := $(ALL_ADDONS) $(ALL_GDSCRIPT) $(ALL_SCENES) $(ALL_RESOURCES)
# Docker image variables
IMAGE_NAME ?= ghcr.io/shadowblip/opengamepadui-builder
IMAGE_TAG ?= latest
ADDONS_IMAGE_NAME ?= ghcr.io/shadowblip/opengamepadui-addons-builder
ADDONS_IMAGE_TAG ?= latest
# Remote debugging variables
SSH_USER ?= deck
SSH_HOST ?= 192.168.0.65
SSH_MOUNT_PATH ?= /tmp/remote
SSH_DATA_PATH ?= /home/$(SSH_USER)/Projects
# systemd-sysext variables
SYSEXT_ID ?= steamos
SYSEXT_VERSION_ID ?= 3.6.3
# Include any user defined settings
-include settings.mk
##@ General
# The help target prints out all targets with their descriptions organized
# beneath their categories. The categories are represented by '##@' and the
# target descriptions by '##'. The awk commands is responsible for reading the
# entire set of makefiles included in this invocation, looking for lines of the
# file as xyz: ## something, and then pretty-format the target and help. Then,
# if there's a line with ##@ something, that gets pretty-printed as a category.
# More info on the usage of ANSI control characters for terminal formatting:
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
# More info on the awk command:
# http://linuxcommand.org/lc3_adv_awk.php
.PHONY: help
help: ## Display this help.
@echo "Godot Version: '$(GODOT_VERSION)'"
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
.PHONY: install
install: rootfs ## Install OpenGamepadUI (default: ~/.local)
cd $(ROOTFS) && make install PREFIX=$(PREFIX)
.PHONY: uninstall
uninstall: ## Uninstall OpenGamepadUI
cd $(ROOTFS) && make uninstall PREFIX=$(PREFIX)
##@ Systemd Extension
.PHONY: enable-ext
enable-ext: ## Enable systemd extensions
mkdir -p $(HOME)/.var/lib/extensions
sudo ln -s $(HOME)/.var/lib/extensions /var/lib/extensions
sudo systemctl enable systemd-sysext
sudo systemctl start systemd-sysext
systemd-sysext status
.PHONY: disable-ext
disable-ext: ## Disable systemd extensions
sudo systemctl stop systemd-sysext
sudo systemctl disable systemd-sysext
.PHONY: install-ext
install-ext: systemd-sysext ## Install OpenGamepadUI as a systemd extension
cp dist/opengamepadui.raw $(HOME)/.var/lib/extensions
sudo systemd-sysext refresh
systemd-sysext status
.PHONY: uninstall-ext
uninstall-ext: ## Uninstall the OpenGamepadUI systemd extension
rm -rf $(HOME)/.var/lib/extensions
sudo systemd-sysext refresh
systemd-sysext status
##@ Development
ifeq ($(GAMESCOPE_CMD),)
HEADLESS := --headless
endif
.PHONY: test
test: $(IMPORT_DIR) ## Run all unit tests
$(GAMESCOPE_CMD) $(GODOT) \
--position 320,140 \
--path $(PWD) $(HEADLESS) \
--script res://addons/gut/gut_cmdln.gd
.PHONY: build
build: build/opengamepad-ui.x86_64 ## Build and export the project
build/opengamepad-ui.x86_64: $(IMPORT_DIR) $(PROJECT_FILES) $(EXPORT_TEMPLATE)
@echo "Building OpenGamepadUI v$(OGUI_VERSION)"
mkdir -p build
$(GODOT) -v --headless --export-$(BUILD_TYPE) "Linux/X11"
.PHONY: metadata
metadata: build/metadata.json ## Build update metadata
build/metadata.json: build/opengamepad-ui.x86_64 assets/crypto/keys/opengamepadui.key
@echo "Building update metadata"
@FILE_SIGS='{'; \
cd build; \
# Sign any GDExtension libraries \
for lib in `ls *.so`; do \
echo "Signing file: $$lib"; \
SIG=$$(openssl dgst -sha256 -sign ../assets/crypto/keys/opengamepadui.key $$lib | base64 -w 0); \
HASH=$$(sha256sum $$lib | cut -d' ' -f1); \
FILE_SIGS="$$FILE_SIGS\"$$lib\": {\"signature\": \"$$SIG\", \"hash\": \"$$HASH\"}, "; \
done; \
# Sign the binary files \
echo "Signing file: opengamepad-ui.x86_64"; \
SIG=$$(openssl dgst -sha256 -sign ../assets/crypto/keys/opengamepadui.key opengamepad-ui.x86_64 | base64 -w 0); \
HASH=$$(sha256sum opengamepad-ui.x86_64 | cut -d' ' -f1); \
FILE_SIGS="$$FILE_SIGS\"opengamepad-ui.x86_64\": {\"signature\": \"$$SIG\", \"hash\": \"$$HASH\"}, "; \
echo "Signing file: opengamepad-ui.pck"; \
SIG=$$(openssl dgst -sha256 -sign ../assets/crypto/keys/opengamepadui.key opengamepad-ui.pck | base64 -w 0); \
HASH=$$(sha256sum opengamepad-ui.pck | cut -d' ' -f1); \
FILE_SIGS="$$FILE_SIGS\"opengamepad-ui.pck\": {\"signature\": \"$$SIG\", \"hash\": \"$$HASH\"}}"; \
# Write out the signatures to metadata.json \
echo "{\"version\": \"$(OGUI_VERSION)\", \"engine_version\": \"$(GODOT_REVISION)\", \"files\": $$FILE_SIGS}" > metadata.json
@echo "Metadata written to $@"
.PHONY: import
import: $(IMPORT_DIR) ## Import project assets
$(IMPORT_DIR): $(ALL_ADDONS)
@echo "Importing project assets. This will take some time..."
command -v $(GODOT) > /dev/null 2>&1
timeout --foreground 40 $(GODOT) --headless --editor . > /dev/null 2>&1 || echo "Finished"
touch $(IMPORT_DIR)
.PHONY: force-import
force-import: $(ALL_ADDONS)
@echo "Force importing project assets. This will take some time..."
command -v $(GODOT) > /dev/null 2>&1
timeout --foreground 40 $(GODOT) --headless --editor . > /dev/null 2>&1 || echo "Finished"
timeout --foreground 40 $(GODOT) --headless --editor . > /dev/null 2>&1 || echo "Finished"
.PHONY: addons
addons: $(ALL_ADDONS) ## Build GDExtension addons
$(ALL_ADDONS) &: $(ALL_ADDON_FILES)
@echo "Building native GDExtension addons..."
cd ./gdext && $(MAKE) build
.PHONY: edit
edit: $(IMPORT_DIR) ## Open the project in the Godot editor
$(GODOT) --editor .
.PHONY: clean
clean: ## Remove build artifacts
rm -rf build
rm -rf $(ROOTFS)
rm -rf $(CACHE_DIR)
rm -rf dist
rm -rf $(IMPORT_DIR)
cd ./gdext && $(MAKE) clean
.PHONY: run run-force
run: build/opengamepad-ui.x86_64 run-force ## Run the project in gamescope
run-force:
$(GAMESCOPE) -w 1920 -h 1080 -f \
--xwayland-count 2 -- ./build/opengamepad-ui.x86_64
$(EXPORT_TEMPLATE):
mkdir -p $(HOME)/.local/share/godot/export_templates
@echo "Downloading export templates"
wget $(EXPORT_TEMPLATE_URL) -O $(HOME)/.local/share/godot/export_templates/templates.zip
@echo "Extracting export templates"
unzip $(HOME)/.local/share/godot/export_templates/templates.zip -d $(HOME)/.local/share/godot/export_templates/
rm $(HOME)/.local/share/godot/export_templates/templates.zip
mv $(HOME)/.local/share/godot/export_templates/templates $(@D)
.PHONY: debug
debug: $(IMPORT_DIR) ## Run the project in debug mode in gamescope
$(GAMESCOPE) -e --xwayland-count 2 -- \
$(GODOT) --path $(PWD) --remote-debug tcp://127.0.0.1:6007 \
--position 320,140 res://entrypoint.tscn
.PHONY: debug-overlay
debug-overlay: $(IMPORT_DIR) ## Run the project in debug mode in gamescope with --overlay-mode
$(GAMESCOPE) --xwayland-count 2 -- \
$(GODOT) --path $(PWD) --remote-debug tcp://127.0.0.1:6007 \
--position 320,140 res://entrypoint.tscn --overlay-mode -- steam -gamepadui -steamos3 -steampal -steamdeck
.PHONY: docs
docs: docs/api/classes/.generated ## Generate docs
docs/api/classes/.generated: $(IMPORT_DIR) $(ALL_GDSCRIPT)
rm -rf docs/api/classes
$(GODOT) \
--editor \
--path $(PWD) \
--quit \
--doctool docs/api/classes \
--no-docbase \
--gdscript-docs core
rm -rf docs/api/classes/core--*
$(MAKE) -C docs/api rst
.PHONY: inspect
inspect: $(IMPORT_DIR) ## Launch Gamescope inspector
$(GODOT) --path $(PWD) res://core/ui/menu/debug/gamescope_inspector.tscn
.PHONY: signing-keys
signing-keys: assets/crypto/keys/opengamepadui.pub ## Generate a signing keypair to sign packages
assets/crypto/keys/opengamepadui.key:
@echo "Generating signing keys"
mkdir -p assets/crypto/keys
openssl genrsa -out $@ 4096
assets/crypto/keys/opengamepadui.pub: assets/crypto/keys/opengamepadui.key
openssl rsa -in $^ -outform PEM -pubout -out $@
##@ Remote Debugging
.PHONY: deploy
deploy: dist-archive $(SSH_MOUNT_PATH)/.mounted ## Build, deploy, and tunnel to a remote device
cp dist/opengamepadui.tar.gz $(SSH_MOUNT_PATH)
cd $(SSH_MOUNT_PATH) #&& tar xvfz opengamepadui.tar.gz
ssh -t $(SSH_USER)@$(SSH_HOST) tar xvfz "$(SSH_DATA_PATH)/opengamepadui.tar.gz"
.PHONY: deploy-update
deploy-update: dist/update.zip ## Build and deploy update zip to remote device
ssh $(SSH_USER)@$(SSH_HOST) mkdir -p .local/share/opengamepadui/updates
scp dist/update.zip $(SSH_USER)@$(SSH_HOST):~/.local/share/opengamepadui/updates
.PHONY: deploy-ext
deploy-ext: dist-ext ## Build and deploy systemd extension to remote device
ssh $(SSH_USER)@$(SSH_HOST) mkdir -p .var/lib/extensions .config/systemd/user .local/bin
scp dist/opengamepadui.raw $(SSH_USER)@$(SSH_HOST):~/.var/lib/extensions
scp rootfs/usr/lib/systemd/user/systemd-sysext-updater.service $(SSH_USER)@$(SSH_HOST):~/.config/systemd/user
scp rootfs/usr/share/opengamepadui/scripts/update_systemd_ext.sh $(SSH_USER)@$(SSH_HOST):~/.local/bin
ssh -t $(SSH_USER)@$(SSH_HOST) systemctl --user enable --now systemd-sysext-updater || echo "WARN: failed to restart sysext updater"
sleep 3
ssh -t $(SSH_USER)@$(SSH_HOST) sudo systemd-sysext refresh
ssh $(SSH_USER)@$(SSH_HOST) systemd-sysext status
.PHONY: enable-debug
enable-debug: ## Set OpenGamepadUI command to use remote debug on target device
ssh $(SSH_USER)@$(SSH_HOST) mkdir -p .config/environment.d
echo 'CLIENTCMD="opengamepadui --remote-debug tcp://127.0.0.1:6007"' | \
ssh $(SSH_USER)@$(SSH_HOST) bash -c \
'cat > .config/environment.d/opengamepadui-session.conf'
.PHONY: tunnel
tunnel: ## Create an SSH tunnel to allow remote debugging
ssh $(SSH_USER)@$(SSH_HOST) -N -f -R 6007:localhost:6007
# Mounts the remote device and creates an SSH tunnel for remote debugging
$(SSH_MOUNT_PATH)/.mounted:
mkdir -p $(SSH_MOUNT_PATH)
sshfs -o default_permissions $(SSH_USER)@$(SSH_HOST):$(SSH_DATA_PATH) $(SSH_MOUNT_PATH)
$(MAKE) tunnel
touch $(SSH_MOUNT_PATH)/.mounted
##@ Distribution
.PHONY: rootfs
rootfs: build/opengamepad-ui.x86_64
rm -rf $(ROOTFS)
mkdir -p $(ROOTFS)
cp -r rootfs/* $(ROOTFS)
mkdir -p $(ROOTFS)/usr/share/opengamepadui
cp -r build/*.so $(ROOTFS)/usr/share/opengamepadui
cp -r build/opengamepad-ui.x86_64 $(ROOTFS)/usr/share/opengamepadui
cp -r build/opengamepad-ui.pck $(ROOTFS)/usr/share/opengamepadui
touch $(ROOTFS)/.gdignore
.PHONY: dist
dist: dist/opengamepadui.tar.gz dist/opengamepadui.raw dist/update.zip dist/opengamepadui-$(OGUI_VERSION)-1.x86_64.rpm ## Create all redistributable versions of the project
cd dist && sha256sum opengamepadui-$(OGUI_VERSION)-1.x86_64.rpm > opengamepadui-$(OGUI_VERSION)-1.x86_64.rpm.sha256.txt
cd dist && sha256sum opengamepadui.tar.gz > opengamepadui.tar.gz.sha256.txt
cd dist && sha256sum opengamepadui.raw > opengamepadui.raw.sha256.txt
cd dist && sha256sum update.zip > update.zip.sha256.txt
.PHONY: dist-rpm
dist-rpm: dist/opengamepadui-$(OGUI_VERSION)-1.x86_64.rpm ## Create a redistributable RPM
dist/opengamepadui-$(OGUI_VERSION)-1.x86_64.rpm: dist/opengamepadui.tar.gz
@echo "Building redistributable RPM package"
mkdir -p dist $(HOME)/rpmbuild/SOURCES
cp dist/opengamepadui.tar.gz $(HOME)/rpmbuild/SOURCES
rpmbuild -bb package/rpm/opengamepadui.spec
cp $(HOME)/rpmbuild/RPMS/x86_64/opengamepadui-$(OGUI_VERSION)-1.x86_64.rpm dist
.PHONY: dist-archive
dist-archive: dist/opengamepadui.tar.gz ## Create a redistributable tar.gz of the project
dist/opengamepadui.tar.gz: rootfs
@echo "Building redistributable tar.gz archive"
mkdir -p dist
mv $(ROOTFS) $(CACHE_DIR)/opengamepadui
cd $(CACHE_DIR) && tar cvfz opengamepadui.tar.gz opengamepadui
mv $(CACHE_DIR)/opengamepadui.tar.gz dist
mv $(CACHE_DIR)/opengamepadui $(ROOTFS)
.PHONY: dist-update-zip
dist-update-zip: dist/update.zip ## Create an update zip archive
dist/update.zip: build/metadata.json
@echo "Building redistributable update zip"
mkdir -p $(CACHE_DIR)
rm -rf $(CACHE_DIR)/update.zip
cd build && zip -5 ../$(CACHE_DIR)/update *.so opengamepad-ui.* metadata.json
mkdir -p dist
cp $(CACHE_DIR)/update.zip $@
# https://blogs.igalia.com/berto/2022/09/13/adding-software-to-the-steam-deck-with-systemd-sysext/
.PHONY: dist-ext
dist-ext: dist/opengamepadui.raw ## Create a systemd-sysext extension archive
dist/opengamepadui.raw: dist/opengamepadui.tar.gz $(CACHE_DIR)/gamescope-session.tar.gz $(CACHE_DIR)/gamescope-session-opengamepadui.tar.gz $(CACHE_DIR)/powerstation.tar.gz $(CACHE_DIR)/inputplumber.tar.gz
@echo "Building redistributable systemd extension"
mkdir -p dist
rm -rf dist/opengamepadui.raw $(CACHE_DIR)/opengamepadui.raw
cp dist/opengamepadui.tar.gz $(CACHE_DIR)
cd $(CACHE_DIR) && tar xvfz opengamepadui.tar.gz opengamepadui/usr
mkdir -p $(CACHE_DIR)/opengamepadui/usr/lib/extension-release.d
echo ID=$(SYSEXT_ID) > $(CACHE_DIR)/opengamepadui/usr/lib/extension-release.d/extension-release.opengamepadui
echo VERSION_ID=$(SYSEXT_VERSION_ID) >> $(CACHE_DIR)/opengamepadui/usr/lib/extension-release.d/extension-release.opengamepadui
@# Copy gamescope-session into the extension
cd $(CACHE_DIR) && tar xvfz gamescope-session.tar.gz
cp -r $(CACHE_DIR)/gamescope-session-main/usr/* $(CACHE_DIR)/opengamepadui/usr
@# Copy opengamepadui-session into the extension
cd $(CACHE_DIR) && tar xvfz gamescope-session-opengamepadui.tar.gz
cp -r $(CACHE_DIR)/gamescope-session-opengamepadui-main/usr/* $(CACHE_DIR)/opengamepadui/usr
@# Copy powerstation into the extension
cd $(CACHE_DIR) && tar xvfz powerstation.tar.gz
cp -r $(CACHE_DIR)/powerstation/usr/* $(CACHE_DIR)/opengamepadui/usr
@# Copy inputplumber into the extension
cd $(CACHE_DIR) && tar xvfz inputplumber.tar.gz
cp -r $(CACHE_DIR)/inputplumber/usr/* $(CACHE_DIR)/opengamepadui/usr
@# Install libserialport for inputplumber in the extension for libiio compatibility in SteamOS
cp -r $(CACHE_DIR)/libserialport/usr/lib/libserialport* $(CACHE_DIR)/opengamepadui/usr/lib
@# Install libiio for inputplumber in the extension for SteamOS compatibility
cp -r $(CACHE_DIR)/libiio/usr/lib/libiio* $(CACHE_DIR)/opengamepadui/usr/lib
@# Build the extension archive
cd $(CACHE_DIR) && mksquashfs opengamepadui opengamepadui.raw
rm -rf $(CACHE_DIR)/opengamepadui $(CACHE_DIR)/gamescope-session-opengamepadui-main $(CACHE_DIR)/gamescope-session-main
mv $(CACHE_DIR)/opengamepadui.raw $@
$(CACHE_DIR)/gamescope-session.tar.gz:
wget -O $@ https://github.com/ChimeraOS/gamescope-session/archive/refs/heads/main.tar.gz
$(CACHE_DIR)/gamescope-session-opengamepadui.tar.gz:
wget -O $@ https://github.com/ShadowBlip/gamescope-session-opengamepadui/archive/refs/heads/main.tar.gz
$(CACHE_DIR)/powerstation.tar.gz:
export PS_VERSION=$$(curl -s https://api.github.com/repos/ShadowBlip/PowerStation/releases/latest | jq -r '.name') && \
wget -O $@ https://github.com/ShadowBlip/PowerStation/releases/download/$${PS_VERSION}/powerstation.tar.gz
$(CACHE_DIR)/inputplumber.tar.gz: $(CACHE_DIR)/libiio $(CACHE_DIR)/libserialport
export IP_VERSION=$$(curl -s https://api.github.com/repos/ShadowBlip/InputPlumber/releases/latest | jq -r '.name') && \
wget -O $@ https://github.com/ShadowBlip/InputPlumber/releases/download/$${IP_VERSION}/inputplumber.tar.gz
LIBIIO_URL ?= https://mirror.rackspace.com/archlinux/extra/os/x86_64/libiio-0.25-3-x86_64.pkg.tar.zst
$(CACHE_DIR)/libiio:
rm -rf $(CACHE_DIR)/libiio*
wget $(LIBIIO_URL) \
-O $(CACHE_DIR)/libiio.tar.zst
zstd -d $(CACHE_DIR)/libiio.tar.zst
mkdir -p $(CACHE_DIR)/libiio
tar xvf $(CACHE_DIR)/libiio.tar -C $(CACHE_DIR)/libiio
LIBSERIALPORT_URL ?= https://mirror.rackspace.com/archlinux/extra/os/x86_64/libserialport-0.1.1-5-x86_64.pkg.tar.zst
$(CACHE_DIR)/libserialport:
rm -rf $(CACHE_DIR)/libserialport*
wget $(LIBSERIALPORT_URL) \
-O $(CACHE_DIR)/libserialport.tar.zst
zstd -d $(CACHE_DIR)/libserialport.tar.zst
mkdir -p $(CACHE_DIR)/libserialport
tar xvf $(CACHE_DIR)/libserialport.tar -C $(CACHE_DIR)/libserialport
# Refer to .releaserc.yaml for release configuration
.PHONY: release
release: ## Publish a release with semantic release
npx semantic-release
# E.g. make in-docker TARGET=build
.PHONY: in-docker
in-docker:
@# Build addons in a seperate container for glibc compatibility
docker run --rm \
-v $(PWD):/src \
--workdir /src \
-e PWD=/src \
--user $(shell id -u):$(shell id -g) \
$(ADDONS_IMAGE_NAME):$(ADDONS_IMAGE_TAG) \
make addons
@# Run the given make target inside Docker
docker run --rm \
-v $(PWD):/src \
--workdir /src \
-e HOME=/home/build \
-e PWD=/src \
--user $(shell id -u):$(shell id -g) \
$(IMAGE_NAME):$(IMAGE_TAG) \
make GODOT=/usr/sbin/godot $(TARGET)
.PHONY: docker-builder
docker-builder:
@# Pull any existing image to cache it
docker pull $(IMAGE_NAME):$(IMAGE_TAG) || echo "No remote image to pull"
@# Build the Docker image that will build the project
docker build -t $(IMAGE_NAME):$(IMAGE_TAG) -f docker/Dockerfile ./docker
.PHONY: docker-builder-push
docker-builder-push: docker-builder
docker push $(IMAGE_NAME):$(IMAGE_TAG)
.PHONY: docker-builder-addons
docker-builder-addons:
@# Pull any existing image to cache it
docker pull $(ADDONS_IMAGE_NAME):$(ADDONS_IMAGE_TAG) || echo "No remote image to pull"
@# Build the Docker image that will build the project
docker build -t $(ADDONS_IMAGE_NAME):$(ADDONS_IMAGE_TAG) -f docker/Dockerfile.addons ./docker
.PHONY: docker-builder-addons-push
docker-builder-addons-push: docker-builder-addons
docker push $(ADDONS_IMAGE_NAME):$(ADDONS_IMAGE_TAG)