summaryrefslogtreecommitdiff
path: root/ncurses-morph-postinstall.sh
blob: 650050343451c4fb7b607d77f6c8d9379fba2ddf (plain)
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
#/usr/bin/env sh
set -e
# lfs recommends some alterations for software that looks for
# libcurses instead of libncurses
# it's more convenient to have this in a separate file than the
# morph as less strings have to be escaped and comments are possible

# some software expects to find libcurses in /lib
mkdir -p "$DESTDIR/lib"
mv "$DESTDIR"/usr/lib/libncursesw.so.5* "$DESTDIR"/lib
ln -sf ../../lib/libncursesw.so.5 "$DESTDIR"/usr/lib/libncursesw.so

# some linker tricks for libraries that look for non-wide character
# versions of ncurses
for lib in ncurses form panel menu; do
    # remove non-wide shared object
    rm -f "$DESTDIR/usr/lib/lib${lib}.so"
    # use a linker script to find the wide character variant
    echo "INPUT(-l${lib}w)" >"$DESTDIR/usr/lib/lib${lib}.so"
    # symlink the non-shared library
    ln -sf "lib${lib}w.a" "$DESTDIR/usr/lib/lib${lib}.a"
done
ln -sf libncurses++w.a "$DESTDIR/usr/lib/libncurses++.a"

# redirect software that looks for libcurses
rm -f "$DESTDIR/usr/lib/libcursesw.so"
echo "INPUT(-lncursesw)" >"$DESTDIR/usr/lib/libcursesw.so"
ln -sf libncurses.so "$DESTDIR/usr/lib/libcurses.so"
ln -sf libncursesw.a "$DESTDIR/usr/lib/libcursesw.a"
ln -sf libncurses.a "$DESTDIR/usr/lib/libcurses.a"

# install documentation
mkdir -p "$DESTDIR/usr/share/doc/ncurses"
cp -R doc/* "$DESTDIR/usr/share/doc/ncurses"