procd: make mDNS TXT record parsing more solid
[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_CPE_ID:=cpe:/a:gnu:ncurses
12 PKG_VERSION:=6.3
13 PKG_RELEASE:=$(AUTORELEASE)
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
17 PKG_HASH:=97fc51ac2b085d4cde31ef4d2c3122c21abc217e9090a43a30fc5ec21684e059
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 --without-cxx \
86 --without-cxx-binding \
87 --without-ada \
88 --without-debug \
89 --without-manpages \
90 --without-profile \
91 --without-tests \
92 --without-curses-h
93
94
95 ifeq ($(HOST_OS),FreeBSD)
96 CONFIGURE_ARGS +=
97 --with-terminfo=/usr/share/terminfo.db
98 endif
99
100 MAKE_FLAGS += \
101 BUILD_CC="$(HOSTCC)" \
102 HOSTCC="$(HOSTCC)" \
103 HOSTCCFLAGS="" \
104 PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig \
105 libs
106
107 define Build/Install/Default
108 $(MAKE_VARS) \
109 $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
110 $(MAKE_INSTALL_FLAGS) \
111 $(1) install.libs install.data;
112 endef
113
114 define Package/terminfo/install
115 echo ""
116 ifneq ($(HOST_OS),FreeBSD)
117 $(INSTALL_DIR) $(1)/usr/share/terminfo
118 (cd $(PKG_INSTALL_DIR)/usr/share/terminfo; \
119 for dir in ??; do \
120 [ -d "$$$$dir" ] || continue; \
121 mv $$$$dir $$$$(echo -ne "\x$$$$dir"); \
122 done \
123 )
124 for file in \
125 a/ansi \
126 d/dumb \
127 l/linux \
128 r/rxvt \
129 r/rxvt-unicode \
130 s/screen \
131 s/screen-256color \
132 t/tmux \
133 t/tmux-256color \
134 v/vt100 \
135 v/vt102 \
136 x/xterm \
137 x/xterm-color \
138 x/xterm-256color; do \
139 $(INSTALL_DIR) $(1)/usr/share/terminfo/`dirname $$$$file`; \
140 $(CP) $(PKG_INSTALL_DIR)/usr/share/terminfo/$$$$file \
141 $(1)/usr/share/terminfo/$$$$file; \
142 done
143 endif
144 endef
145
146 define Package/libncurses/install
147 $(INSTALL_DIR) $(1)/usr/lib
148 for lib in ncurses panel menu form; do \
149 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$$$${lib}w.so.* $(1)/usr/lib/; \
150 for so in $(1)/usr/lib/lib$$$${lib}w.so.*; do \
151 ln -s $$$${so##*/} $$$${so%w.so*}.so$$$${so##*w.so}; \
152 done; \
153 done
154 endef
155
156 define Package/libncurses-dev/install
157 $(INSTALL_DIR) $(1)/usr/bin
158 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
159 $(INSTALL_DIR) $(1)/usr/include
160 $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
161 $(INSTALL_DIR) $(1)/usr/lib
162 $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.a $(1)/usr/lib/
163 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
164 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig/
165 endef
166
167 define Build/InstallDev
168 $(CP) $(PKG_INSTALL_DIR)/* $(1)
169 for lib in ncurses panel menu form; do \
170 for so in $(1)/usr/lib/lib$$$${lib}w.so*; do \
171 ln -s $$$${so##*/} $$$${so%w.so*}.so$$$${so##*w.so}; \
172 done; \
173 done
174 ln -s . $(1)/usr/include/ncursesw
175 $(TARGET_CROSS)ar rc $(1)/usr/lib/libtinfo.a
176 $(INSTALL_DIR) $(2)/bin
177 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ncursesw6-config $(2)/bin/
178 $(SED) 's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' -e 's/$$$$INCS //g' \
179 $(2)/bin/ncursesw6-config
180 ln -sf $(STAGING_DIR)/host/bin/ncursesw6-config $(1)/usr/bin/ncursesw6-config
181 endef
182
183 define Host/Compile
184 $(MAKE) -C $(HOST_BUILD_DIR) libs
185 $(MAKE) -C $(HOST_BUILD_DIR)/progs tic
186 endef
187
188 $(eval $(call HostBuild))
189 $(eval $(call BuildPackage,terminfo))
190 $(eval $(call BuildPackage,libncurses))
191 $(eval $(call BuildPackage,libncurses-dev))