Skip to content

Instantly share code, notes, and snippets.

@mbreese
Last active January 23, 2024 10:11
Show Gist options
  • Save mbreese/b0630195e57874c87ef3611d059d1bc2 to your computer and use it in GitHub Desktop.
Save mbreese/b0630195e57874c87ef3611d059d1bc2 to your computer and use it in GitHub Desktop.
HOWTO build a statically linked tmux in one script (downloads and builds dependencies from source)
#!/bin/bash
TARGETDIR=$1
if [ "$TARGETDIR" = "" ]; then
TARGETDIR=$(python -c 'import os; print os.path.realpath("local")')
fi
mkdir -p $TARGETDIR
libevent() {
curl -LO https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
tar -zxvf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
./configure --prefix=$TARGETDIR && make && make install
cd ..
}
ncurses() {
curl -LO https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.0.tar.gz
tar zxvf ncurses-6.0.tar.gz
cd ncurses-6.0
./configure --prefix $TARGETDIR \
--with-default-terminfo-dir=/usr/share/terminfo \
--with-terminfo-dirs="/etc/terminfo:/lib/terminfo:/usr/share/terminfo" \
--enable-pc-files \
--with-pkg-config-libdir=$HOME/local/lib/pkgconfig \
&& make && make install
cd ..
}
tmux() {
curl -LO https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz
tar zxvf tmux-2.3.tar.gz
cd tmux-2.3
PKG_CONFIG_PATH=$TARGETDIR/lib/pkgconfig ./configure --enable-static --prefix=$TARGETDIR && make && make install
cd ..
cp $TARGETDIR/bin/tmux .
}
libevent
ncurses
tmux
@makslevental
Copy link

i had a libevent compile error (something having to do with dereffing incomplete types) on SUSE 15.1. changing to libevent 2.1.12 solved it

@zenofile
Copy link

zenofile commented Jun 2, 2021

An updated version for tmux 3.2 using musl libc: https://gist.github.com/zenofile/d2acef1a0423e5081e74162cd5a0ae2d.

@clcollins
Copy link

This is excellent, and has saved me much trouble. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment