#!/usr/bin/env bash
set -e
tmux_url="https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz"
tmux_dname="tmux.tar.gz"
libevent_url="$(curl -s "https://api.github.com/repos/libevent/libevent/releases/latest" | jq -r '.tarball_url')"
libevent_dname="libevent.tar.gz"
echo "Download libevent"
curl -s -L "$libevent_url" -o $libevent_dname
echo "Decompress libevent"
tar xzf $libevent_dname
libevent_dir=$(ls -d libevent*/)
echo "Install libevent"
pushd $libevent_dir
./autogen.sh
./configure --prefix=/home/reorx/.local
make -j8
make install
popd
echo "Download tmux"
curl -s -L "$tmux_url" -o $tmux_dname
echo "Decompress tmux"
tar xzf $tmux_dname$
tmux_dir=$(ls -d tmux*/)
echo "Install tmux"
pushd $tmux_dir
#LDFLAGS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib" ./configure --prefix=/usr/local
export LD_LIBRARY_PATH=/home/reorx/.local
./configure --prefix=/home/reorx/.local
make -j8
make install
popd
echo "cmd:
# start
tmux -L user -f .user.tmux.conf new -s user
# attach
tmux -L user f .user.tmux.cof attach -t user
"