Root/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
8include $(TOPDIR)/rules.mk
9
10PKG_NAME:=busybox
11PKG_VERSION:=1.19.4
12PKG_RELEASE:=5
13PKG_FLAGS:=essential
14
15PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16PKG_SOURCE_URL:=http://www.busybox.net/downloads \
17        http://distfiles.gentoo.org/distfiles/
18PKG_MD5SUM:=9c0cae5a0379228e7b55e5b29528df8e
19
20PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_FEATURE_HAVE_RPC:librpc
21PKG_BUILD_PARALLEL:=1
22
23include $(INCLUDE_DIR)/package.mk
24
25ifeq ($(DUMP),)
26  STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | md5s)
27endif
28
29ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
30  BB_MAKE_VERBOSE := V=1
31else
32  BB_MAKE_VERBOSE :=
33endif
34
35init-y :=
36init-$(CONFIG_BUSYBOX_CONFIG_HTTPD) += httpd
37init-$(CONFIG_BUSYBOX_CONFIG_CROND) += cron
38init-$(CONFIG_BUSYBOX_CONFIG_TELNETD) += telnet
39
40define 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
48endef
49
50define Package/busybox/description
51 The Swiss Army Knife of embedded Linux.
52 It slices, it dices, it makes Julian Fries.
53endef
54
55define Package/busybox/config
56    source "$(SOURCE)/Config.in"
57endef
58
59define 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
69endef
70
71ifdef CONFIG_GCC_VERSION_LLVM
72  TARGET_CFLAGS += -fnested-functions
73endif
74
75LDLIBS:=m crypt
76ifdef CONFIG_BUSYBOX_CONFIG_FEATURE_HAVE_RPC
77  TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
78  export LDFLAGS=$(TARGET_LDFLAGS)
79  LDLIBS += rpc
80endif
81
82define 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
104endef
105
106define 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
113endef
114
115$(eval $(call BuildPackage,busybox))
116

Archive Download this file



interactive