e3e51646c0d774a40a63f4592c8ef790ca885059
[openwrt/svn-archive/archive.git] / package / busybox / Makefile
1 #
2 # Copyright (C) 2006-2010 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.17.3
12 PKG_RELEASE:=1
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:=a2ce1a951571da8c6e0eaf75b1acef60
19
20 PKG_BUILD_PARALLEL:=1
21
22 include $(INCLUDE_DIR)/package.mk
23
24 ifeq ($(DUMP),)
25 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | md5s)
26 endif
27
28 init-y :=
29 init-$(CONFIG_BUSYBOX_CONFIG_HTTPD) += httpd
30 init-$(CONFIG_BUSYBOX_CONFIG_CROND) += cron
31 init-$(CONFIG_BUSYBOX_CONFIG_TELNETD) += telnet
32
33 define Package/busybox
34 SECTION:=base
35 CATEGORY:=Base system
36 MAINTAINER:=Nicolas Thill <nico@openwrt.org>
37 TITLE:=Core utilities for embedded Linux
38 URL:=http://busybox.net/
39 MENU:=1
40 endef
41
42 define Package/busybox/description
43 The Swiss Army Knife of embedded Linux.
44 It slices, it dices, it makes Julian Fries.
45 endef
46
47 define Package/busybox/config
48 source "$(SOURCE)/Config.in"
49 endef
50
51 define Build/Configure
52 rm -f $(PKG_BUILD_DIR)/.configured*
53 grep 'CONFIG_BUSYBOX_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_\\(.*\\),\\1\\2,g" > $(PKG_BUILD_DIR)/.config
54 yes '' | $(MAKE) -C $(PKG_BUILD_DIR) \
55 CC="$(TARGET_CC)" \
56 CROSS_COMPILE="$(TARGET_CROSS)" \
57 KBUILD_HAVE_NLS=no \
58 ARCH="$(ARCH)" \
59 oldconfig
60 endef
61
62 ifdef CONFIG_GCC_VERSION_LLVM
63 TARGET_CFLAGS += -fnested-functions
64 endif
65
66 ifdef CONFIG_GCC_VERSION_4_5_0
67 TARGET_CFLAGS += -fno-tree-pta
68 endif
69
70 define Build/Compile
71 $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
72 CC="$(TARGET_CC)" \
73 CROSS_COMPILE="$(TARGET_CROSS)" \
74 KBUILD_HAVE_NLS=no \
75 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
76 ARCH="$(ARCH)" \
77 SKIP_STRIP=y \
78 all
79 rm -rf $(PKG_INSTALL_DIR)
80 $(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
81 $(MAKE) -C $(PKG_BUILD_DIR) \
82 CC="$(TARGET_CC)" \
83 CROSS_COMPILE="$(TARGET_CROSS)" \
84 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
85 ARCH="$(ARCH)" \
86 CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
87 install
88 endef
89
90 define Package/busybox/install
91 $(INSTALL_DIR) $(1)/etc/init.d
92 $(CP) $(PKG_INSTALL_DIR)/* $(1)/
93 for tmp in $(init-y); do \
94 $(INSTALL_BIN) ./files/$$$$tmp $(1)/etc/init.d/$$$$tmp; \
95 done
96 -rm -rf $(1)/lib64
97 endef
98
99 $(eval $(call BuildPackage,busybox))