-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild_tmux.sh
More file actions
executable file
·68 lines (57 loc) · 1.45 KB
/
build_tmux.sh
File metadata and controls
executable file
·68 lines (57 loc) · 1.45 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
#!/usr/bin/env bash
set -euo pipefail
if [[ -z "${PREFIX:-}" ]]; then
echo "Error: PREFIX must be set" >&2
exit 1
fi
if [[ -z "${TMUX_VERSION:-}" ]]; then
echo "Error: TMUX_VERSION must be set" >&2
exit 1
fi
mkdir -p "$PREFIX/src"
cd "$PREFIX/src"
if [[ "${TMUX_VERSION}" == "preview" ]]; then
git clone https://github.com/tmux/tmux.git
cd tmux
sh autogen.sh
else
wget "https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz"
tar xzf "tmux-${TMUX_VERSION}.tar.gz"
cd "tmux-${TMUX_VERSION}"
fi
IS_MACOS=false
if [[ "$(uname)" == "Darwin" ]]; then
IS_MACOS=true
fi
CONFIGURE_FLAGS=(
--prefix=${PREFIX}
--includedir="${PREFIX}/include"
--libdir="${PREFIX}/lib"
LIBEVENT_LIBS="-L${PREFIX}/lib -levent"
LIBNCURSES_CFLAGS="-I${PREFIX}/include/ncurses"
LIBNCURSES_LIBS="-L${PREFIX}/lib -lncurses"
LIBTINFO_CFLAGS="-I${PREFIX}/include/ncurses"
LIBTINFO_LIBS="-L${PREFIX}/lib -ltinfo"
CFLAGS="-I${PREFIX}/include"
LDFLAGS="-L${PREFIX}/lib"
CPPFLAGS="-I${PREFIX}/include"
)
if $IS_MACOS; then
CONFIGURE_FLAGS+=(
--enable-utf8proc
LIBUTF8PROC_CFLAGS="-I${PREFIX}/include"
LIBUTF8PROC_LIBS="${PREFIX}/lib/libutf8proc.a"
)
else
CONFIGURE_FLAGS+=(
--enable-static
)
fi
./configure "${CONFIGURE_FLAGS[@]}"
if $IS_MACOS; then
make -j$(sysctl -n hw.ncpu)
else
make -j$(nproc)
fi
make install
rm -rf "$PREFIX/src"