odroid-mali: new package
[buildroot-gz.git] / package / ncurses / ncurses.mk
blobbef57c5f08f521722178a545d3a84ab0953765ea
1 ################################################################################
3 # ncurses
5 ################################################################################
7 NCURSES_VERSION = 5.9
8 NCURSES_SITE = $(BR2_GNU_MIRROR)/ncurses
9 NCURSES_INSTALL_STAGING = YES
10 NCURSES_DEPENDENCIES = host-ncurses
11 NCURSES_PROGS = clear infocmp tabs tic toe tput tset
12 NCURSES_LICENSE = MIT with advertising clause
13 NCURSES_LICENSE_FILES = README
14 NCURSES_CONFIG_SCRIPTS = ncurses$(NCURSES_LIB_SUFFIX)$(NCURSES_ABI_VERSION)-config
16 NCURSES_CONF_OPTS = \
17 --without-cxx \
18 --without-cxx-binding \
19 --without-ada \
20 --without-tests \
21 --disable-big-core \
22 --without-profile \
23 --disable-rpath \
24 --disable-rpath-hack \
25 --enable-echo \
26 --enable-const \
27 --enable-overwrite \
28 --enable-pc-files \
29 $(if $(BR2_PACKAGE_NCURSES_TARGET_PROGS),,--without-progs) \
30 --without-manpages
32 # Install after busybox for the full-blown versions
33 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
34 NCURSES_DEPENDENCIES += busybox
35 endif
37 ifeq ($(BR2_STATIC_LIBS),y)
38 NCURSES_CONF_OPTS += --without-shared --with-normal
39 else ifeq ($(BR2_SHARED_LIBS),y)
40 NCURSES_CONF_OPTS += --with-shared --without-normal
41 else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
42 NCURSES_CONF_OPTS += --with-shared --with-normal
43 endif
45 # configure can't find the soname for libgpm when cross compiling
46 ifeq ($(BR2_PACKAGE_GPM),y)
47 NCURSES_CONF_OPTS += --with-gpm=libgpm.so.2
48 NCURSES_DEPENDENCIES += gpm
49 else
50 NCURSES_CONF_OPTS += --without-gpm
51 endif
53 NCURSES_LIBS-y = ncurses
54 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_MENU) += menu
55 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_PANEL) += panel
56 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_FORM) += form
58 ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
59 NCURSES_CONF_OPTS += --enable-widec
60 NCURSES_LIB_SUFFIX = w
62 define NCURSES_LINK_LIBS_STATIC
63 for lib in $(NCURSES_LIBS-y:%=lib%); do \
64 ln -sf $${lib}$(NCURSES_LIB_SUFFIX).a \
65 $(1)/usr/lib/$${lib}.a; \
66 done
67 ln -sf libncurses$(NCURSES_LIB_SUFFIX).a \
68 $(1)/usr/lib/libcurses.a
69 endef
71 define NCURSES_LINK_LIBS_SHARED
72 for lib in $(NCURSES_LIBS-y:%=lib%); do \
73 ln -sf $${lib}$(NCURSES_LIB_SUFFIX).so \
74 $(1)/usr/lib/$${lib}.so; \
75 done
76 ln -sf libncurses$(NCURSES_LIB_SUFFIX).so \
77 $(1)/usr/lib/libcurses.so
78 endef
80 define NCURSES_LINK_PC
81 for pc in $(NCURSES_LIBS-y); do \
82 ln -sf $${pc}$(NCURSES_LIB_SUFFIX).pc \
83 $(1)/usr/lib/pkgconfig/$${pc}.pc; \
84 done
85 endef
87 NCURSES_LINK_TARGET_LIBS = \
88 $(if $(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),$(call NCURSES_LINK_LIBS_STATIC,$(TARGET_DIR));) \
89 $(if $(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),$(call NCURSES_LINK_LIBS_SHARED,$(TARGET_DIR)))
90 NCURSES_LINK_STAGING_LIBS = \
91 $(if $(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),$(call NCURSES_LINK_LIBS_STATIC,$(STAGING_DIR));) \
92 $(if $(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),$(call NCURSES_LINK_LIBS_SHARED,$(STAGING_DIR)))
94 NCURSES_LINK_STAGING_PC = $(call NCURSES_LINK_PC,$(STAGING_DIR))
96 NCURSES_CONF_OPTS += --enable-ext-colors
97 NCURSES_ABI_VERSION = 6
98 define NCURSES_INSTALL_TARGET_256_COLORS_TERMINFO
99 cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm+256color $(TARGET_DIR)/usr/share/terminfo/x
100 cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-256color $(TARGET_DIR)/usr/share/terminfo/x
101 endef
103 NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_LIBS
104 NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_PC
106 else # BR2_PACKAGE_NCURSES_WCHAR
107 NCURSES_ABI_VERSION = 5
108 endif # BR2_PACKAGE_NCURSES_WCHAR
110 ifneq ($(BR2_ENABLE_DEBUG),y)
111 NCURSES_CONF_OPTS += --without-debug
112 endif
114 # ncurses breaks with parallel build, but takes quite a while to
115 # build single threaded. Work around it similar to how Gentoo does
116 define NCURSES_BUILD_CMDS
117 $(MAKE1) -C $(@D) DESTDIR=$(STAGING_DIR) sources
118 rm -rf $(@D)/misc/pc-files
119 $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR)
120 endef
122 ifneq ($(BR2_STATIC_LIBS),y)
123 define NCURSES_INSTALL_TARGET_LIBS
124 for lib in $(NCURSES_LIBS-y:%=lib%); do \
125 cp -dpf $(NCURSES_DIR)/lib/$${lib}$(NCURSES_LIB_SUFFIX).so* \
126 $(TARGET_DIR)/usr/lib/; \
127 done
128 endef
129 endif
131 ifeq ($(BR2_PACKAGE_NCURSES_TARGET_PROGS),y)
132 define NCURSES_INSTALL_TARGET_PROGS
133 for x in $(NCURSES_PROGS); do \
134 $(INSTALL) -m 0755 $(NCURSES_DIR)/progs/$$x \
135 $(TARGET_DIR)/usr/bin/$$x; \
136 done
137 ln -sf tset $(TARGET_DIR)/usr/bin/reset
138 endef
139 endif
141 define NCURSES_INSTALL_TARGET_CMDS
142 mkdir -p $(TARGET_DIR)/usr/lib
143 $(NCURSES_INSTALL_TARGET_LIBS)
144 $(NCURSES_LINK_TARGET_LIBS)
145 $(NCURSES_INSTALL_TARGET_PROGS)
146 ln -snf /usr/share/terminfo $(TARGET_DIR)/usr/lib/terminfo
147 mkdir -p $(TARGET_DIR)/usr/share/terminfo/x
148 cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm $(TARGET_DIR)/usr/share/terminfo/x
149 cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-color $(TARGET_DIR)/usr/share/terminfo/x
150 cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-xfree86 $(TARGET_DIR)/usr/share/terminfo/x
151 $(NCURSES_INSTALL_TARGET_256_COLORS_TERMINFO)
152 mkdir -p $(TARGET_DIR)/usr/share/terminfo/v
153 cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt100 $(TARGET_DIR)/usr/share/terminfo/v
154 cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt102 $(TARGET_DIR)/usr/share/terminfo/v
155 cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt200 $(TARGET_DIR)/usr/share/terminfo/v
156 cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt220 $(TARGET_DIR)/usr/share/terminfo/v
157 mkdir -p $(TARGET_DIR)/usr/share/terminfo/a
158 cp -dpf $(STAGING_DIR)/usr/share/terminfo/a/ansi $(TARGET_DIR)/usr/share/terminfo/a
159 mkdir -p $(TARGET_DIR)/usr/share/terminfo/l
160 cp -dpf $(STAGING_DIR)/usr/share/terminfo/l/linux $(TARGET_DIR)/usr/share/terminfo/l
161 mkdir -p $(TARGET_DIR)/usr/share/terminfo/s
162 cp -dpf $(STAGING_DIR)/usr/share/terminfo/s/screen $(TARGET_DIR)/usr/share/terminfo/s
163 endef # NCURSES_INSTALL_TARGET_CMDS
166 # On systems with an older version of tic, the installation of ncurses hangs
167 # forever. To resolve the problem, build a static version of tic on host
168 # ourselves, and use that during installation.
170 define HOST_NCURSES_BUILD_CMDS
171 $(MAKE1) -C $(@D) sources
172 $(MAKE) -C $(@D)/progs tic
173 endef
175 HOST_NCURSES_CONF_OPTS = \
176 --with-shared \
177 --without-gpm \
178 --without-manpages \
179 --without-cxx \
180 --without-cxx-binding \
181 --without-ada \
182 --without-normal
184 $(eval $(autotools-package))
185 $(eval $(host-autotools-package))