add mksh (based on patch from #1470)
[openwrt/svn-archive/archive.git] / utils / mksh / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME:=mksh
4 PKG_VERSION:=R29b
5 PKG_RELEASE:=1
6
7 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).cpio.gz
8 PKG_SOURCE_URL:=http://www.mirbsd.org/MirOS/dist/mir/mksh
9 PKG_MD5SUM:=a21850403bd30bab461f2fc9f9b803b8
10
11 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
12
13 include $(INCLUDE_DIR)/package.mk
14
15 # This program seems to depend on libssp, but only for GCC 4
16 GCCVER:=$(if $(DUMP),4,$(word 1,$(subst ., ,$(CONFIG_GCC_VERSION))))
17 ifeq ($(GCCVER),4)
18 DEP:=+libssp
19 else
20 DEP:=
21 endif
22
23 define Package/mksh
24 SECTION:=shells
25 CATEGORY:=Base system
26 TITLE:=mksh
27 DEPENDS:=$(DEP)
28 DESCRIPTION:=MirBSD version of ksh
29 endef
30
31 define Build/Compile
32 cd $(PKG_BUILD_DIR); \
33 CC=$(TARGET_CC) \
34 TARGET_OS=$(shell uname -s) \
35 CFLAGS="$(TARGET_CFLAGS)" \
36 CPPFLAGS="-DMKSH_SMALL=1" \
37 LDFLAGS="$(TARGET_LDFLAGS)" \
38 $(BASH) Build.sh -d -r
39 endef
40
41 define Package/mksh/install
42 $(INSTALL_DIR) $(1)/etc
43 $(INSTALL_DATA) $(PKG_BUILD_DIR)/dot.mkshrc $(1)/etc/mkshrc
44 $(INSTALL_DIR) $(1)/bin
45 $(INSTALL_BIN) $(PKG_BUILD_DIR)/mksh $(1)/bin/
46 endef
47
48 $(eval $(call BuildPackage,mksh))