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