#!/bin/bash | |
TMUX_VERSION=2.3 | |
NCURSES_VERSION=6.0 | |
LIBEVENT_VERSION=2.0.22 | |
BASEDIR=${HOME}/work/tmux-static | |
TMUXTARGET=${BASEDIR}/local | |
mkdir -p $TMUXTARGET | |
cd $BASEDIR | |
export PKG_CONFIG_PATH="${TMUXTARGET}/lib/pkgconfig" | |
if [ ! -f libevent-${LIBEVENT_VERSION}-stable.tar.gz ]; then | |
wget -O libevent-${LIBEVENT_VERSION}-stable.tar.gz https://github.com/libevent/libevent/releases/download/release-${LIBEVENT_VERSION}-stable/libevent-${LIBEVENT_VERSION}-stable.tar.gz | |
fi | |
if [ ! -f ncurses-${NCURSES_VERSION}.tar.gz ]; then | |
wget -O ncurses-${NCURSES_VERSION}.tar.gz http://ftp.gnu.org/gnu/ncurses/ncurses-${NCURSES_VERSION}.tar.gz | |
fi | |
if [ ! -f tmux-${TMUX_VERSION}.tar.gz ]; then | |
wget -O tmux-${TMUX_VERSION}.tar.gz https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz | |
fi | |
if [ ! -d libevent-${LIBEVENT_VERSION}-stable ]; then | |
cd ${BASEDIR} | |
tar -xzf libevent-${LIBEVENT_VERSION}-stable.tar.gz | |
cd ${BASEDIR}/libevent-${LIBEVENT_VERSION}-stable | |
./configure --prefix=$TMUXTARGET --disable-shared | |
make && make install | |
fi | |
if [ ! -d ncurses-${NCURSES_VERSION} ]; then | |
cd ${BASEDIR} | |
tar -xzf ncurses-${NCURSES_VERSION}.tar.gz | |
cd ${BASEDIR}/ncurses-${NCURSES_VERSION} | |
./configure --prefix=$TMUXTARGET --with-default-terminfo-dir=/usr/share/terminfo --with-terminfo-dirs="/etc/terminfo:/lib/terminfo:/usr/share/terminfo" | |
make && make install | |
fi | |
if [ ! -d tmux-${TMUX_VERSION} ]; then | |
cd ${BASEDIR} | |
tar -xzf tmux-${TMUX_VERSION}.tar.gz | |
cd tmux-${TMUX_VERSION} | |
./configure --prefix=$TMUXTARGET --enable-static CFLAGS="-I${TMUXTARGET}/include -I${TMUXTARGET}/include/ncurses" LDFLAGS="-L${TMUXTARGET}/lib -L${TMUXTARGET}/include -L${TMUXTARGET}/include/ncurses" LIBEVENT_CFLAGS="-I${TMUXTARGET}/include" LIBEVENT_LIBS="-L${TMUXTARGET}/lib -levent" LIBNCURSES_CFLAGS="-I${TMUXTARGET}/include" LIBNCURSES_LIBS="-L${TMUXTARGET}/lib -lncurses" | |
make && make install | |
fi | |
if [ -f $TMUXTARGET/bin/tmux ]; then | |
$TMUXTARGET/bin/tmux -V | |
echo "`whoami`@`hostname -d`:${TMUXTARGET}/bin/tmux" | |
fi |
thanks, this was a quick hack and I wanted to change it to a script that has a few options (specify release or git head, override versions of ncurses, libevent, ...). But I haven't found the time yet. Btw, the libevent project also moved away from sf.
Works flawlessly: Tmux 2.8, Nurses 6.1, Libevent 2.1.8 on Ubuntu 18.04.2 LTS. Thank you very much, sir!.
not working.. tmux failed to compile
In file included from tmux.h:36:0,
from alerts.c:24:
compat.h:326:9: error: conflicting types for 'forkpty'
pid_t forkpty(int *, char *, struct termios *, struct winsize *);
^
In file included from compat.h:126:0,
from tmux.h:36,
from alerts.c:24:
/usr/include/pty.h:39:12: note: previous declaration of 'forkpty' was here
extern int forkpty (int *__amaster, char *__name,
^
make: *** [alerts.o] Error 1
not working.. tmux failed to compile
Not the script's fault.
Thanks! Makes it easier :-)
@maiaz are you using tmux 3? I get the same error when following the install instructions on the tmux site with static compile tmux 3.1c
https://github.com/tmux/tmux/wiki/Installing
@tessus agree it is not the script fault.
g for library containing SSL_new... no
checking for library containing SSL_new... no
checking openssl/ssl.h usability... no
checking openssl/ssl.h presence... no
checking for openssl/ssl.h... no
configure: error: openssl is a must but can not be found. You should add the directory containing `openssl.pc' to the `PKG_CONFIG_PATH' environment variable, or set `CFLAGS' and `LDFLAGS' directly for openssl, or use `--disable-openssl' to disable support for openssl encryption
make: *** No targets specified and no makefile found. Stop.
checking for egrep... grep -E
Configuring NCURSES 6.2 ABI 6 (Mon Jun 7 23:14:28 CST 2021)
checking for package version... 6.2
checking for package patch date... 20200212
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
FYI, here are some updates to wget commands to download libevent and tmux (ncurses works):
wget http://downloads.sourceforge.net/project/levent/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
wget -O tmux-2.1.tar.gz https://github.com/tmux/tmux/releases/download/2.1/tmux-2.1.tar.gz
For me at least, -O tmux-2.1.tar.gz is needed to avoid "filename too long" error
Hope this helps, and nice work!
p.s. For folks who are still on CentOS 5, edit the configure line for ncurses for it to configure/build/install successfully:
./configure --prefix=$TMUXTARGET --with-default-terminfo-dir=/usr/share/terminfo