-
Notifications
You must be signed in to change notification settings - Fork 0
/
s_base_zig
executable file
·105 lines (75 loc) · 3.11 KB
/
s_base_zig
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
#!/usr/bin/env bash
# Bin is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Bin is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Bin. If not, see <https://www.gnu.org/licenses/>.
# Debug Options
set -euo pipefail
DEPS=(bash)
s_checkdeps "${DEPS[@]}"
LOCAL_BIN="$HOME/.local/bin"
LOCAL_DIR="$HOME/.local"
BUILDS_HOME="$HOME/Builds"
[[ ! -d $LOCAL_BIN ]] && mkdir -p "$LOCAL_DIR"
[[ ! -d $BUILDS_HOME ]] && mkdir -p "$BUILDS_HOME"
cd "$BUILDS_HOME"
echo -e "\n- zig\n"
# wget -O- -q https://ziglang.org/download/index.json | jq '."0.11.0"."x86_64-linux".tarball'
ZIG_VERSION=0.13.0
ZIG_TARFILE="zig-linux-x86_64-$ZIG_VERSION.tar.xz"
ZIG_LOCATION=$LOCAL_DIR/$(basename $ZIG_TARFILE '.tar.xz')
[[ ! -f $BUILDS_HOME/$ZIG_TARFILE ]] && wget -c "https://ziglang.org/download/$ZIG_VERSION/$ZIG_TARFILE" -P "$BUILDS_HOME"
if [[ ! -f $LOCAL_BIN/zig ]] && [[ -f $ZIG_TARFILE ]]; then
tar -xf "$ZIG_TARFILE" -C "$HOME/.local"
ln -sf "$ZIG_LOCATION/zig" "$LOCAL_BIN/zig"
"$LOCAL_BIN/zig" version
fi
echo -e "\n- zls\n"
ZLS_LOCATION="$HOME/Builds/zls"
[[ ! -d $ZLS_LOCATION/.git ]] && git clone https://github.com/zigtools/zls --single-branch --branch "$ZIG_VERSION" "$ZLS_LOCATION"
if [[ -d $ZLS_LOCATION/.git ]]; then
git -C "$ZLS_LOCATION" pull
cd "$ZLS_LOCATION" && zig build -Doptimize=ReleaseSafe -Ddata_version="$ZIG_VERSION"
[[ ! -x $LOCAL_BIN/zls ]] && ln -s "$ZLS_LOCATION/zig-out/bin/zls" "$LOCAL_BIN/zls"
"$LOCAL_BIN/zls" --version
fi
exit
echo -e "\n- zigmod\n"
ZIGMOD_NAME=zigmod
ZIGMOD_LOCATION="$HOME/Builds/${ZIGMOD_NAME}"
[[ ! -d $ZIGMOD_LOCATION/.git ]] && git clone https://github.com/nektro/zigmod --single-branch "$ZIGMOD_LOCATION"
if [[ -d $ZIGMOD_LOCATION/.git ]]; then
git -C "$ZIGMOD_LOCATION" pull
cd "$ZIGMOD_LOCATION" && zig build -j1
[[ ! -x $LOCAL_BIN/${ZIGMOD_NAME} ]] && ln -s "$ZIGMOD_LOCATION/zig-out/bin/${ZIGMOD_NAME}" "$LOCAL_BIN/${ZIGMOD_NAME}"
"$LOCAL_BIN/${ZIGMOD_NAME}" version
fi
echo -e "\n- riverwm\n"
RIVER_NAME=river
RIVER_LOCATION="$HOME/Builds/${RIVER_NAME}"
if [[ ! -d $RIVER_LOCATION/.git ]]; then
git clone https://github.com/riverwm/river --depth=1 --recurse-submodules --single-branch "$RIVER_LOCATION"
fi
if [[ -d $RIVER_LOCATION/.git ]]; then
git submodule update --init
git -C "$RIVER_LOCATION" pull
cd "$RIVER_LOCATION" && zig build -Doptimize=ReleaseSafe -Dxwayland --prefix "$LOCAL_DIR" install
"$LOCAL_BIN/${RIVER_NAME}" version
fi
ZIG_LOCATION="$HOME/Builds/zig"
[[ ! -d $ZIG_LOCATION/.git ]] && git clone https://github.com/ziglang/zig "$ZIG_LOCATION"
if [[ -d $ZIG_LOCATION/.git ]]; then
cd "$ZIG_LOCATION"
[[ ! -d ./build ]] && mkdir build
cd build
cmake ..
make install
fi