936aefdd5e6ee92644bd0e49214fb7b450b56763
[openwrt/staging/yousong.git] / package / busybox / Makefile
1 #
2 # Copyright (C) 2006-2010 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:=busybox
11 PKG_VERSION:=1.18.5
12 PKG_RELEASE:=1
13 PKG_FLAGS:=essential
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:=http://www.busybox.net/downloads \
17 http://distfiles.gentoo.org/distfiles/
18 PKG_MD5SUM:=96dd43cc7cee4017a6bf31b7da82a1f5
19
20 PKG_BUILD_DEPENDS:=BUSYBOX_USE_LIBRPC:librpc
21 PKG_BUILD_PARALLEL:=1
22
23 include $(INCLUDE_DIR)/package.mk
24
25 ifeq ($(DUMP),)
26 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | md5s)
27 endif
28
29 init-y :=
30 init-$(CONFIG_BUSYBOX_CONFIG_HTTPD) += httpd
31 init-$(CONFIG_BUSYBOX_CONFIG_CROND) += cron
32 init-$(CONFIG_BUSYBOX_CONFIG_TELNETD) += telnet
33
34 define Package/busybox
35 SECTION:=base
36 CATEGORY:=Base system
37 MAINTAINER:=Nicolas Thill <nico@openwrt.org>
38 TITLE:=Core utilities for embedded Linux
39 URL:=http://busybox.net/
40 DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc
41 MENU:=1
42 endef
43
44 define Package/busybox/description
45 The Swiss Army Knife of embedded Linux.
46 It slices, it dices, it makes Julian Fries.
47 endef
48
49 define Package/busybox/config
50 source "$(SOURCE)/Config.in"
51 endef
52
53 define Build/Configure
54 rm -f $(PKG_BUILD_DIR)/.configured*
55 grep 'CONFIG_BUSYBOX_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_\\(.*\\),\\1\\2,g" > $(PKG_BUILD_DIR)/.config
56 yes '' | $(MAKE) -C $(PKG_BUILD_DIR) \
57 CC="$(TARGET_CC)" \
58 CROSS_COMPILE="$(TARGET_CROSS)" \
59 KBUILD_HAVE_NLS=no \
60 ARCH="$(ARCH)" \
61 oldconfig
62 endef
63
64 ifdef CONFIG_GCC_VERSION_LLVM
65 TARGET_CFLAGS += -fnested-functions
66 endif
67
68 LDLIBS:=m crypt
69 ifdef CONFIG_BUSYBOX_USE_LIBRPC
70 TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
71 export LDFLAGS=$(TARGET_LDFLAGS)
72 LDLIBS += rpc
73 endif
74
75 define Build/Compile
76 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
77 CC="$(TARGET_CC)" \
78 CROSS_COMPILE="$(TARGET_CROSS)" \
79 KBUILD_HAVE_NLS=no \
80 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
81 ARCH="$(ARCH)" \
82 SKIP_STRIP=y \
83 LDLIBS="$(LDLIBS)" \
84 all
85 rm -rf $(PKG_INSTALL_DIR)
86 $(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
87 $(MAKE) -C $(PKG_BUILD_DIR) \
88 CC="$(TARGET_CC)" \
89 CROSS_COMPILE="$(TARGET_CROSS)" \
90 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
91 ARCH="$(ARCH)" \
92 CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
93 LDLIBS="$(LDLIBS)" \
94 install
95 endef
96
97 define Package/busybox/install
98 $(INSTALL_DIR) $(1)/etc/init.d
99 $(CP) $(PKG_INSTALL_DIR)/* $(1)/
100 for tmp in $(init-y); do \
101 $(INSTALL_BIN) ./files/$$$$tmp $(1)/etc/init.d/$$$$tmp; \
102 done
103 -rm -rf $(1)/lib64
104 endef
105
106 $(eval $(call BuildPackage,busybox))