-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
72 lines (64 loc) · 2.58 KB
/
Copy pathinstall.sh
File metadata and controls
72 lines (64 loc) · 2.58 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
#!/bin/sh
set -eu
if [ "$(id -u)" -ne 0 ]; then
echo "install.sh must run as root" >&2
exit 1
fi
ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
BUILD_DIR="${BUILD_DIR:-$ROOT_DIR/build}"
if command -v cmake >/dev/null 2>&1; then
cmake -S "$ROOT_DIR" -B "$BUILD_DIR"
cmake --build "$BUILD_DIR"
else
CXX=${CXX:-c++}
CC=${CC:-cc}
if ! command -v "$CXX" >/dev/null 2>&1; then
echo "install.sh needs cmake or a C++ compiler" >&2
exit 1
fi
if ! command -v wayland-scanner >/dev/null 2>&1; then
echo "install.sh needs wayland-scanner for zero-shell-wayland" >&2
echo "Install wayland-protocols and libwayland-dev, or use cmake." >&2
exit 1
fi
XDG_SHELL_XML=${XDG_SHELL_XML:-}
if [ -z "$XDG_SHELL_XML" ]; then
for candidate in \
/usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml \
/usr/share/wayland/xdg-shell.xml; do
if [ -r "$candidate" ]; then
XDG_SHELL_XML=$candidate
break
fi
done
fi
if [ -z "$XDG_SHELL_XML" ]; then
echo "install.sh needs xdg-shell.xml for zero-shell-wayland" >&2
echo "Install wayland-protocols." >&2
exit 1
fi
mkdir -p "$BUILD_DIR"
wayland-scanner client-header "$XDG_SHELL_XML" "$BUILD_DIR/xdg-shell-client-protocol.h"
wayland-scanner private-code "$XDG_SHELL_XML" "$BUILD_DIR/xdg-shell-protocol.c"
"$CC" -c "$BUILD_DIR/xdg-shell-protocol.c" \
$(pkg-config --cflags wayland-client 2>/dev/null || true) \
-o "$BUILD_DIR/xdg-shell-protocol.o"
"$CXX" -std=c++17 -Wall -Wextra -Wpedantic \
-I"$ROOT_DIR/main/include" \
-I"$BUILD_DIR" \
"$ROOT_DIR/main/src/app_catalog.cpp" \
"$ROOT_DIR/main/src/image.cpp" \
"$ROOT_DIR/main/src/status.cpp" \
"$ROOT_DIR/main/src/zero_shell_wayland.cpp" \
"$BUILD_DIR/xdg-shell-protocol.o" \
$(pkg-config --cflags --libs wayland-client libpng 2>/dev/null || printf '%s' '-lwayland-client -lpng -lm') \
-o "$BUILD_DIR/zero-shell-wayland"
fi
install -d -m 0755 /opt/cardputer-zero-shell/bin
install -d -m 0755 /usr/share/APPLaunch/applications
install -d -m 0755 /usr/share/APPLaunch/share/images
install -m 0755 "$BUILD_DIR/zero-shell-wayland" /opt/cardputer-zero-shell/bin/.zero-shell-wayland.new
mv /opt/cardputer-zero-shell/bin/.zero-shell-wayland.new /opt/cardputer-zero-shell/bin/zero-shell-wayland
echo "cardputer-zero-shell installed:"
echo " /opt/cardputer-zero-shell/bin/zero-shell-wayland"
echo " /usr/share/APPLaunch/applications"