blob: 96526541a57837548a6f6426f43716361b573553 (
plain)
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
|
#!/bin/sh
# Start hybbxd only. Build and install with CMake (see README).
#
# Default install (source tree): ./bin/hybbx-start
# Prefix install: /usr/local/hybbx/hybbx-start (or $HOME/hybbx/…)
# Dev (no install): ./scripts/hybbx.sh
#
# Detached: hybbx-start --screen | --tmux [--attach]
set -e
self="${0#./}"
case "$self" in
/*) script_path="$self" ;;
*) script_path="$(pwd)/$self" ;;
esac
script_dir="$(cd "$(dirname "$script_path")" && pwd)"
script_name="$(basename "$script_path")"
# Installed layout: <tree>/hybbx-start + <tree>/hybbxd (./bin or <prefix>/hybbx)
if [ "$script_name" = "hybbx-start" ] && [ -x "$script_dir/hybbxd" ]; then
prefix="$script_dir"
config="${HYBBX_CONFIG:-$prefix/hybbx.ini}"
binary="$script_dir/hybbxd"
export HYBBX_ROOT="${HYBBX_ROOT:-$prefix}"
cd "$prefix"
if [ ! -f "$config" ]; then
echo "Config not found: $config" >&2
exit 1
fi
if [ "$#" -eq 0 ]; then
exec "$binary" -c "$config"
fi
exec "$binary" -c "$config" "$@"
fi
# Explicit or known install roots
root="$(cd "$script_dir/.." && pwd)"
if [ -n "$HYBBX_ROOT" ]; then
prefix="$HYBBX_ROOT"
elif [ -x "$root/bin/hybbxd" ]; then
prefix="$root/bin"
elif [ -x "/usr/local/hybbx/hybbxd" ]; then
prefix="/usr/local/hybbx"
elif [ -n "$HOME" ] && [ -x "$HOME/hybbx/hybbxd" ]; then
prefix="$HOME/hybbx"
else
prefix=""
fi
if [ -n "$prefix" ]; then
config="${HYBBX_CONFIG:-$prefix/hybbx.ini}"
binary="$prefix/hybbxd"
if [ -x "$binary" ] && [ -f "$config" ]; then
export HYBBX_ROOT="${HYBBX_ROOT:-$prefix}"
cd "$prefix"
if [ "$#" -eq 0 ]; then
exec "$binary" -c "$config"
fi
exec "$binary" -c "$config" "$@"
fi
fi
# Development tree (repo checkout, no cmake --install yet)
config="${HYBBX_CONFIG:-$root/local/hybbx.ini}"
build="$root/build/src/hybbxd"
if [ -f "$config" ] && [ -x "$build" ]; then
export HYBBX_ROOT="${HYBBX_ROOT:-$root}"
cd "$root"
if [ "$#" -eq 0 ]; then
exec "$build" -c "$config"
fi
exec "$build" -c "$config" "$@"
fi
echo "HyBBX not found." >&2
echo "Build and install (default → ./bin):" >&2
echo " cmake -B build -DCMAKE_BUILD_TYPE=Release" >&2
echo " cmake --build build" >&2
echo " cmake --install build" >&2
echo " ./bin/hybbx-start" >&2
echo "System prefix:" >&2
echo " cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local" >&2
echo " cmake --build build && sudo cmake --install build" >&2
echo " /usr/local/hybbx/hybbx-start" >&2
exit 1
|