26fabeef7704c2377414528cf914347b95770e36
[openwrt/openwrt.git] / package / libs / ncurses / Makefile
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_VERSION:=6.0
12 PKG_RELEASE:=1
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=@GNU/ncurses
17 PKG_HASH:=f551c24b30ce8bfb6e96d9f59b42fbea30fa3a6123384172f9e7284bcf647260
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:=$(PKG_VERSION)
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 HOST_CONFIGURE_ARGS += \
80 --without-cxx \
81 --without-cxx-binding \
82 --without-ada \
83 --without-debug \
84 --without-manpages \
85 --without-profile \
86 --without-tests \
87 --without-curses-h
88
89
90 ifeq ($(HOST_OS),FreeBSD)
91 CONFIGURE_ARGS +=
92 --with-terminfo=/usr/share/terminfo.db
93 endif
94
95 MAKE_FLAGS += \
96 BUILD_CC="$(HOSTCC)" \
97 HOSTCC="$(HOSTCC)" \
98 HOSTCCFLAGS="" \
99 PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig \
100 libs
101
102 define Build/Install/Default
103 $(MAKE_VARS) \
104 $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
105 $(MAKE_INSTALL_FLAGS) \
106 $(1) install.libs install.data;
107 endef
108
109 define Package/terminfo/install
110 echo ""
111 ifneq ($(HOST_OS),FreeBSD)
112 $(INSTALL_DIR) $(1)/usr/share/terminfo
113 (cd $(PKG_INSTALL_DIR)/usr/share/terminfo; \
114 for dir in ??; do \
115 [ -d "$$$$dir" ] || continue; \
116 mv $$$$dir $$$$(echo -ne "\x$$$$dir"); \
117 done \
118 )
119 for file in a/ansi d/dumb l/linux r/rxvt r/rxvt-unicode s/screen v/vt100 v/vt102 x/xterm x/xterm-color 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
127 define Package/libncurses/install
128 $(INSTALL_DIR) $(1)/usr/lib
129 for lib in ncurses panel menu form; do \
130 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$$$${lib}w.so* $(1)/usr/lib/; \
131 ln -s lib$$$${lib}w.so $(1)/usr/lib/lib$$$${lib}.so; \
132 done
133 endef
134
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
146 define Build/InstallDev
147 $(CP) $(PKG_INSTALL_DIR)/* $(1)
148 for lib in ncurses panel menu form; do \
149 ln -s lib$$$${lib}w.so $(1)/usr/lib/lib$$$${lib}.so; \
150 done
151 ln -s . $(1)/usr/include/ncursesw
152 $(TARGET_CROSS)ar rc $(1)/usr/lib/libtinfo.a
153 $(INSTALL_DIR) $(2)/bin
154 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ncursesw6-config $(2)/bin/
155 $(SED) 's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' -e 's/$$$$INCS //g' \
156 $(2)/bin/ncursesw6-config
157 ln -sf $(STAGING_DIR)/host/bin/ncursesw6-config $(1)/usr/bin/ncursesw6-config
158 endef
159
160 define Host/Compile
161 $(MAKE) -C $(HOST_BUILD_DIR) libs
162 $(MAKE) -C $(HOST_BUILD_DIR)/progs tic
163 endef
164
165 define Host/Install
166 $(INSTALL_BIN) $(HOST_BUILD_DIR)/progs/tic $(STAGING_DIR_HOST)/bin/tic
167 endef
168
169 $(eval $(call HostBuild))
170 $(eval $(call BuildPackage,terminfo))
171 $(eval $(call BuildPackage,libncurses))
172 $(eval $(call BuildPackage,libncurses-dev))