Created
March 5, 2014 17:20
-
-
Save alexnj/9371792 to your computer and use it in GitHub Desktop.
Compile tmux from source with /opt prefix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# tmux will be installed in /opt/local/bin. | |
# It's assumed that wget and a C/C++ compiler are installed. | |
# exit on error | |
set -e | |
TMUX_VERSION=1.9 | |
# create our directories | |
mkdir -p /opt/local /opt/tmux_tmp | |
cd /opt/tmux_tmp | |
# download source files for tmux, libevent, and ncurses | |
wget -O tmux-${TMUX_VERSION}.tar.gz http://sourceforge.net/projects/tmux/files/tmux/tmux-${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz/download | |
wget https://github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz | |
wget ftp://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz | |
# extract files, configure, and compile | |
############ | |
# libevent # | |
############ | |
tar xvzf libevent-2.0.19-stable.tar.gz | |
cd libevent-2.0.19-stable | |
./configure --prefix=/opt/local --disable-shared | |
make | |
make install | |
cd .. | |
############ | |
# ncurses # | |
############ | |
tar xvzf ncurses-5.9.tar.gz | |
cd ncurses-5.9 | |
./configure --prefix=/opt/local | |
make | |
make install | |
cd .. | |
############ | |
# tmux # | |
############ | |
tar xvzf tmux-${TMUX_VERSION}.tar.gz | |
cd tmux-${TMUX_VERSION} | |
./configure CFLAGS="-I/opt/local/include -I/opt/local/include/ncurses" LDFLAGS="-L/opt/local/lib -L/opt/local/include/ncurses -L/opt/local/include" | |
CPPFLAGS="-I/opt/local/include -I/opt/local/include/ncurses" LDFLAGS="-static -L/opt/local/include -L/opt/local/include/ncurses -L/opt/local/lib" make | |
cp tmux /opt/local/bin | |
cd .. | |
# cleanup | |
rm -rf /opt/tmux_tmp | |
echo "/opt/local/bin/tmux is now available. You can optionally add /opt/local/bin to your PATH." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment