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