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