forked from ilysenko/codex-desktop-linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (124 loc) · 6.07 KB
/
Copy pathMakefile
File metadata and controls
142 lines (124 loc) · 6.07 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
SHELL := /bin/bash
.SHELLFLAGS := -eu -o pipefail -c
APP_DIR := $(CURDIR)/codex-app
PACKAGE_NAME := codex-desktop
DEB_GLOB := $(CURDIR)/dist/$(PACKAGE_NAME)_*.deb
RPM_GLOB := $(CURDIR)/dist/$(PACKAGE_NAME)-*.rpm
PACMAN_GLOB := $(CURDIR)/dist/$(PACKAGE_NAME)-[0-9]*.pkg.tar.*
.DEFAULT_GOAL := help
.PHONY: help check test build-updater build-app run-app deb rpm pacman package install service-enable service-status clean-dist clean-state
help:
@printf '\nCodex Desktop Linux Make Targets\n\n'
@printf ' %-18s %s\n' "make check" "Run cargo check for codex-update-manager"
@printf ' %-18s %s\n' "make test" "Run updater test suite"
@printf ' %-18s %s\n' "make build-updater" "Build codex-update-manager in release mode"
@printf ' %-18s %s\n' "make build-app" "Run install.sh and regenerate codex-app/"
@printf ' %-18s %s\n' "make run-app" "Launch the local generated Electron app from codex-app/"
@printf ' %-18s %s\n' "make deb" "Build the Debian package into dist/"
@printf ' %-18s %s\n' "make rpm" "Build the RPM package into dist/ (Fedora/openSUSE)"
@printf ' %-18s %s\n' "make pacman" "Build the pacman package into dist/ (Arch)"
@printf ' %-18s %s\n' "make package" "Build native package (auto-detects deb, rpm, or pacman)"
@printf ' %-18s %s\n' "make install" "Install the latest generated native package"
@printf ' %-18s %s\n' "make service-enable" "Enable and start codex-update-manager.service for the current user"
@printf ' %-18s %s\n' "make service-status" "Show codex-update-manager.service status for the current user"
@printf ' %-18s %s\n' "make clean-dist" "Remove generated dist/ artifacts"
@printf ' %-18s %s\n' "make clean-state" "Remove updater runtime state from XDG directories"
@printf '\nVariables:\n\n'
@printf ' %-18s %s\n' "DMG=/path/file.dmg" "Override the DMG passed to install.sh (default: let install.sh reuse/download Codex.dmg)"
@printf ' %-18s %s\n' "PACKAGE_VERSION=..." "Override the package version for make deb / make rpm / make pacman"
@printf ' %-18s %s\n' "DEB=/path/file.deb" "Override the .deb used by make install"
@printf ' %-18s %s\n' "RPM=/path/file.rpm" "Override the .rpm used by make install"
@printf ' %-18s %s\n' "PKG=/path/file.pkg.tar.zst" "Override the pacman package used by make install"
@printf '\nExamples:\n\n'
@printf ' %s\n' "make build-app DMG=/tmp/Codex.dmg"
@printf ' %s\n' "make run-app"
@printf ' %s\n' "make deb PACKAGE_VERSION=2026.03.24.220723+88f07cd3"
@printf ' %s\n' "make rpm PACKAGE_VERSION=2026.03.24.220723+88f07cd3"
@printf ' %s\n' "make pacman PACKAGE_VERSION=2026.03.24.220723+88f07cd3"
@printf ' %s\n' "make install"
@printf ' %s\n\n' "make service-enable"
check:
@echo "[make] Running cargo check"
cargo check -p codex-update-manager
test:
@echo "[make] Running cargo test"
cargo test -p codex-update-manager
build-updater:
@echo "[make] Building codex-update-manager (release)"
cargo build --release -p codex-update-manager
build-app:
@echo "[make] Regenerating codex-app from DMG"
./install.sh "$(DMG)"
run-app:
@echo "[make] Launching local Electron app"
"$(APP_DIR)/start.sh"
deb: build-updater
@echo "[make] Building Debian package"
PACKAGE_VERSION="$(or $(PACKAGE_VERSION),)" ./scripts/build-deb.sh
rpm: build-updater
@echo "[make] Building RPM package"
PACKAGE_VERSION="$(or $(PACKAGE_VERSION),)" ./scripts/build-rpm.sh
pacman: build-updater
@echo "[make] Building pacman package"
PACKAGE_VERSION="$(or $(PACKAGE_VERSION),)" ./scripts/build-pacman.sh
package: build-updater
@echo "[make] Building native package (auto-detecting distro)"
@if command -v makepkg >/dev/null 2>&1 && ! command -v dpkg-deb >/dev/null 2>&1; then \
PACKAGE_VERSION="$(or $(PACKAGE_VERSION),)" ./scripts/build-pacman.sh; \
elif command -v dpkg-deb >/dev/null 2>&1; then \
PACKAGE_VERSION="$(or $(PACKAGE_VERSION),)" ./scripts/build-deb.sh; \
elif command -v rpmbuild >/dev/null 2>&1; then \
PACKAGE_VERSION="$(or $(PACKAGE_VERSION),)" ./scripts/build-rpm.sh; \
else \
echo "[make] No supported packaging tool found. Install dpkg-dev (Debian), rpm-build (Fedora), or pacman (Arch)." >&2; \
exit 1; \
fi
install:
@echo "[make] Installing latest native package"
@if command -v pacman >/dev/null 2>&1 && ! command -v dpkg >/dev/null 2>&1; then \
pkg="$${PKG:-$$(ls -1 $(PACMAN_GLOB) 2>/dev/null | sort -V | tail -n 1)}"; \
if [ -z "$$pkg" ]; then \
echo "[make] No pacman package found. Run 'make pacman' first." >&2; exit 1; \
fi; \
echo "[make] Installing $$pkg"; \
sudo pacman -U --noconfirm "$$pkg"; \
elif command -v dpkg >/dev/null 2>&1; then \
deb="$${DEB:-$$(ls -1 $(DEB_GLOB) 2>/dev/null | sort -V | tail -n 1)}"; \
if [ -z "$$deb" ]; then \
echo "[make] No Debian package found. Run 'make deb' first." >&2; exit 1; \
fi; \
echo "[make] Installing $$deb"; \
sudo dpkg -i "$$deb"; \
elif command -v zypper >/dev/null 2>&1; then \
rpm="$${RPM:-$$(ls -1 $(RPM_GLOB) 2>/dev/null | sort -V | tail -n 1)}"; \
if [ -z "$$rpm" ]; then \
echo "[make] No RPM package found. Run 'make rpm' first." >&2; exit 1; \
fi; \
echo "[make] Installing $$rpm"; \
sudo zypper --non-interactive --no-gpg-checks install -y "$$rpm"; \
elif command -v rpm >/dev/null 2>&1; then \
rpm="$${RPM:-$$(ls -1 $(RPM_GLOB) 2>/dev/null | sort -V | tail -n 1)}"; \
if [ -z "$$rpm" ]; then \
echo "[make] No RPM package found. Run 'make rpm' first." >&2; exit 1; \
fi; \
echo "[make] Installing $$rpm"; \
sudo rpm -Uvh "$$rpm"; \
else \
echo "[make] No supported package manager found (dpkg, rpm, zypper, or pacman)." >&2; exit 1; \
fi
service-enable:
@echo "[make] Enabling and starting codex-update-manager.service"
systemctl --user daemon-reload
systemctl --user enable --now codex-update-manager.service
service-status:
@echo "[make] Showing codex-update-manager.service status"
systemctl --user status codex-update-manager.service --no-pager
clean-dist:
@echo "[make] Removing dist/"
rm -rf "$(CURDIR)/dist"
clean-state:
@echo "[make] Removing updater runtime state"
rm -rf \
"$$HOME/.config/codex-update-manager" \
"$$HOME/.local/state/codex-update-manager" \
"$$HOME/.cache/codex-update-manager"