ncurses: remove libncurses, provide it via libncursesw
[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:=5.9
12 PKG_RELEASE:=3
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_MD5SUM:=8cb9c412e5f2d96bc6f459aa8c6282a1
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/libncursesw
38   SECTION:=libs
39   CATEGORY:=Libraries
40   TITLE:=Terminal handling library (Unicode)
41   URL:=http://www.gnu.org/software/ncurses/
42   PROVIDES:=libncurses
43   DEPENDS:= +terminfo
44 endef
45
46 TARGET_CFLAGS += $(FPIC)
47
48 CONFIGURE_ARGS += \
49         --enable-echo \
50         --enable-const \
51         --enable-overwrite \
52         --disable-rpath \
53         --without-ada \
54         --without-debug \
55         --without-manpages \
56         --without-profile \
57         --without-progs \
58         --without-tests \
59         --disable-big-core \
60         --disable-home-terminfo \
61         --with-normal \
62         --with-shared \
63         --with-terminfo-dirs=/usr/share/terminfo \
64         --with-default-terminfo-dir=/usr/share/terminfo \
65         --enable-widec \
66         --with-build-cppflags=-D_GNU_SOURCE
67
68 HOST_CONFIGURE_ARGS += \
69         --without-cxx \
70         --without-cxx-binding \
71         --without-ada \
72         --without-debug \
73         --without-manpages \
74         --without-profile \
75         --without-tests \
76         --without-curses-h
77
78
79 ifeq ($(HOST_OS),FreeBSD)
80         CONFIGURE_ARGS +=
81                 --with-terminfo=/usr/share/terminfo.db 
82 endif
83
84 MAKE_FLAGS += \
85         BUILD_CC="$(HOSTCC)" \
86         HOSTCC="$(HOSTCC)" \
87         HOSTCCFLAGS="" \
88         libs
89
90 define Build/Install/Default
91         $(MAKE_VARS) \
92         $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
93                 $(MAKE_INSTALL_FLAGS) \
94                 $(1) install.libs install.data;
95 endef
96
97 define Package/terminfo/install
98         echo ""
99 ifneq ($(HOST_OS),FreeBSD)
100         $(INSTALL_DIR) $(1)/usr/share/terminfo
101         (cd $(PKG_INSTALL_DIR)/usr/share/terminfo; \
102                 for dir in ??; do \
103                         [ -d "$$$$dir" ] || continue; \
104                         mv $$$$dir $$$$(echo -ne "\x$$$$dir"); \
105                 done \
106         )
107         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 \
108                 $(INSTALL_DIR) $(1)/usr/share/terminfo/`dirname $$$$file`; \
109                 $(CP) $(PKG_INSTALL_DIR)/usr/share/terminfo/$$$$file \
110                         $(1)/usr/share/terminfo/$$$$file; \
111         done
112 endif
113 endef
114
115 define Package/libncursesw/install
116         $(INSTALL_DIR) $(1)/usr/lib
117         $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{ncurses,panel,menu,form}w.so* $(1)/usr/lib/
118 endef
119
120 define Build/InstallDev
121         $(INSTALL_DIR) $(1)/usr/include
122         $(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include/
123
124         $(INSTALL_DIR) $(1)/usr/lib
125         $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{ncurses,panel,menu,form}w.{a,so*} $(1)/usr/lib/
126
127         $(INSTALL_DIR) $(1)/usr/bin $(2)/bin
128         $(CP) $(PKG_INSTALL_DIR)/usr/bin/ncursesw5-config $(2)/bin/
129         $(SED) 's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' -e 's/$$$$INCS //g' \
130                 $(2)/bin/ncursesw5-config
131         ln -sf $(STAGING_DIR)/host/bin/ncursesw5-config $(1)/usr/bin/ncursesw5-config
132 endef
133
134 define Host/Compile
135         $(MAKE) -C $(HOST_BUILD_DIR) libs
136         $(MAKE) -C $(HOST_BUILD_DIR)/progs tic
137 endef
138
139 define Host/Install
140         $(INSTALL_BIN) $(HOST_BUILD_DIR)/progs/tic $(STAGING_DIR_HOST)/bin/tic
141 endef
142
143 $(eval $(call HostBuild))
144 $(eval $(call BuildPackage,terminfo))
145 $(eval $(call BuildPackage,libncursesw))