]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/ncurses/ncurses.mk
Rename BR2_PREFER_STATIC_LIB to BR2_STATIC_LIBS
[coffee/buildroot.git] / 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)5-config
16
17 NCURSES_CONF_OPTS = \
18         $(if $(BR2_STATIC_LIBS),--without-shared,--with-shared) \
19         --without-cxx \
20         --without-cxx-binding \
21         --without-ada \
22         --without-tests \
23         --disable-big-core \
24         --without-profile \
25         --disable-rpath \
26         --disable-rpath-hack \
27         --enable-echo \
28         --enable-const \
29         --enable-overwrite \
30         --enable-pc-files \
31         $(if $(BR2_PACKAGE_NCURSES_TARGET_PROGS),,--without-progs) \
32         --without-manpages
33
34 # Install after busybox for the full-blown versions
35 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
36         NCURSES_DEPENDENCIES += busybox
37 endif
38
39 ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
40 NCURSES_CONF_OPTS += --enable-widec
41 NCURSES_LIB_SUFFIX = w
42
43 ifeq ($(BR2_STATIC_LIBS),y)
44 define NCURSES_LINK_LIBS
45         for lib in $(NCURSES_LIBS-y); do \
46                 ln -sf $${lib}$(NCURSES_LIB_SUFFIX).a \
47                         $(1)/usr/lib/$${lib}.a; \
48         done
49         ln -sf libncurses$(NCURSES_LIB_SUFFIX).a \
50                 $(1)/usr/lib/libcurses.a
51 endef
52 else
53 define NCURSES_LINK_LIBS
54         for lib in $(NCURSES_LIBS-y); do \
55                 ln -sf $${lib}$(NCURSES_LIB_SUFFIX).a \
56                         $(1)/usr/lib/$${lib}.a; \
57                 ln -sf $${lib}$(NCURSES_LIB_SUFFIX).so \
58                         $(1)/usr/lib/$${lib}.so; \
59         done
60         ln -sf libncurses$(NCURSES_LIB_SUFFIX).a \
61                 $(1)/usr/lib/libcurses.a
62         ln -sf libncurses$(NCURSES_LIB_SUFFIX).so \
63                 $(1)/usr/lib/libcurses.so
64 endef
65 endif
66
67 NCURSES_LINK_TARGET_LIBS = $(call NCURSES_LINK_LIBS, $(TARGET_DIR))
68 NCURSES_LINK_STAGING_LIBS = $(call NCURSES_LINK_LIBS, $(STAGING_DIR))
69
70 NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_LIBS
71
72 endif
73
74 NCURSES_LIBS-y = libncurses
75 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_MENU) += libmenu
76 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_PANEL) += libpanel
77 NCURSES_LIBS-$(BR2_PACKAGE_NCURSES_TARGET_FORM) += libform
78
79 ifneq ($(BR2_ENABLE_DEBUG),y)
80 NCURSES_CONF_OPTS += --without-debug
81 endif
82
83 # ncurses breaks with parallel build, but takes quite a while to
84 # build single threaded. Work around it similar to how Gentoo does
85 define NCURSES_BUILD_CMDS
86         $(MAKE1) -C $(@D) DESTDIR=$(STAGING_DIR) sources
87         rm -rf $(@D)/misc/pc-files
88         $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR)
89 endef
90
91 ifneq ($(BR2_STATIC_LIBS),y)
92 define NCURSES_INSTALL_TARGET_LIBS
93         for lib in $(NCURSES_LIBS-y); do \
94                 cp -dpf $(NCURSES_DIR)/lib/$${lib}$(NCURSES_LIB_SUFFIX).so* \
95                         $(TARGET_DIR)/usr/lib/; \
96         done
97 endef
98 endif
99
100 ifeq ($(BR2_PACKAGE_NCURSES_TARGET_PROGS),y)
101 define NCURSES_INSTALL_TARGET_PROGS
102         for x in $(NCURSES_PROGS); do \
103                 $(INSTALL) -m 0755 $(NCURSES_DIR)/progs/$$x \
104                         $(TARGET_DIR)/usr/bin/$$x; \
105         done
106         ln -sf tset $(TARGET_DIR)/usr/bin/reset
107 endef
108 endif
109
110 define NCURSES_INSTALL_TARGET_CMDS
111         mkdir -p $(TARGET_DIR)/usr/lib
112         $(NCURSES_INSTALL_TARGET_LIBS)
113         $(NCURSES_LINK_TARGET_LIBS)
114         $(NCURSES_INSTALL_TARGET_PROGS)
115         ln -snf /usr/share/terminfo $(TARGET_DIR)/usr/lib/terminfo
116         mkdir -p $(TARGET_DIR)/usr/share/terminfo/x
117         cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm $(TARGET_DIR)/usr/share/terminfo/x
118         cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-color $(TARGET_DIR)/usr/share/terminfo/x
119         cp -dpf $(STAGING_DIR)/usr/share/terminfo/x/xterm-xfree86 $(TARGET_DIR)/usr/share/terminfo/x
120         mkdir -p $(TARGET_DIR)/usr/share/terminfo/v
121         cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt100 $(TARGET_DIR)/usr/share/terminfo/v
122         cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt102 $(TARGET_DIR)/usr/share/terminfo/v
123         cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt200 $(TARGET_DIR)/usr/share/terminfo/v
124         cp -dpf $(STAGING_DIR)/usr/share/terminfo/v/vt220 $(TARGET_DIR)/usr/share/terminfo/v
125         mkdir -p $(TARGET_DIR)/usr/share/terminfo/a
126         cp -dpf $(STAGING_DIR)/usr/share/terminfo/a/ansi $(TARGET_DIR)/usr/share/terminfo/a
127         mkdir -p $(TARGET_DIR)/usr/share/terminfo/l
128         cp -dpf $(STAGING_DIR)/usr/share/terminfo/l/linux $(TARGET_DIR)/usr/share/terminfo/l
129         mkdir -p $(TARGET_DIR)/usr/share/terminfo/s
130         cp -dpf $(STAGING_DIR)/usr/share/terminfo/s/screen $(TARGET_DIR)/usr/share/terminfo/s
131 endef # NCURSES_INSTALL_TARGET_CMDS
132
133 #
134 # On systems with an older version of tic, the installation of ncurses hangs
135 # forever. To resolve the problem, build a static version of tic on host
136 # ourselves, and use that during installation.
137 #
138 define HOST_NCURSES_BUILD_CMDS
139         $(MAKE1) -C $(@D) sources
140         $(MAKE) -C $(@D)/progs tic
141 endef
142
143 HOST_NCURSES_CONF_OPTS = \
144         --with-shared --without-gpm \
145         --without-manpages \
146         --without-cxx \
147         --without-cxx-binding \
148         --without-ada
149
150 $(eval $(autotools-package))
151 $(eval $(host-autotools-package))