-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy pathJustfile
More file actions
182 lines (155 loc) · 4.99 KB
/
Copy pathJustfile
File metadata and controls
182 lines (155 loc) · 4.99 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
set shell := ["bash", "-euo", "pipefail", "-c"]
project_root := justfile_directory()
build_dir := project_root / "build"
arch_dir := build_dir / "arch-package"
package_dir := build_dir / "packages"
# Show the available developer commands.
default:
@just --list
# Compile Projecteur.
build: _require-arch deps
cmake -S "{{ project_root }}" -B "{{ build_dir }}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DPACKAGE_TARGETS=OFF
cmake --build "{{ build_dir }}" --parallel
# Build an Arch Linux package from the current working tree.
package: _require-arch deps
#!/usr/bin/env bash
set -euo pipefail
if (( EUID == 0 )); then
echo "error: makepkg must be run as a regular user, not root." >&2
exit 1
fi
root="{{ project_root }}"
stage="{{ arch_dir }}"
packages="{{ package_dir }}"
mkdir -p "$stage" "$packages"
install -m 0644 "$root/packaging/arch/PKGBUILD" "$stage/PKGBUILD"
cmake -S "$root" -B "$stage/version-build" -DPACKAGE_TARGETS=OFF
cp "$stage/version-build/version-string.archlinux" "$stage/projecteur-pkgver"
git -C "$root" ls-files --cached --others --exclude-standard -z \
| while IFS= read -r -d '' path; do
if [[ -e "$root/$path" || -L "$root/$path" ]]; then
printf '%s\0' "$path"
fi
done \
| tar -C "$root" --null --no-recursion --files-from=- \
--transform='s,^,projecteur-local/,' \
-czf "$stage/projecteur-local.tar.gz"
(
cd "$stage"
updpkgsums
BUILDDIR="$stage/work" \
PKGDEST="$packages" \
SRCDEST="$stage/sources" \
makepkg --cleanbuild --clean --force --noconfirm --syncdeps
)
echo
echo "Package created:"
(
cd "$stage"
PKGDEST="$packages" makepkg --packagelist
)
# Build, package, and install Projecteur through pacman.
install: _stop-projecteur build package
#!/usr/bin/env bash
set -euo pipefail
stage="{{ arch_dir }}"
packages="{{ package_dir }}"
package_file="$(
cd "$stage"
PKGDEST="$packages" makepkg --packagelist | head -n 1
)"
if [[ ! -f "$package_file" ]]; then
echo "error: expected package was not created: $package_file" >&2
exit 1
fi
if (( EUID != 0 )); then
if ! command -v sudo >/dev/null 2>&1; then
echo "error: installing the package requires root or sudo." >&2
exit 1
fi
# Authenticate before installing the package.
sudo -v
fi
if (( EUID == 0 )); then
pacman -U --noconfirm "$package_file"
else
sudo pacman -U --noconfirm "$package_file"
fi
systemctl --user restart plasma-plasmashell.service
dbus-send --session --print-reply=literal \
--dest=org.freedesktop.DBus \
/org/freedesktop/DBus \
org.freedesktop.DBus.StartServiceByName \
string:org.projecteur.Projecteur \
uint32:0 >/dev/null
_stop-projecteur:
#!/usr/bin/env bash
if [[ -x /usr/bin/projecteur ]]; then
/usr/bin/projecteur --command quit >/dev/null 2>&1 || true
fi
# Install the compiler and Projecteur build dependencies.
deps: _require-arch
#!/usr/bin/env bash
set -euo pipefail
dependencies=(
base-devel
cmake
extra-cmake-modules
gettext
git
kconfig
kconfigwidgets
kcoreaddons
kdbusaddons
kglobalaccel
ki18n
kpipewire
knotifications
kwidgetsaddons
kwindowsystem
kxmlgui
layer-shell-qt
libplasma
libglvnd
pacman-contrib
qt6-base
qt6-declarative
qt6-shadertools
qt6-wayland
)
mapfile -t missing < <(pacman -T "${dependencies[@]}" || true)
if (( ${#missing[@]} == 0 )); then
echo "Arch build dependencies are already installed."
exit 0
fi
echo "Installing missing Arch build dependencies: ${missing[*]}"
if (( EUID == 0 )); then
pacman -S --needed --noconfirm "${missing[@]}"
elif command -v sudo >/dev/null 2>&1; then
sudo pacman -S --needed --noconfirm "${missing[@]}"
else
echo "error: installing build dependencies requires root or sudo." >&2
exit 1
fi
_require-arch:
#!/usr/bin/env bash
set -euo pipefail
if [[ ! -r /etc/os-release ]]; then
echo "error: /etc/os-release is unavailable; this workflow requires Arch Linux." >&2
exit 1
fi
# shellcheck disable=SC1091
source /etc/os-release
distro_ids=" ${ID:-} ${ID_LIKE:-} "
if [[ "$distro_ids" != *" arch "* ]]; then
echo "error: this workflow requires Arch Linux or an Arch-based distribution." >&2
echo " detected: ${PRETTY_NAME:-unknown Linux distribution}" >&2
exit 1
fi
if ! command -v pacman >/dev/null 2>&1; then
echo "error: pacman was not found; this does not look like a usable Arch system." >&2
exit 1
fi