ncurses.mk 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. ################################################################################
  2. #
  3. # ncurses
  4. #
  5. ################################################################################
  6. NCURSES_VERSION = 6.1
  7. NCURSES_SITE = $(BR2_GNU_MIRROR)/ncurses
  8. NCURSES_INSTALL_STAGING = YES
  9. NCURSES_DEPENDENCIES = host-ncurses
  10. NCURSES_LICENSE = MIT with advertising clause
  11. NCURSES_LICENSE_FILES = COPYING
  12. NCURSES_CONFIG_SCRIPTS = ncurses$(NCURSES_LIB_SUFFIX)6-config
  13. NCURSES_PATCH = \
  14. $(addprefix https://invisible-mirror.net/archives/ncurses/$(NCURSES_VERSION)/, \
  15. ncurses-6.1-20190609-patch.sh.bz2 \
  16. ncurses-6.1-20190615.patch.gz \
  17. ncurses-6.1-20190623.patch.gz \
  18. ncurses-6.1-20190630.patch.gz \
  19. ncurses-6.1-20190706.patch.gz \
  20. ncurses-6.1-20190713.patch.gz \
  21. ncurses-6.1-20190720.patch.gz \
  22. ncurses-6.1-20190727.patch.gz \
  23. ncurses-6.1-20190728.patch.gz \
  24. ncurses-6.1-20190803.patch.gz \
  25. ncurses-6.1-20190810.patch.gz \
  26. ncurses-6.1-20190817.patch.gz \
  27. ncurses-6.1-20190824.patch.gz \
  28. ncurses-6.1-20190831.patch.gz \
  29. ncurses-6.1-20190907.patch.gz \
  30. ncurses-6.1-20190914.patch.gz \
  31. ncurses-6.1-20190921.patch.gz \
  32. ncurses-6.1-20190928.patch.gz \
  33. ncurses-6.1-20191005.patch.gz \
  34. ncurses-6.1-20191012.patch.gz \
  35. ncurses-6.1-20191015.patch.gz \
  36. ncurses-6.1-20191019.patch.gz \
  37. ncurses-6.1-20191026.patch.gz \
  38. ncurses-6.1-20191102.patch.gz \
  39. ncurses-6.1-20191109.patch.gz \
  40. ncurses-6.1-20191116.patch.gz \
  41. ncurses-6.1-20191123.patch.gz \
  42. ncurses-6.1-20191130.patch.gz \
  43. ncurses-6.1-20191207.patch.gz \
  44. ncurses-6.1-20191214.patch.gz \
  45. ncurses-6.1-20191221.patch.gz \
  46. ncurses-6.1-20191228.patch.gz \
  47. ncurses-6.1-20200104.patch.gz \
  48. ncurses-6.1-20200111.patch.gz \
  49. ncurses-6.1-20200118.patch.gz \
  50. )
  51. # ncurses-6.1-20191012.patch.gz
  52. NCURSES_IGNORE_CVES += CVE-2019-17594 CVE-2019-17595
  53. NCURSES_CONF_OPTS = \
  54. --without-cxx \
  55. --without-cxx-binding \
  56. --without-ada \
  57. --without-tests \
  58. --disable-big-core \
  59. --without-profile \
  60. --disable-rpath \
  61. --disable-rpath-hack \
  62. --enable-echo \
  63. --enable-const \
  64. --enable-overwrite \
  65. --enable-pc-files \
  66. --disable-stripping \
  67. --with-pkg-config-libdir="/usr/lib/pkgconfig" \
  68. $(if $(BR2_PACKAGE_NCURSES_TARGET_PROGS),,--without-progs) \
  69. --without-manpages
  70. ifeq ($(BR2_STATIC_LIBS),y)
  71. NCURSES_CONF_OPTS += --without-shared --with-normal
  72. else ifeq ($(BR2_SHARED_LIBS),y)
  73. NCURSES_CONF_OPTS += --with-shared --without-normal
  74. else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
  75. NCURSES_CONF_OPTS += --with-shared --with-normal
  76. endif
  77. # configure can't find the soname for libgpm when cross compiling
  78. ifeq ($(BR2_PACKAGE_GPM),y)
  79. NCURSES_CONF_OPTS += --with-gpm=libgpm.so.2
  80. NCURSES_DEPENDENCIES += gpm
  81. else
  82. NCURSES_CONF_OPTS += --without-gpm
  83. endif
  84. NCURSES_TERMINFO_FILES = \
  85. a/ansi \
  86. d/dumb \
  87. l/linux \
  88. p/putty \
  89. p/putty-256color \
  90. p/putty-vt100 \
  91. s/screen \
  92. s/screen-256color \
  93. v/vt100 \
  94. v/vt100-putty \
  95. v/vt102 \
  96. v/vt200 \
  97. v/vt220 \
  98. x/xterm \
  99. x/xterm+256color \
  100. x/xterm-256color \
  101. x/xterm-color \
  102. x/xterm-xfree86 \
  103. $(call qstrip,$(BR2_PACKAGE_NCURSES_ADDITIONAL_TERMINFO))
  104. ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
  105. NCURSES_CONF_OPTS += --enable-widec
  106. NCURSES_LIB_SUFFIX = w
  107. NCURSES_LIBS = ncurses menu panel form
  108. define NCURSES_LINK_LIBS_STATIC
  109. $(foreach lib,$(NCURSES_LIBS:%=lib%), \
  110. ln -sf $(lib)$(NCURSES_LIB_SUFFIX).a $(STAGING_DIR)/usr/lib/$(lib).a
  111. )
  112. ln -sf libncurses$(NCURSES_LIB_SUFFIX).a \
  113. $(STAGING_DIR)/usr/lib/libcurses.a
  114. endef
  115. define NCURSES_LINK_LIBS_SHARED
  116. $(foreach lib,$(NCURSES_LIBS:%=lib%), \
  117. ln -sf $(lib)$(NCURSES_LIB_SUFFIX).so $(STAGING_DIR)/usr/lib/$(lib).so
  118. )
  119. ln -sf libncurses$(NCURSES_LIB_SUFFIX).so \
  120. $(STAGING_DIR)/usr/lib/libcurses.so
  121. endef
  122. define NCURSES_LINK_PC
  123. $(foreach pc,$(NCURSES_LIBS), \
  124. ln -sf $(pc)$(NCURSES_LIB_SUFFIX).pc \
  125. $(STAGING_DIR)/usr/lib/pkgconfig/$(pc).pc
  126. )
  127. endef
  128. NCURSES_LINK_STAGING_LIBS = \
  129. $(if $(BR2_STATIC_LIBS)$(BR2_SHARED_STATIC_LIBS),$(call NCURSES_LINK_LIBS_STATIC);) \
  130. $(if $(BR2_SHARED_LIBS)$(BR2_SHARED_STATIC_LIBS),$(call NCURSES_LINK_LIBS_SHARED))
  131. NCURSES_LINK_STAGING_PC = $(call NCURSES_LINK_PC)
  132. NCURSES_CONF_OPTS += --enable-ext-colors
  133. NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_LIBS
  134. NCURSES_POST_INSTALL_STAGING_HOOKS += NCURSES_LINK_STAGING_PC
  135. endif # BR2_PACKAGE_NCURSES_WCHAR
  136. ifneq ($(BR2_ENABLE_DEBUG),y)
  137. NCURSES_CONF_OPTS += --without-debug
  138. endif
  139. # ncurses breaks with parallel build, but takes quite a while to
  140. # build single threaded. Work around it similar to how Gentoo does
  141. define NCURSES_BUILD_CMDS
  142. $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) DESTDIR=$(STAGING_DIR) sources
  143. rm -rf $(@D)/misc/pc-files
  144. $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) DESTDIR=$(STAGING_DIR)
  145. endef
  146. ifeq ($(BR2_PACKAGE_NCURSES_TARGET_PROGS),y)
  147. define NCURSES_TARGET_SYMLINK_RESET
  148. ln -sf tset $(TARGET_DIR)/usr/bin/reset
  149. endef
  150. NCURSES_POST_INSTALL_TARGET_HOOKS += NCURSES_TARGET_SYMLINK_RESET
  151. endif
  152. define NCURSES_TARGET_CLEANUP_TERMINFO
  153. $(RM) -rf $(TARGET_DIR)/usr/share/terminfo $(TARGET_DIR)/usr/share/tabset
  154. $(foreach t,$(NCURSES_TERMINFO_FILES), \
  155. $(INSTALL) -D -m 0644 $(STAGING_DIR)/usr/share/terminfo/$(t) \
  156. $(TARGET_DIR)/usr/share/terminfo/$(t)
  157. )
  158. endef
  159. NCURSES_POST_INSTALL_TARGET_HOOKS += NCURSES_TARGET_CLEANUP_TERMINFO
  160. #
  161. # On systems with an older version of tic, the installation of ncurses hangs
  162. # forever. To resolve the problem, build a static version of tic on host
  163. # ourselves, and use that during installation.
  164. #
  165. define HOST_NCURSES_BUILD_CMDS
  166. $(HOST_MAKE_ENV) $(MAKE1) -C $(@D) sources
  167. $(HOST_MAKE_ENV) $(MAKE) -C $(@D)/progs tic
  168. endef
  169. HOST_NCURSES_CONF_ENV = \
  170. ac_cv_path_LDCONFIG=""
  171. HOST_NCURSES_CONF_OPTS = \
  172. --with-shared \
  173. --without-gpm \
  174. --without-manpages \
  175. --without-cxx \
  176. --without-cxx-binding \
  177. --without-ada \
  178. --with-default-terminfo-dir=/usr/share/terminfo \
  179. --disable-db-install \
  180. --without-normal
  181. $(eval $(autotools-package))
  182. $(eval $(host-autotools-package))