merge of '178eac00dc5aa8338d42e8e203633bec7817bbf6'
[vuplus_openembedded] / packages / ncurses / ncurses.inc
1 DESCRIPTION = "Ncurses library"
2 HOMEPAGE = "http://www.gnu.org/software/ncurses/ncurses.html"
3 SECTION = "libs"
4 LICENSE = "MIT"
5 DEPENDS = "ncurses-native"
6 RSUGGESTS_${PN} = "ncurses-terminfo"
7
8 inherit autotools
9
10 PARALLEL_MAKE = ""
11
12 EXTRA_OECONF = "--with-shared \
13                 --without-profile \
14                 --without-debug \
15                 --disable-rpath \
16                 --enable-echo \
17                 --enable-const \
18                 --without-ada \
19                 --enable-termcap \
20                 --without-cxx-binding \
21                 --with-terminfo-dirs=${sysconfdir}/terminfo:${datadir}/terminfo \
22                 --enable-overwrite"
23
24 export BUILD_CCFLAGS = "-I${S}/ncurses -I${S}/include ${BUILD_CFLAGS}"
25 export BUILD_LDFLAGS = ""
26 export EXTRA_OEMAKE = '"BUILD_LDFLAGS=" "BUILD_CCFLAGS=${BUILD_CCFLAGS}"'
27
28 do_stage() {
29         autotools_stage_all
30         ln -sf curses.h ${STAGING_INCDIR}/ncurses.h
31         ln -sf libncurses.so ${STAGING_LIBDIR}/libtermcap.so
32         ln -sf libncurses.a ${STAGING_LIBDIR}/libtermcap.a
33 }
34
35 # This is necessary so that the "tic" command executed during the install can
36 # link with the correct libary in staging.
37 export LD_LIBRARY_PATH = "${STAGING_LIBDIR_NATIVE}"
38
39 do_install() {
40         autotools_do_install
41
42         # our ncurses has termcap support
43         ln -sf libncurses.so ${D}${libdir}/libtermcap.so
44         ln -sf libncurses.a ${D}${libdir}/libtermcap.a
45
46         # include some basic terminfo files
47         # stolen ;) from gentoo and modified a bit
48         for x in ansi console dumb linux rxvt screen sun vt{52,100,102,200,220} xterm-color xterm-xfree86
49         do
50                 local termfile="$(find "${D}${datadir}/terminfo/" -name "${x}" 2>/dev/null)"
51                 local basedir="$(basename $(dirname "${termfile}"))"
52
53                 if [ -n "${termfile}" ]
54                 then
55                         install -d ${D}${sysconfdir}/terminfo/${basedir}
56                         mv ${termfile} ${D}${sysconfdir}/terminfo/${basedir}/
57                         ln -s /etc/terminfo/${basedir}/${x} \
58                                 ${D}${datadir}/terminfo/${basedir}/${x}
59                 fi
60         done
61         # i think we can use xterm-color as default xterm
62         if [ -e ${D}${sysconfdir}/terminfo/x/xterm-color ]
63         then
64                 ln -sf xterm-color ${D}${sysconfdir}/terminfo/x/xterm
65         fi
66
67         mv ${D}${bindir}/clear ${D}${bindir}/clear.${PN}
68         mv ${D}${bindir}/reset ${D}${bindir}/reset.${PN}
69 }
70                 
71                 
72 pkg_postinst_ncurses-tools () {
73         update-alternatives --install ${bindir}/clear clear clear.${PN} 100
74         update-alternatives --install ${bindir}/reset reset reset.${PN} 100
75 }
76                                 
77                         
78 pkg_prerm_ncurses-tools () {
79         update-alternatives --remove clear clear.${PN}
80         update-alternatives --remove reset reset.${PN}
81 }
82
83
84 PACKAGES =+ "${PN}-ncurses ${PN}-panel ${PN}-menu ${PN}-form ${PN}-terminfo ${PN}-tools"
85 FILES_${PN}-ncurses = "${libdir}/libncurses.so.*"
86 FILES_${PN}-panel = "${libdir}/libpanel.so.*"
87 FILES_${PN}-menu = "${libdir}/libmenu.so.*"
88 FILES_${PN}-form = "${libdir}/libform.so.*"
89 FILES_${PN}-terminfo = "\
90   ${libdir}/terminfo \
91   ${datadir}/terminfo \
92 "
93 FILES_${PN}-tools = "\
94   ${bindir}/tic \
95   ${bindir}/tack \
96   ${bindir}/toe \
97   ${bindir}/infotocap \
98   ${bindir}/captoinfo \
99   ${bindir}/infocmp \
100   ${bindir}/clear.${PN} \
101   ${bindir}/reset.${PN} \
102 "
103 FILES_${PN} = "\
104   ${bindir}/tput \
105   ${bindir}/tset \
106   ${datadir}/tabset \
107   ${sysconfdir}/terminfo \
108 "