summaryrefslogtreecommitdiff
path: root/elements/core/ncurses.bst
blob: 3f8dd214f99a2ba8dc386d6c8b793e69d46f660f (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
kind: manual
depends:
- gnu-toolchain.bst
sources:
- kind: git
  url: upstream:ncurses
  track: ncurses-5.9-20150131
  ref: f6d73a10a980bc78969c3af93665cbe7d06c3646
config:
  configure-commands:
  - LDCONFIG=true ./configure --with-shared --without-debug --enable-widec
  build-commands:
  - make
  install-commands:
  - make  DESTDIR="%{install-root}" install
  - |
    # 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 "%{install-root}/lib"
    mv "%{install-root}"/"%{prefix}"/lib/libncursesw.so.5* "%{install-root}"/lib
    ln -sf ../../lib/libncursesw.so.5 "%{install-root}"/"%{prefix}"/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 "%{install-root}/%{prefix}/lib/lib${lib}.so"
        # use a linker script to find the wide character variant
        echo "INPUT(-l${lib}w)" >"%{install-root}/%{prefix}/lib/lib${lib}.so"
        # symlink the non-shared library
        ln -sf "lib${lib}w.a" "%{install-root}/%{prefix}/lib/lib${lib}.a"
    done
    ln -sf libncurses++w.a "%{install-root}/%{prefix}/lib/libncurses++.a"

    # redirect software that looks for libcurses
    rm -f "%{install-root}/%{prefix}/lib/libcursesw.so"
    echo "INPUT(-lncursesw)" >"%{install-root}/%{prefix}/lib/libcursesw.so"
    ln -sf libncurses.so "%{install-root}/%{prefix}/lib/libcurses.so"
    ln -sf libncursesw.a "%{install-root}/%{prefix}/lib/libcursesw.a"
    ln -sf libncurses.a "%{install-root}/%{prefix}/lib/libcurses.a"

    # install documentation
    mkdir -p "%{install-root}/%{prefix}/share/doc/ncurses"
    cp -R doc/* "%{install-root}/%{prefix}/share/doc/ncurses"

    # remove 'clear' and 'reset' executables, busybox provides them
    rm -f "%{install-root}/%{prefix}/bin/clear" "%{install-root}/%{prefix}/bin/reset"