2 # Copyright (C) 2006-2016 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
15 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
16 PKG_SOURCE_URL
:=https
://www.busybox.net
/downloads \
17 http
://sources.buildroot.net
18 PKG_HASH
:=3d1d04a4dbd34048f4794815a5c48ebb9eb53c5277e09ffffc060323b95dfbdc
20 PKG_BUILD_DEPENDS
:=BUSYBOX_CONFIG_PAM
:libpam
22 PKG_CHECK_FORMAT_SECURITY
:=0
24 #Busybox use it's own PIE config flag and LDFLAGS are used with ld, not gcc.
28 PKG_LICENSE_FILES
:=LICENSE archival
/libarchive
/bz
/LICENSE
29 PKG_CPE_ID
:=cpe
:/a
:busybox
:busybox
31 include $(INCLUDE_DIR
)/package.mk
34 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell grep
'^CONFIG_BUSYBOX_' $(TOPDIR
)/.config | mkhash md5
)
37 BUSYBOX_SYM
=$(if
$(CONFIG_BUSYBOX_CUSTOM
),CONFIG
,DEFAULT
)
38 BUSYBOX_IF_ENABLED
=$(if
$(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_
$(1)),$(2))
40 define Package
/busybox
43 MAINTAINER
:=Felix Fietkau
<nbd@nbd.name
>
44 TITLE
:=Core utilities for embedded Linux
45 URL
:=http
://busybox.net
/
46 DEPENDS
:=+BUSYBOX_CONFIG_PAM
:libpam
+BUSYBOX_CONFIG_NTPD
:jsonfilter
49 $(call BUSYBOX_IF_ENABLED
,FIND
, 100:/usr
/bin
/find
:/bin
/busybox
) \
50 $(call BUSYBOX_IF_ENABLED
,FLOCK
, 100:/usr
/bin
/flock
:/bin
/busybox
) \
51 $(call BUSYBOX_IF_ENABLED
,FREE
, 100:/usr
/bin
/free
:/bin
/busybox
) \
52 $(call BUSYBOX_IF_ENABLED
,IP
, 100:/sbin
/ip
:/bin
/busybox
) \
53 $(call BUSYBOX_IF_ENABLED
,KILL
, 100:/bin
/kill
:/bin
/busybox
) \
54 $(call BUSYBOX_IF_ENABLED
,PGREP
, 100:/usr
/bin
/pgrep
:/bin
/busybox
) \
55 $(call BUSYBOX_IF_ENABLED
,PKILL
, 100:/usr
/bin
/pkill
:/bin
/busybox
) \
56 $(call BUSYBOX_IF_ENABLED
,PMAP
, 100:/usr
/bin
/pmap
:/bin
/busybox
) \
57 $(call BUSYBOX_IF_ENABLED
,PS
, 100:/bin
/ps
:/bin
/busybox
) \
58 $(call BUSYBOX_IF_ENABLED
,PWDX
, 100:/usr
/bin
/pwdx
:/bin
/busybox
) \
59 $(call BUSYBOX_IF_ENABLED
,TOP
, 100:/usr
/bin
/top
:/bin
/busybox
) \
60 $(call BUSYBOX_IF_ENABLED
,UPTIME
, 100:/usr
/bin
/uptime
:/bin
/busybox
) \
61 $(call BUSYBOX_IF_ENABLED
,WATCH
, 100:/bin
/watch
:/bin
/busybox
) \
62 $(call BUSYBOX_IF_ENABLED
,WGET
, 100:/usr
/bin
/wget
:/bin
/busybox
) \
63 $(call BUSYBOX_IF_ENABLED
,XARGS
, 100:/usr
/bin
/xargs
:/bin
/busybox
) \
67 define Package
/busybox
/description
68 The Swiss Army Knife of embedded Linux.
69 It slices
, it dices
, it makes Julian Fries.
72 define Package
/busybox
/config
73 source
"$(SOURCE)/Config.in"
76 ifdef CONFIG_BUSYBOX_CONFIG_FEATURE_SYSLOG
77 define Package
/busybox
/conffiles
82 # don't create a version string containing the actual timestamp
83 export KCONFIG_NOTIMESTAMP
=1
86 ifndef CONFIG_USE_MUSL
90 LDLIBS
+= $(call BUSYBOX_IF_ENABLED
,PAM
,pam pam_misc pthread
)
91 ifeq ($(CONFIG_USE_GLIBC
),y
)
92 LDLIBS
+= $(call BUSYBOX_IF_ENABLED
,NSLOOKUP_OPENWRT
,resolv
)
95 TARGET_CFLAGS
+= -flto
96 TARGET_LDFLAGS
+= -flto
=jobserver
-fuse-linker-plugin
100 EXTRA_CFLAGS
="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
101 EXTRA_LDFLAGS
="$(TARGET_LDFLAGS)" \
105 ifneq ($(findstring c
,$(OPENWRT_VERBOSE
)),)
109 define Build
/Configure
110 grep
'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR
)/.config | sed
-e
"s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" > $(PKG_BUILD_DIR
)/.config
111 yes
'n' |
$(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_FLAGS
) oldconfig
115 $(call Build
/Compile
/Default
, \
116 CONFIG_PREFIX
="$(PKG_INSTALL_DIR)" \
121 define Package
/busybox
/install
122 $(INSTALL_DIR
) $(1)/etc
/init.d
123 $(INSTALL_DIR
) $(1)/usr
/sbin
124 $(CP
) $(PKG_INSTALL_DIR
)/* $(1)/
125 ifneq ($(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_CROND
),)
126 $(INSTALL_BIN
) .
/files
/cron
$(1)/etc
/init.d
/cron
128 ifneq ($(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_NTPD
),)
129 $(INSTALL_BIN
) .
/files
/sysntpd
$(1)/etc
/init.d
/sysntpd
130 $(INSTALL_BIN
) .
/files
/ntpd-hotplug
$(1)/usr
/sbin
/ntpd-hotplug
135 $(eval
$(call BuildPackage
,busybox
))