-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_tmux.sh
63 lines (49 loc) · 1.83 KB
/
install_tmux.sh
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
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# The latest version of tmux will be installed in $HOME/local/bin.
# It is assumed that standard compilation tools (a C/C++ compiler with autoconf) are available. If git is installed it will be used instead of curl.
# Modified from https://gist.github.com/ryin/3106801 and https://gist.github.com/ryin/3106801 to use the latest version from github.
# exit on error
set -e
get_from_github () {
if type "git" &> /dev/null ; then
git clone https://github.com/$1/$1
else
wget https://github.com/$1/$1/archive/master.tar.gz -O $1.tar.gz
tar xvzf $1.tar.gz
fi
}
# create our directories
mkdir -p $HOME/local $HOME/tmux_tmp
cd $HOME/tmux_tmp
# download source files for tmux, libevent, and ncurses
get_from_github tmux
get_from_github libevent
wget ftp://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz -O ncurses.tar.gz
tar xvzf ncurses.tar.gz
#########################
# configure and compile #
#########################
# libevent
cd $HOME/tmux_tmp/libevent*
./autogen.sh
./configure --prefix=$HOME/local --disable-shared
make -j2
make install
# ncurses
cd $HOME/tmux_tmp/ncurses-*
./configure --prefix=$HOME/local --without-debug --without-shared --without-normal --without-ada
make -j2
make install
# tmux
cd $HOME/tmux_tmp/tmux*
./autogen.sh
./configure CFLAGS="-I$HOME/local/include -I$HOME/local/include/ncurses" LDFLAGS="-L$HOME/local/lib -L$HOME/local/include/ncurses -L$HOME/local/include"
CPPFLAGS="-I$HOME/local/include -I$HOME/local/include/ncurses" LDFLAGS="-static -L$HOME/local/include -L$HOME/local/include/ncurses -L$HOME/local/lib"
make -j2
cp tmux $HOME/local/bin
# cleanup
rm -rf $HOME/tmux_tmp
echo "$HOME/local/bin/tmux is now available. You can optionally add $HOME/local/bin to your PATH."
# e.g. to export path
# export PATH=$PATH:/path/to/dir1