9bfea59e626b3f663a563d66f37c44789c318975
[openwrt/openwrt.git] / package / busybox / Makefile
1 #
2 # Copyright (C) 2006-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:=busybox
11 PKG_VERSION:=1.19.4
12 PKG_RELEASE:=5
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:=9c0cae5a0379228e7b55e5b29528df8e
19
20 PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_FEATURE_HAVE_RPC: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 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
30 BB_MAKE_VERBOSE := V=1
31 else
32 BB_MAKE_VERBOSE :=
33 endif
34
35 init-y :=
36 init-$(CONFIG_BUSYBOX_CONFIG_CROND) += cron
37 init-$(CONFIG_BUSYBOX_CONFIG_TELNETD) += telnet
38
39 define Package/busybox
40 SECTION:=base
41 CATEGORY:=Base system
42 MAINTAINER:=Nicolas Thill <nico@openwrt.org>
43 TITLE:=Core utilities for embedded Linux
44 URL:=http://busybox.net/
45 DEPENDS:=+BUSYBOX_CONFIG_FEATURE_HAVE_RPC:librpc
46 MENU:=1
47 endef
48
49 define Package/busybox/description
50 The Swiss Army Knife of embedded Linux.
51 It slices, it dices, it makes Julian Fries.
52 endef
53
54 define Package/busybox/config
55 source "$(SOURCE)/Config.in"
56 endef
57
58 define Build/Configure
59 rm -f $(PKG_BUILD_DIR)/.configured*
60 grep 'CONFIG_BUSYBOX_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_\\(.*\\),\\1\\2,g" > $(PKG_BUILD_DIR)/.config
61 yes '' | $(MAKE) -C $(PKG_BUILD_DIR) \
62 CC="$(TARGET_CC)" \
63 CROSS_COMPILE="$(TARGET_CROSS)" \
64 KBUILD_HAVE_NLS=no \
65 ARCH="$(ARCH)" \
66 $(BB_MAKE_VERBOSE) \
67 oldconfig
68 endef
69
70 ifdef CONFIG_GCC_VERSION_LLVM
71 TARGET_CFLAGS += -fnested-functions
72 endif
73
74 LDLIBS:=m crypt
75 ifdef CONFIG_BUSYBOX_CONFIG_FEATURE_HAVE_RPC
76 TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
77 export LDFLAGS=$(TARGET_LDFLAGS)
78 LDLIBS += rpc
79 endif
80
81 define Build/Compile
82 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
83 CC="$(TARGET_CC)" \
84 CROSS_COMPILE="$(TARGET_CROSS)" \
85 KBUILD_HAVE_NLS=no \
86 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
87 ARCH="$(ARCH)" \
88 SKIP_STRIP=y \
89 LDLIBS="$(LDLIBS)" \
90 $(BB_MAKE_VERBOSE) \
91 all
92 rm -rf $(PKG_INSTALL_DIR)
93 $(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
94 $(MAKE) -C $(PKG_BUILD_DIR) \
95 CC="$(TARGET_CC)" \
96 CROSS_COMPILE="$(TARGET_CROSS)" \
97 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
98 ARCH="$(ARCH)" \
99 CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
100 LDLIBS="$(LDLIBS)" \
101 $(BB_MAKE_VERBOSE) \
102 install
103 endef
104
105 define Package/busybox/install
106 $(INSTALL_DIR) $(1)/etc/init.d
107 $(CP) $(PKG_INSTALL_DIR)/* $(1)/
108 for tmp in $(init-y); do \
109 $(INSTALL_BIN) ./files/$$$$tmp $(1)/etc/init.d/$$$$tmp; \
110 done
111 -rm -rf $(1)/lib64
112 endef
113
114 $(eval $(call BuildPackage,busybox))