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