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