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

Archive Download this file



interactive