replace lots of manual install commands with INSTALL_* variables
[packages.git] / libs / ncurses / Makefile
1
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=ncurses
12 PKG_VERSION:=5.2
13 PKG_RELEASE:=8
14
15 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=@GNU/ncurses
18 PKG_MD5SUM:=464d6a49010cf2a6eb9ce59a264d4d47
19 PKG_CAT:=zcat
20
21 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/libncurses
26   SECTION:=libs
27   CATEGORY:=Libraries
28   TITLE:=Terminal handling library
29   DESCRIPTION:=Terminal handling library
30   URL:=http://www.gnu.org/software/ncurses/
31 endef
32
33 define Build/Configure
34 endef
35
36 define Build/Compile
37         rm -rf $(PKG_INSTALL_DIR)
38         mkdir -p $(PKG_INSTALL_DIR)
39         (cd $(PKG_BUILD_DIR); rm -f config.cache; \
40                 CONFIG_SITE="" \
41                 ./configure \
42                         --target=$(GNU_HOST_NAME) \
43                         --host=$(GNU_HOST_NAME) \
44                         --build=$(GNU_HOST_NAME) \
45                         --program-prefix="" \
46                         --program-suffix="" \
47                         --prefix=/usr \
48                         --exec-prefix=/usr \
49                         --bindir=/usr/bin \
50                         --datadir=/usr/share \
51                         --includedir=/usr/include \
52                         --infodir=/usr/share/info \
53                         --libdir=/usr/lib \
54                         --libexecdir=/usr/lib \
55                         --localstatedir=/var \
56                         --mandir=/usr/share/man \
57                         --sbindir=/usr/sbin \
58                         --sysconfdir=/etc \
59                         $(DISABLE_NLS) \
60                         $(DISABLE_LARGEFILE) \
61                         --enable-echo \
62                         --enable-const \
63                         --enable-overwrite \
64                         --disable-rpath \
65                         --without-ada \
66                         --without-cxx \
67                         --without-cxx-binding \
68                         --without-debug \
69                         --without-profile \
70                         --with-progs \
71                         --with-normal \
72                         --without-shared \
73                         --with-terminfo-dirs=/usr/share/terminfo \
74                         --with-default-terminfo-dir=/usr/share/terminfo \
75         );
76         $(MAKE) -C $(PKG_BUILD_DIR) \
77                 DESTDIR="$(PKG_INSTALL_DIR)" \
78                 libs install.progs
79         (cd $(PKG_BUILD_DIR); rm -f config.cache; \
80                 $(TARGET_CONFIGURE_OPTS) \
81                 CFLAGS="$(TARGET_CFLAGS)" \
82                 CPPFLAGS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
83                 LDFLAGS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
84                 ./configure \
85                         --target=$(GNU_TARGET_NAME) \
86                         --host=$(GNU_TARGET_NAME) \
87                         --build=$(GNU_HOST_NAME) \
88                         --program-prefix="" \
89                         --program-suffix="" \
90                         --prefix=/usr \
91                         --exec-prefix=/usr \
92                         --bindir=/usr/bin \
93                         --datadir=/usr/share \
94                         --includedir=/usr/include \
95                         --infodir=/usr/share/info \
96                         --libdir=/usr/lib \
97                         --libexecdir=/usr/lib \
98                         --localstatedir=/var \
99                         --mandir=/usr/share/man \
100                         --sbindir=/usr/sbin \
101                         --sysconfdir=/etc \
102                         $(DISABLE_NLS) \
103                         $(DISABLE_LARGEFILE) \
104                         --enable-echo \
105                         --enable-const \
106                         --enable-overwrite \
107                         --disable-rpath \
108                         --without-ada \
109                         --without-cxx \
110                         --without-cxx-binding \
111                         --without-debug \
112                         --without-profile \
113                         --without-progs \
114                         --with-normal \
115                         --with-shared \
116                         --with-terminfo-dirs=/usr/share/terminfo \
117                         --with-default-terminfo-dir=/usr/share/terminfo \
118         );
119         rm -f $(PKG_BUILD_DIR)/lib/lib*
120         $(MAKE) -C $(PKG_BUILD_DIR) \
121                 $(TARGET_CONFIGURE_OPTS) \
122                 BUILD_CC="$(TARGET_CC)" \
123                 HOSTCC="$(HOSTCC)" \
124                 HOSTCCFLAGS="" \
125                 DESTDIR="$(PKG_INSTALL_DIR)" \
126                 libs install.libs install.data
127 endef
128
129 define Package/libncurses/install
130         $(INSTALL_DIR) $(1)/usr/lib
131         $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{ncurses,panel,menu}*.so.* $(1)/usr/lib/
132         $(INSTALL_DIR) $(1)/usr/share/terminfo
133         (cd $(PKG_INSTALL_DIR)/usr/share/terminfo; \
134                 for dir in ??; do \
135                         [ -d "$$$$dir" ] || continue; \
136                         mv $$$$dir $$$$(echo -ne "\x$$$$dir"); \
137                 done \
138         )
139         for file in a/ansi d/dumb l/linux r/rxvt s/screen v/vt100 v/vt102 x/xterm x/xterm-color; do \
140                 $(INSTALL_DIR) $(1)/usr/share/terminfo/`dirname $$$$file`; \
141                 $(CP) $(PKG_INSTALL_DIR)/usr/share/terminfo/$$$$file \
142                         $(1)/usr/share/terminfo/$$$$file; \
143         done
144 endef
145
146 define Build/InstallDev
147         mkdir -p $(STAGING_DIR)/usr/include
148         $(CP) $(PKG_INSTALL_DIR)/usr/include/curses.h $(STAGING_DIR)/usr/include/
149         $(CP) $(PKG_INSTALL_DIR)/usr/include/ncurses.h $(STAGING_DIR)/usr/include/
150         $(CP) $(PKG_INSTALL_DIR)/usr/include/menu.h $(STAGING_DIR)/usr/include/
151         $(CP) $(PKG_INSTALL_DIR)/usr/include/panel.h $(STAGING_DIR)/usr/include/
152         $(CP) $(PKG_INSTALL_DIR)/usr/include/term{,cap}.h $(STAGING_DIR)/usr/include/
153         $(CP) $(PKG_INSTALL_DIR)/usr/include/unctrl.h $(STAGING_DIR)/usr/include/
154         $(CP) $(PKG_INSTALL_DIR)/usr/include/form.h $(STAGING_DIR)/usr/include/
155         $(CP) $(PKG_INSTALL_DIR)/usr/include/eti.h $(STAGING_DIR)/usr/include/
156         mkdir -p $(STAGING_DIR)/usr/lib
157         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libcurses.so $(STAGING_DIR)/usr/lib/
158         $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{ncurses,panel,menu,form}.{a,so*} $(STAGING_DIR)/usr/lib/
159 endef
160
161 define Build/UninstallDev
162         rm -rf \
163                 $(STAGING_DIR)/usr/include/curses.h \
164                 $(STAGING_DIR)/usr/include/ncurses.h \
165                 $(STAGING_DIR)/usr/include/menu.h \
166                 $(STAGING_DIR)/usr/include/panel.h \
167                 $(STAGING_DIR)/usr/include/term{,cap}.h \
168                 $(STAGING_DIR)/usr/include/unctrl.h \
169                 $(STAGING_DIR)/usr/lib/libcurses.so \
170                 $(STAGING_DIR)/usr/lib/lib{ncurses,panel,menu}.{a,so*}
171 endef
172
173 $(eval $(call BuildPackage,libncurses))