6a55d5687c53cf9d8d07ac81168bc9177eeb0caf
[openwrt/staging/chunkeey.git] / package / utils / busybox / Makefile
1 #
2 # Copyright (C) 2006-2016 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.24.1
12 PKG_RELEASE:=2
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:=be98a40cadf84ce2d6b05fa41a275c6a
19
20 PKG_BUILD_DEPENDS:=BUSYBOX_USE_LIBRPC:librpc BUSYBOX_CONFIG_PAM:libpam
21 PKG_BUILD_PARALLEL:=1
22 PKG_CHECK_FORMAT_SECURITY:=0
23
24 PKG_LICENSE:=GPL-2.0
25 PKG_LICENSE_FILES:=LICENSE archival/libarchive/bz/LICENSE
26
27 include $(INCLUDE_DIR)/package.mk
28
29 ifeq ($(DUMP),)
30 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | md5s)
31 endif
32
33 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
34 BB_MAKE_VERBOSE := V=1
35 else
36 BB_MAKE_VERBOSE :=
37 endif
38
39 define Package/busybox
40 SECTION:=base
41 CATEGORY:=Base system
42 MAINTAINER:=Felix Fietkau <nbd@openwrt.org>
43 TITLE:=Core utilities for embedded Linux
44 URL:=http://busybox.net/
45 DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc +BUSYBOX_CONFIG_PAM:libpam
46 MENU:=1
47 endef
48
49 define Package/busybox/description
50 The Swiss Army Knife of embedded Linux.
51 It slices, it dices, it makes Julian Fries.
52 endef
53
54 define Package/busybox/config
55 source "$(SOURCE)/Config.in"
56 endef
57
58 BUSYBOX_SYM=$(if $(CONFIG_BUSYBOX_CUSTOM),CONFIG,DEFAULT)
59
60 # don't create a version string containing the actual timestamp
61 export KCONFIG_NOTIMESTAMP=1
62
63 define Build/Configure
64 rm -f $(PKG_BUILD_DIR)/.configured*
65 grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" > $(PKG_BUILD_DIR)/.config
66 yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) \
67 CC="$(TARGET_CC)" \
68 CROSS_COMPILE="$(TARGET_CROSS)" \
69 KBUILD_HAVE_NLS=no \
70 ARCH="$(ARCH)" \
71 $(BB_MAKE_VERBOSE) \
72 oldconfig
73 endef
74
75 LDLIBS:=m crypt
76 ifdef CONFIG_BUSYBOX_USE_LIBRPC
77 TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
78 export LDFLAGS=$(TARGET_LDFLAGS)
79 LDLIBS += rpc
80 endif
81
82 ifdef CONFIG_BUSYBOX_CONFIG_PAM
83 TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
84 export LDFLAGS=$(TARGET_LDFLAGS)
85 LDLIBS += pam pam_misc pthread
86 endif
87
88 define Build/Compile
89 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
90 CC="$(TARGET_CC)" \
91 CROSS_COMPILE="$(TARGET_CROSS)" \
92 KBUILD_HAVE_NLS=no \
93 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
94 ARCH="$(ARCH)" \
95 SKIP_STRIP=y \
96 LDLIBS="$(LDLIBS)" \
97 $(BB_MAKE_VERBOSE) \
98 all
99 rm -rf $(PKG_INSTALL_DIR)
100 $(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
101 $(MAKE) -C $(PKG_BUILD_DIR) \
102 CC="$(TARGET_CC)" \
103 CROSS_COMPILE="$(TARGET_CROSS)" \
104 EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
105 ARCH="$(ARCH)" \
106 CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
107 LDLIBS="$(LDLIBS)" \
108 $(BB_MAKE_VERBOSE) \
109 install
110 endef
111
112 define Package/busybox/install
113 $(INSTALL_DIR) $(1)/etc/init.d
114 $(CP) $(PKG_INSTALL_DIR)/* $(1)/
115 $(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
116 $(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
117 $(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
118 -rm -rf $(1)/lib64
119 endef
120
121 $(eval $(call BuildPackage,busybox))