1 ################################################################################
5 ################################################################################
8 NCURSES_SITE = $(BR2_GNU_MIRROR)/ncurses
9 NCURSES_INSTALL_STAGING = YES
10 NCURSES_DEPENDENCIES = host-ncurses
11 HOST_NCURSES_DEPENDENCIES =
12 NCURSES_PROGS = clear infocmp tabs tic toe tput tset
13 NCURSES_LICENSE = MIT with advertising clause
14 NCURSES_LICENSE_FILES = README
15 NCURSES_CONFIG_SCRIPTS = ncurses$(NCURSES_LIB_SUFFIX)$(NCURSES_ABI_VERSION)-config
19 --without-cxx-binding \
25 --disable-rpath-hack \
30 $(if $(BR2_PACKAGE_NCURSES_TARGET_PROGS),,--without-progs) \
33 # Install after busybox for the full-blown versions
34 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
35 NCURSES_DEPENDENCIES += busybox
38 ifeq ($(BR2_STATIC_LIBS),y)
39 NCURSES_CONF_OPTS += --without-shared --with-normal
40 else ifeq ($(BR2_SHARED_LIBS),y)
41 NCURSES_CONF_OPTS += --with-shared --without-normal
42 else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
43 NCURSES_CONF_OPTS += --with-shared --with-normal
46 # configure can't find the soname for libgpm when cross compiling
47 ifeq ($(BR2_PACKAGE_GPM),y)
48 NCURSES_CONF_OPTS += --with-gpm=libgpm.so.2
49 NCURSES_DEPENDENCIES += gpm
51 NCURSES_CONF_OPTS += --without-gpm
54 NCURSES_LIBS-y = ncurses
55 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_MENU) += menu
56 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_PANEL) += panel
57 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_FORM) += form
59 ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
60 NCURSES_CONF_OPTS += --enable-widec
61 NCURSES_LIB_SUFFIX = w
63 define NCURSES_LINK_LIBS_STATIC
64 for lib in $(NCURSES_LIBS-y:%=lib%); do \
65 ln -sf $${lib}$(NCURSES_LIB_SUFFIX).a \
66 $(1)/usr/lib/$${lib}.a; \
68 ln -sf libncurses$(NCURSES_LIB_SUFFIX).a \
69 $(1)/usr/lib/libcurses.a
72 define NCURSES_LINK_LIBS_SHARED
73 for lib in $(NCURSES_LIBS-y:%=lib%); do \
74 ln -sf $${lib}$(NCURSES_LIB_SUFFIX).so \
75 $(1)/usr/lib/$${lib}.so; \
77 ln -sf libncurses$(NCURSES_LIB_SUFFIX).so \
78 $(1)/usr/lib/libcurses.so
81 define NCURSES_LINK_PC
82 for pc in $(NCURSES_LIBS-y); do \
83 ln -sf $${pc}$(NCURSES_LIB_SUFFIX).pc \
84 $(1)/usr/lib/pkgconfig/$${pc}.pc; \
88 NCURSES_LINK_TARGET_LIBS = \
89 $(if $(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),$(call NCURSES_LINK_LIBS_STATIC,$(TARGET_DIR));) \
90 $(if $(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),$(call NCURSES_LINK_LIBS_SHARED,$(TARGET_DIR)))
91 NCURSES_LINK_STAGING_LIBS = \
92 $(if $(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),$(call NCURSES_LINK_LIBS_STATIC,$(STAGING_DIR));) \
93 $(if $(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),$(call NCURSES_LINK_LIBS_SHARED,$(STAGING_DIR)))
95 NCURSES_LINK_STAGING_PC = $(call NCURSES_LINK_PC,$(STAGING_DIR))
97 NCURSES_CONF_OPTS += --enable-ext-colors
98 NCURSES_ABI_VERSION = 6
99 define NCURSES_INSTALL_TARGET_256_COLORS_TERMINFO
100 cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm+256color $(TARGET_DIR)/usr/share/terminfo/x
101 cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-256color $(TARGET_DIR)/usr/share/terminfo/x
104 NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_LIBS
105 NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_PC
107 else # BR2_PACKAGE_NCURSES_WCHAR
108 NCURSES_ABI_VERSION = 5
109 endif # BR2_PACKAGE_NCURSES_WCHAR
111 ifneq ($(BR2_ENABLE_DEBUG),y)
112 NCURSES_CONF_OPTS += --without-debug
115 # ncurses breaks with parallel build, but takes quite a while to
116 # build single threaded. Work around it similar to how Gentoo does
117 define NCURSES_BUILD_CMDS
118 $(MAKE1) -C $(@D) DESTDIR=$(STAGING_DIR) sources
119 rm -rf $(@D)/misc/pc-files
120 $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR)
123 ifneq ($(BR2_STATIC_LIBS),y)
124 define NCURSES_INSTALL_TARGET_LIBS
125 for lib in $(NCURSES_LIBS-y:%=lib%); do \
126 cp -dpf $(NCURSES_DIR)/lib/$${lib}$(NCURSES_LIB_SUFFIX).so* \
127 $(TARGET_DIR)/usr/lib/; \
132 ifeq ($(BR2_PACKAGE_NCURSES_TARGET_PROGS),y)
133 define NCURSES_INSTALL_TARGET_PROGS
134 for x in $(NCURSES_PROGS); do \
135 $(INSTALL) -m 0755 $(NCURSES_DIR)/progs/$$x \
136 $(TARGET_DIR)/usr/bin/$$x; \
138 ln -sf tset $(TARGET_DIR)/usr/bin/reset
142 define NCURSES_INSTALL_TARGET_CMDS
143 mkdir -p $(TARGET_DIR)/usr/lib
144 $(NCURSES_INSTALL_TARGET_LIBS)
145 $(NCURSES_LINK_TARGET_LIBS)
146 $(NCURSES_INSTALL_TARGET_PROGS)
147 ln -snf /usr/share/terminfo $(TARGET_DIR)/usr/lib/terminfo
148 mkdir -p $(TARGET_DIR)/usr/share/terminfo/x
149 cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm $(TARGET_DIR)/usr/share/terminfo/x
150 cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-color $(TARGET_DIR)/usr/share/terminfo/x
151 cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-xfree86 $(TARGET_DIR)/usr/share/terminfo/x
152 $(NCURSES_INSTALL_TARGET_256_COLORS_TERMINFO)
153 mkdir -p $(TARGET_DIR)/usr/share/terminfo/v
154 cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt100 $(TARGET_DIR)/usr/share/terminfo/v
155 cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt102 $(TARGET_DIR)/usr/share/terminfo/v
156 cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt200 $(TARGET_DIR)/usr/share/terminfo/v
157 cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt220 $(TARGET_DIR)/usr/share/terminfo/v
158 mkdir -p $(TARGET_DIR)/usr/share/terminfo/a
159 cp -dpf $(STAGING_DIR)/usr/share/terminfo/a/ansi $(TARGET_DIR)/usr/share/terminfo/a
160 mkdir -p $(TARGET_DIR)/usr/share/terminfo/l
161 cp -dpf $(STAGING_DIR)/usr/share/terminfo/l/linux $(TARGET_DIR)/usr/share/terminfo/l
162 mkdir -p $(TARGET_DIR)/usr/share/terminfo/s
163 cp -dpf $(STAGING_DIR)/usr/share/terminfo/s/screen $(TARGET_DIR)/usr/share/terminfo/s
164 endef # NCURSES_INSTALL_TARGET_CMDS
167 # On systems with an older version of tic, the installation of ncurses hangs
168 # forever. To resolve the problem, build a static version of tic on host
169 # ourselves, and use that during installation.
171 define HOST_NCURSES_BUILD_CMDS
172 $(MAKE1) -C $(@D) sources
173 $(MAKE) -C $(@D)/progs tic
176 HOST_NCURSES_CONF_OPTS = \
181 --without-cxx-binding \
185 $(eval $(autotools-package))
186 $(eval $(host-autotools-package))