8368c690b60665acd2c8192b3bc6c1d63ab5647c
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / ncurses / ncurses.mk
1 ################################################################################
2 #
3 # ncurses
4 #
5 ################################################################################
6
7 NCURSES_VERSION = 5.9
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
16
17 NCURSES_CONF_OPTS = \
18         --without-cxx \
19         --without-cxx-binding \
20         --without-ada \
21         --without-tests \
22         --disable-big-core \
23         --without-profile \
24         --disable-rpath \
25         --disable-rpath-hack \
26         --enable-echo \
27         --enable-const \
28         --enable-overwrite \
29         --enable-pc-files \
30         $(if $(BR2_PACKAGE_NCURSES_TARGET_PROGS),,--without-progs) \
31         --without-manpages
32
33 # Install after busybox for the full-blown versions
34 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
35 NCURSES_DEPENDENCIES += busybox
36 endif
37
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
44 endif
45
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
50 else
51 NCURSES_CONF_OPTS += --without-gpm
52 endif
53
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
58
59 ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
60 NCURSES_CONF_OPTS += --enable-widec
61 NCURSES_LIB_SUFFIX = w
62
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; \
67         done
68         ln -sf libncurses$(NCURSES_LIB_SUFFIX).a \
69                 $(1)/usr/lib/libcurses.a
70 endef
71
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; \
76         done
77         ln -sf libncurses$(NCURSES_LIB_SUFFIX).so \
78                 $(1)/usr/lib/libcurses.so
79 endef
80
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; \
85         done
86 endef
87
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)))
94
95 NCURSES_LINK_STAGING_PC = $(call NCURSES_LINK_PC,$(STAGING_DIR))
96
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
102 endef
103
104 NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_LIBS
105 NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_PC
106
107 else # BR2_PACKAGE_NCURSES_WCHAR
108 NCURSES_ABI_VERSION = 5
109 endif # BR2_PACKAGE_NCURSES_WCHAR
110
111 ifneq ($(BR2_ENABLE_DEBUG),y)
112 NCURSES_CONF_OPTS += --without-debug
113 endif
114
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)
121 endef
122
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/; \
128         done
129 endef
130 endif
131
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; \
137         done
138         ln -sf tset $(TARGET_DIR)/usr/bin/reset
139 endef
140 endif
141
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
165
166 #
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.
170 #
171 define HOST_NCURSES_BUILD_CMDS
172         $(MAKE1) -C $(@D) sources
173         $(MAKE) -C $(@D)/progs tic
174 endef
175
176 HOST_NCURSES_CONF_OPTS = \
177         --with-shared \
178         --without-gpm \
179         --without-manpages \
180         --without-cxx \
181         --without-cxx-binding \
182         --without-ada \
183         --without-normal
184
185 $(eval $(autotools-package))
186 $(eval $(host-autotools-package))