6a56fc57e3dddf762e1d807debd2063473eeb3cc
[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:=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 --enable-pc-files \
53 --disable-rpath \
54 --without-ada \
55 --without-debug \
56 --without-manpages \
57 --without-profile \
58 --without-progs \
59 --without-tests \
60 --disable-big-core \
61 --disable-home-terminfo \
62 --with-normal \
63 --with-shared \
64 --with-termlib \
65 --with-terminfo-dirs=/usr/share/terminfo \
66 --with-default-terminfo-dir=/usr/share/terminfo \
67 --enable-widec \
68 --with-build-cppflags=-D_GNU_SOURCE
69
70 HOST_CONFIGURE_ARGS += \
71 --without-cxx \
72 --without-cxx-binding \
73 --without-ada \
74 --without-debug \
75 --without-manpages \
76 --without-profile \
77 --without-tests \
78 --without-curses-h
79
80
81 ifeq ($(HOST_OS),FreeBSD)
82 CONFIGURE_ARGS +=
83 --with-terminfo=/usr/share/terminfo.db
84 endif
85
86 MAKE_FLAGS += \
87 BUILD_CC="$(HOSTCC)" \
88 HOSTCC="$(HOSTCC)" \
89 HOSTCCFLAGS="" \
90 PKG_CONFIG_LIBDIR=/usr/lib/pkgconfig \
91 libs
92
93 define Build/Install/Default
94 $(MAKE_VARS) \
95 $(MAKE) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) \
96 $(MAKE_INSTALL_FLAGS) \
97 $(1) install.libs install.data;
98 endef
99
100 define Package/terminfo/install
101 echo ""
102 ifneq ($(HOST_OS),FreeBSD)
103 $(INSTALL_DIR) $(1)/usr/share/terminfo
104 (cd $(PKG_INSTALL_DIR)/usr/share/terminfo; \
105 for dir in ??; do \
106 [ -d "$$$$dir" ] || continue; \
107 mv $$$$dir $$$$(echo -ne "\x$$$$dir"); \
108 done \
109 )
110 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 \
111 $(INSTALL_DIR) $(1)/usr/share/terminfo/`dirname $$$$file`; \
112 $(CP) $(PKG_INSTALL_DIR)/usr/share/terminfo/$$$$file \
113 $(1)/usr/share/terminfo/$$$$file; \
114 done
115 endif
116 endef
117
118 define Package/libncursesw/install
119 $(INSTALL_DIR) $(1)/usr/lib
120 for lib in ncurses panel menu form tinfo; do \
121 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib$$$${lib}w.so* $(1)/usr/lib/; \
122 ln -s lib$$$${lib}w.so $(1)/usr/lib/lib$$$${lib}.so; \
123 done
124 endef
125
126 define Build/InstallDev
127 $(CP) $(PKG_INSTALL_DIR)/* $(1)
128 for lib in ncurses panel menu form tinfo; do \
129 ln -s lib$$$${lib}w.so $(1)/usr/lib/lib$$$${lib}.so; \
130 done
131 $(INSTALL_DIR) $(2)/bin
132 $(CP) $(PKG_INSTALL_DIR)/usr/bin/ncursesw5-config $(2)/bin/
133 $(SED) 's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' -e 's/$$$$INCS //g' \
134 $(2)/bin/ncursesw5-config
135 ln -sf $(STAGING_DIR)/host/bin/ncursesw5-config $(1)/usr/bin/ncursesw5-config
136 endef
137
138 define Host/Compile
139 $(MAKE) -C $(HOST_BUILD_DIR) libs
140 $(MAKE) -C $(HOST_BUILD_DIR)/progs tic
141 endef
142
143 define Host/Install
144 $(INSTALL_BIN) $(HOST_BUILD_DIR)/progs/tic $(STAGING_DIR_HOST)/bin/tic
145 endef
146
147 $(eval $(call HostBuild))
148 $(eval $(call BuildPackage,terminfo))
149 $(eval $(call BuildPackage,libncursesw))