Makefile 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. #
  2. # Copyright (C) 2006-2015 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=ncurses
  9. PKG_CPE_ID:=cpe:/a:gnu:ncurses
  10. PKG_VERSION:=6.4
  11. PKG_RELEASE:=2
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
  14. PKG_HASH:=6931283d9ac87c5073f30b6290c4c75f21632bb4fc3603ac8100812bed248159
  15. PKG_LICENSE:=MIT
  16. PKG_LICENSE_FILES:=README
  17. PKG_INSTALL:=1
  18. PKG_BUILD_PARALLEL:=1
  19. PKG_BUILD_DEPENDS:=ncurses/host
  20. include $(INCLUDE_DIR)/package.mk
  21. include $(INCLUDE_DIR)/host-build.mk
  22. define Package/terminfo
  23. SECTION:=libs
  24. CATEGORY:=Libraries
  25. TITLE:=Terminal Info Database (ncurses)
  26. URL:=http://www.gnu.org/software/ncurses/
  27. endef
  28. define Package/libncurses
  29. SECTION:=libs
  30. CATEGORY:=Libraries
  31. TITLE:=Terminal handling library (Unicode)
  32. URL:=http://www.gnu.org/software/ncurses/
  33. PROVIDES:=libncursesw
  34. DEPENDS:= +terminfo
  35. ABI_VERSION:=6
  36. endef
  37. define Package/libncurses-dev
  38. SECTION:=devel
  39. CATEGORY:=Development
  40. SUBMENU:=Libraries
  41. DEPENDS:=zlib
  42. TITLE:=Development files for the ncurses library
  43. endef
  44. TARGET_CFLAGS += $(FPIC)
  45. CONFIGURE_ARGS += \
  46. --enable-echo \
  47. --enable-const \
  48. --enable-overwrite \
  49. --enable-pc-files \
  50. --disable-rpath \
  51. --without-ada \
  52. --without-debug \
  53. --without-manpages \
  54. --without-profile \
  55. --without-progs \
  56. --without-tests \
  57. --disable-big-core \
  58. --disable-home-terminfo \
  59. --with-normal \
  60. --with-shared \
  61. --with-terminfo-dirs=/usr/share/terminfo \
  62. --with-default-terminfo-dir=/usr/share/terminfo \
  63. --with-pkg-config-libdir=/usr/lib/pkgconfig \
  64. --enable-widec \
  65. --with-build-cppflags=-D_GNU_SOURCE
  66. CONFIGURE_VARS += \
  67. cf_try_fPIC=no
  68. HOST_CFLAGS += $(HOST_FPIC)
  69. HOST_CONFIGURE_ARGS += \
  70. --without-cxx \
  71. --without-cxx-binding \
  72. --without-ada \
  73. --without-debug \
  74. --without-manpages \
  75. --without-profile \
  76. --without-tests \
  77. --without-curses-h
  78. ifeq ($(HOST_OS),FreeBSD)
  79. CONFIGURE_ARGS +=
  80. --with-terminfo=/usr/share/terminfo.db
  81. endif
  82. MAKE_FLAGS += \
  83. BUILD_CC="$(HOSTCC)" \
  84. HOSTCC="$(HOSTCC)" \
  85. HOSTCCFLAGS="" \
  86. PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig \
  87. libs
  88. define Build/Install/Default
  89. $(MAKE_VARS) \
  90. $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
  91. $(MAKE_INSTALL_FLAGS) \
  92. $(1) install.libs install.data;
  93. endef
  94. define Package/terminfo/install
  95. echo ""
  96. ifneq ($(HOST_OS),FreeBSD)
  97. $(INSTALL_DIR) $(1)/usr/share/terminfo
  98. (cd $(PKG_INSTALL_DIR)/usr/share/terminfo; \
  99. for dir in ??; do \
  100. [ -d "$$$$dir" ] || continue; \
  101. mv $$$$dir $$$$(echo -ne "\x$$$$dir"); \
  102. done \
  103. )
  104. for file in \
  105. a/ansi \
  106. a/alacritty \
  107. d/dumb \
  108. l/linux \
  109. r/rxvt \
  110. r/rxvt-unicode \
  111. s/screen \
  112. s/screen-256color \
  113. t/tmux \
  114. t/tmux-256color \
  115. v/vt100 \
  116. v/vt102 \
  117. x/xterm \
  118. x/xterm-color \
  119. x/xterm-256color; do \
  120. $(INSTALL_DIR) $(1)/usr/share/terminfo/`dirname $$$$file`; \
  121. $(CP) $(PKG_INSTALL_DIR)/usr/share/terminfo/$$$$file \
  122. $(1)/usr/share/terminfo/$$$$file; \
  123. done
  124. endif
  125. endef
  126. define Package/libncurses/install
  127. $(INSTALL_DIR) $(1)/usr/lib
  128. for lib in ncurses panel menu form; do \
  129. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$$$${lib}w.so.* $(1)/usr/lib/; \
  130. for so in $(1)/usr/lib/lib$$$${lib}w.so.*; do \
  131. ln -s $$$${so##*/} $$$${so%w.so*}.so$$$${so##*w.so}; \
  132. done; \
  133. done
  134. endef
  135. define Package/libncurses-dev/install
  136. $(INSTALL_DIR) $(1)/usr/bin
  137. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
  138. $(INSTALL_DIR) $(1)/usr/include
  139. $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
  140. $(INSTALL_DIR) $(1)/usr/lib
  141. $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.a $(1)/usr/lib/
  142. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  143. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig/
  144. endef
  145. define Build/InstallDev
  146. $(CP) $(PKG_INSTALL_DIR)/* $(1)
  147. for lib in ncurses panel menu form; do \
  148. for so in $(1)/usr/lib/lib$$$${lib}w.so*; do \
  149. ln -s $$$${so##*/} $$$${so%w.so*}.so$$$${so##*w.so}; \
  150. done; \
  151. done
  152. ln -s . $(1)/usr/include/ncursesw
  153. $(TARGET_CROSS)ar rc $(1)/usr/lib/libtinfo.a
  154. $(INSTALL_DIR) $(2)/bin
  155. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ncursesw6-config $(2)/bin/
  156. $(SED) 's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' -e 's/$$$$INCS //g' \
  157. $(2)/bin/ncursesw6-config
  158. ln -sf $(STAGING_DIR)/host/bin/ncursesw6-config $(1)/usr/bin/ncursesw6-config
  159. endef
  160. define Host/Compile
  161. $(MAKE) -C $(HOST_BUILD_DIR) libs
  162. $(MAKE) -C $(HOST_BUILD_DIR)/progs tic
  163. endef
  164. $(eval $(call HostBuild))
  165. $(eval $(call BuildPackage,terminfo))
  166. $(eval $(call BuildPackage,libncurses))
  167. $(eval $(call BuildPackage,libncurses-dev))