27a2801886ec1883c50c1073e9eed29d64e1849c
[openwrt/svn-archive/archive.git] / utils / mksh / Makefile
1 #
2 # Copyright (C) 2007-2011 OpenWrt.org
3 # Copyright (c) 2009 Thorsten Glaser <tg@mirbsd.org>
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=mksh
12 PKG_VERSION:=40d
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-R$(PKG_VERSION).cpio.gz
16 PKG_SOURCE_URL:=http://www.mirbsd.org/MirOS/dist/mir/mksh
17 PKG_MD5SUM:=c6428401103367730a95b99284bf47dc
18
19 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/mksh
24 SECTION:=shells
25 CATEGORY:=Base system
26 TITLE:=MirBSD Korn Shell
27 DEPENDS:=$(DEP)
28 URL:=http://mirbsd.de/mksh
29 endef
30
31 define Package/mksh/description
32 mksh is the MirBSD enhanced version of the Public Domain Korn
33 shell (pdksh), a Bourne-compatible shell which is largely si-
34 milar to the original AT&T Korn shell; mksh is the only pdksh
35 derivate currently being actively developed. It includes bug
36 fixes and feature improvements, in order to produce a modern,
37 robust shell good for interactive and especially script use.
38 mksh has UTF-8 support (in substring operations and the Emacs
39 editing mode) and, while R40d corresponds to OpenBSD 5.0-cur-
40 rent ksh (without GNU bash-like PS1 and fancy character clas-
41 ses), adheres to SUSv4 and is much more robust. The code has
42 been cleaned up and simplified, bugs fixed, standards compli-
43 ance added, and several enhancements (for extended compatibi-
44 lity to other modern shells - as well as a couple of its own)
45 are available. It has sensible defaults as usual with BSD.
46 endef
47
48 define Build/Compile
49 # -DMKSH_SMALL=1 ⇒ reduce functionality quite a lot
50 # -DMKSH_ASSUME_UTF8=0 ⇒ never automatically enable
51 # UTF-8 mode, neither use setlocale/nl_langinfo
52 # nor look at $LC_* and $LANG (not recommended)
53 # HAVE_CAN_FSTACKPROTECTORALL=0 ⇒ nuke libssp dependency
54 cd $(PKG_BUILD_DIR); \
55 CC="$(TARGET_CC)" \
56 TARGET_OS="$(shell uname -s)" \
57 CFLAGS="$(TARGET_CFLAGS)" \
58 CPPFLAGS="-DMKSH_SMALL=1 -DMKSH_ASSUME_UTF8=0 -DMKSH_GCC565048=1" \
59 HAVE_CAN_FSTACKPROTECTORALL=0 \
60 LDFLAGS="$(TARGET_LDFLAGS)" \
61 $(BASH) Build.sh -Q -r -c lto
62 endef
63
64 define Package/mksh/postinst
65 #!/bin/sh
66 grep mksh $${IPKG_INSTROOT}/etc/shells || \
67 echo "/bin/mksh" >> $${IPKG_INSTROOT}/etc/shells
68 endef
69
70 define Package/mksh/install
71 $(INSTALL_DIR) $(1)/etc
72 $(INSTALL_DATA) $(PKG_BUILD_DIR)/dot.mkshrc $(1)/etc/mkshrc
73 $(INSTALL_DIR) $(1)/bin
74 $(INSTALL_BIN) $(PKG_BUILD_DIR)/mksh $(1)/bin/
75 endef
76
77 define Package/mksh/conffiles
78 /etc/mkshrc
79 endef
80
81 $(eval $(call BuildPackage,mksh))