Merge branch 'add-datefmt'
[sunny256-utils.git] / tmux_local_install.sh
blob5c54430169418c721f2bf995939fcfe4b63f8385
1 #!/usr/bin/env bash
3 # Script for installing tmux on systems where you don't have root access.
4 # tmux will be installed in $HOME/local/bin.
5 # It's assumed that wget and a C/C++ compiler are installed.
7 # File ID: 65a017ec-321f-11e4-aebb-0026b9848456
9 # exit on error
10 set -e
12 # create our directories
13 mkdir -p $HOME/local $HOME/tmux_tmp
14 cd $HOME/tmux_tmp
16 # download source files for tmux, libevent, and ncurses
17 curl -L https://github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz >libevent-2.0.19-stable.tar.gz
18 wget ftp://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz
20 # extract files, configure, and compile
22 ############
23 # libevent #
24 ############
25 tar xvzf libevent-2.0.19-stable.tar.gz
26 cd libevent-2.0.19-stable
27 ./configure --prefix=$HOME/local --disable-shared
28 make
29 make install
30 cd ..
32 ############
33 # ncurses #
34 ############
35 tar xvzf ncurses-5.9.tar.gz
36 cd ncurses-5.9
37 ./configure --prefix=$HOME/local
38 make
39 make install
40 cd ..
42 ############
43 # tmux #
44 ############
45 git clone git://git.code.sf.net/p/tmux/tmux-code tmux
46 cd tmux
47 ./autogen.sh
48 ./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"
49 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
50 cp tmux $HOME/local/bin
51 cd ..
53 # cleanup
54 rm -rf $HOME/tmux_tmp
56 echo "$HOME/local/bin/tmux is now available. You can optionally add $HOME/local/bin to your PATH."