-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
66 lines (57 loc) · 1.9 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# in bash we trust
SHELL=/bin/bash
DirRepo=${PWD}
TMUX_VERSION=2.3
PREFIX=${HOME}/local
DirTmp=${HOME}/tmux_tmp
# catch the leading number of the version 'A', where:
# gcc --version == A.B.C
#GCC_VERSION="$(gcc --version | grep gcc | awk '{print $3}' | awk -F. '{print $1}')"
GCC_VERSION = $(shell gcc --version | grep ^gcc | sed 's/^.* //g')
TMUX_GZ=tmux-${TMUX_VERSION}.tar.gz
# dont' associate these rules with files/dirs
.PHONY: tmux
libevent:
cp -pv ${DirRepo}/tmux/requirements/libevent-2.0.19-stable.tar.gz ${DirTmp}/.
cd ${DirTmp} \
tar xvzf libevent-2.0.19-stable.tar.gz \
cd libevent-2.0.19-stable \
./configure --prefix=${PREFIX} --disable-shared \
make \
make install
ncurses:
cp -pv ${DirRepo}/tmux/requirements/ncurses-5.9.tar.gz ${DirTmp}/.
cd ${DirTmp} \
&& tar xvzf ./ncurses-5.9.tar.gz
# check if we need to use the ncurses patch
echo -e "\n [*] gcc version: ${GCC_VERSION}\n"; \
if [[ ${GCC_VERSION} =~ ^[5-9].* ]]; then \
echo -e "\n [*] using ncurses patch for >=gcc-5.*\n"; \
cp -v ${DirRepo}/tmux/requirements/patches/MKlib_gen.sh ${DirTmp}/ncurses-5.9/ncurses/base/.; \
fi
cd ${DirTmp}/ncurses-5.9 \
./configure --prefix=${PREFIX} \
make \
make install
tmux:
[[ ! -f ${TMUX_GZ} ]] \
&& wget \
-O ${TMUX_GZ} \
https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz
mkdir -p ${PREFIX} ${DirTmp}
$(MAKE) ncurses
$(MAKE) libevent
#--- ok, now we build tmux-{TMUX_VERSION}
tar xvzf ${TMUX_GZ}
cd tmux-${TMUX_VERSION}; \
./configure \
CFLAGS="-I${PREFIX}/include -I${PREFIX}/include/ncurses" \
LDFLAGS="-L${PREFIX}/lib -L${PREFIX}/include/ncurses -L${PREFIX}/include"; \
CPPFLAGS="-I${PREFIX}/include -I${PREFIX}/include/ncurses" \
LDFLAGS="-static -L${PREFIX}/include -L${PREFIX}/include/ncurses -L${PREFIX}/lib" \
make; \
cp tmux ${PREFIX}/bin/tmux_${TMUX_VERSION}; \
rm -rf ${DirTmp}
clean:
-rm -rf ${DirTmp} ${TMUX_GZ}
#EOF