1
|
#!/bin/bash
|
2
|
|
3
|
starting_dir="$(pwd)"
|
4
|
|
5
|
# update NCURSES
|
6
|
|
7
|
if [ $# != 1 ]; then
|
8
|
read -e -i "$starting_dir" -p "Type the directory path in which the NCURSES patch files are found: " patchpath
|
9
|
else
|
10
|
patchpath="$1"
|
11
|
fi
|
12
|
|
13
|
headerpatch="${patchpath%/}/ncurses_curses_h_in_20060828.patch"
|
14
|
getchpatch="${patchpath%/}/ncurses_lib_getch_c_v5.7_20090512.patch"
|
15
|
|
16
|
if [ ! -f $headerpatch ]; then
|
17
|
echo "$headerpatch does not exist."
|
18
|
exit
|
19
|
fi
|
20
|
|
21
|
if [ ! -f $getchpatch ]; then
|
22
|
echo "$getchpatch does not exist."
|
23
|
exit
|
24
|
fi
|
25
|
|
26
|
# clean up after previous installs that left trash behind
|
27
|
for dname in $(find . -maxdepth 1 -type d -name "ncurses*"); do rm -fr "$dname"; done
|
28
|
rm -fr ncurses_*.tar.gz ncurses_*.tar.xz ncurses_*.dsc
|
29
|
|
30
|
# install ncurses source code for this version
|
31
|
apt-get -q -y source ncurses
|
32
|
|
33
|
# move into the top-level source directory
|
34
|
srcdir=$(find . -maxdepth 1 -type d -name "ncurses*")
|
35
|
cd "$srcdir"
|
36
|
|
37
|
# patch the source code
|
38
|
patch ncurses/base/lib_getch.c $getchpatch
|
39
|
patch include/curses.h.in $headerpatch
|
40
|
|
41
|
# build the source code
|
42
|
./configure --with-shared && make
|
43
|
|
44
|
# install it
|
45
|
sudo make install
|
46
|
|
47
|
# identify the .so name (it is version-specific)
|
48
|
full_libname=$(basename $(find lib/ -maxdepth 1 -type f -name "libncurses.so.*"))
|
49
|
major_libname="${full_libname%.*}"
|
50
|
|
51
|
# fixup the main lib (the install process leaves it alone, but that won't work)
|
52
|
cd /lib/$(uname -i)-linux-gnu/
|
53
|
sudo cp $full_libname $full_libname.ori
|
54
|
sudo cp /usr/lib/$full_libname .
|
55
|
sudo rm $major_libname
|
56
|
sudo ln -s $full_libname $major_libname
|
57
|
|
58
|
cd "$starting_dir"
|
59
|
|
60
|
# cleanup
|
61
|
rm -fr "$srcdir" ncurses_*.tar.gz ncurses_*.tar.xz ncurses_*.dsc
|