[packages] less: update to 444, add wide variant (#8787), use PKG_INSTALL
[packages.git] / utils / less / Makefile
1 #
2 # Copyright (C) 2010-2012 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:=less
11 PKG_VERSION:=444
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://www.greenwoodsoftware.com/less
16 PKG_MD5SUM:=56f9f76ffe13f70155f47f6b3c87d421
17
18 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
19 PKG_INSTALL:=1
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/less/Default
24   SECTION:=utils
25   CATEGORY:=Utilities
26   TITLE:=Pager program similar to more
27   URL:=http://www.greenwoodsoftware.com/less/
28 endef
29
30 define Package/less/Default/description
31   Full version of GNU less utility
32 endef
33
34 define Package/less
35   $(call Package/less/Default)
36   DEPENDS:=+libncurses
37   VARIANT:=narrow
38 endef
39
40 define Package/less/description
41   $(call Package/less/Default/description)
42 endef
43
44 define Package/less-wide
45   $(call Package/less/Default)
46   TITLE+= (Unicode)
47   DEPENDS:=+libncursesw
48   VARIANT:=wide
49 endef
50
51 define Package/less-wide/description
52   $(call Package/less/Default/description)
53   This package contains the Unicode enabled version of less.
54 endef
55
56 ifeq ($(BUILD_VARIANT),narrow)
57         CONFIGURE_VARS += \
58                 ac_cv_lib_ncursesw_initscr=no           
59 endif
60
61 ifeq ($(BUILD_VARIANT),wide)
62         CONFIGURE_VARS += \
63                 ac_cv_lib_ncursesw_initscr=yes
64 endif
65
66 define Package/less/install
67         $(INSTALL_DIR) $(1)/bin
68         $(CP) $(PKG_INSTALL_DIR)/usr/bin/less $(1)/bin/less
69 endef
70
71 define Package/less/postinst
72 #!/bin/sh
73 [ -L "$${IPKG_INSTROOT}/usr/bin/less" ] && rm -f "$${IPKG_INSTROOT}/usr/bin/less"
74 exit 0
75 endef
76
77 define Package/less/postrm
78 #!/bin/sh
79 /bin/busybox less -h 2>&1 | grep -q BusyBox && ln -sf ../../bin/busybox /usr/bin/less
80 exit 0
81 endef
82
83 Package/less-wide/install = $(Package/less/install)
84 Package/less-wide/postinst = $(Package/less/postinst)
85 Package/less-wide/postrm = $(Package/less/postrm)
86
87 $(eval $(call BuildPackage,less))
88 $(eval $(call BuildPackage,less-wide))