1 # SPDX-License-Identifier: GPL-2.0-or-later
3 # Copyright (C) 2006-2021 OpenWrt.org
5 include $(TOPDIR
)/rules.mk
9 PKG_RELEASE
:=$(AUTORELEASE
)
12 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.bz2
13 PKG_SOURCE_URL
:=https
://www.busybox.net
/downloads \
14 http
://sources.buildroot.net
15 PKG_HASH
:=12cec6bd2b16d8a9446dd16130f2b92982f1819f6e1c5f5887b6db03f5660d28
17 PKG_BUILD_DEPENDS
:=BUSYBOX_CONFIG_PAM
:libpam
19 PKG_CHECK_FORMAT_SECURITY
:=0
21 #Busybox use it's own PIE config flag and LDFLAGS are used with ld, not gcc.
25 PKG_LICENSE_FILES
:=LICENSE archival
/libarchive
/bz
/LICENSE
26 PKG_CPE_ID
:=cpe
:/a
:busybox
:busybox
28 BUSYBOX_SYM
=$(if
$(CONFIG_BUSYBOX_CUSTOM
),CONFIG
,DEFAULT
)
29 BUSYBOX_IF_ENABLED
=$(if
$(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_
$(1)),$(2))
31 ifneq ($(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_FEATURE_SUID
),)
32 PKG_FILE_MODES
:=/bin
/busybox
:root
:root
:4755
35 include $(INCLUDE_DIR
)/package.mk
38 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell grep
'^CONFIG_BUSYBOX_' $(TOPDIR
)/.config |
$(MKHASH
) md5
)
41 # All files provided by busybox will serve as fallback alternatives by opkg.
42 # There should be no need to enumerate ALTERNATIVES entries here
43 define Package
/busybox
/Default
46 MAINTAINER
:=Felix Fietkau
<nbd@nbd.name
>
47 TITLE
:=Core utilities for embedded Linux
48 URL
:=http
://busybox.net
/
49 DEPENDS
:=+BUSYBOX_CONFIG_PAM
:libpam
+BUSYBOX_CONFIG_NTPD
:jsonfilter
50 USERID
:=ntp
=123:ntp
=123
53 define Package
/busybox
54 $(call Package
/busybox
/Default
)
55 CONFLICTS
:=busybox-selinux
59 define Package
/busybox-selinux
60 $(call Package
/busybox
/Default
)
61 TITLE
+= with SELinux support
62 DEPENDS
+= +libselinux
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 ifneq ($(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_FEATURE_SYSLOG
)$(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_FEATURE_SYSLOGD_CFG
),)
77 define Package
/busybox
/conffiles
/syslog
82 ifneq ($(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_CROND
),)
83 define Package
/busybox
/conffiles
/crond
88 define Package
/busybox
/conffiles
89 $(Package
/busybox
/conffiles
/syslog
)
90 $(Package
/busybox
/conffiles
/crond
)
93 Package
/busybox-selinux
/conffiles
= $(Package
/busybox
/conffiles
)
95 ifndef CONFIG_USE_MUSL
99 LDLIBS
+= $(call BUSYBOX_IF_ENABLED
,PAM
,pam pam_misc pthread
)
101 ifeq ($(BUILD_VARIANT
),selinux
)
102 LDLIBS
+= selinux sepol
105 TARGET_CFLAGS
+= -flto
106 TARGET_LDFLAGS
+= -flto
=jobserver
-fuse-linker-plugin
110 EXTRA_CFLAGS
="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
111 EXTRA_LDFLAGS
="$(TARGET_LDFLAGS)" \
115 ifneq ($(findstring c
,$(OPENWRT_VERBOSE
)),)
119 define Build
/Configure
120 rm -f
$(PKG_BUILD_DIR
)/.config
121 touch
$(PKG_BUILD_DIR
)/.config
122 ifeq ($(DEVICE_TYPE
),nas
)
123 echo
"CONFIG_HDPARM=y" >> $(PKG_BUILD_DIR
)/.config
125 ifeq ($(BUILD_VARIANT
),selinux
)
126 cat
$(TOPDIR
)/$(SOURCE
)/selinux.config
>> $(PKG_BUILD_DIR
)/.config
128 grep
'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR
)/.config | sed
-e
"s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" >> $(PKG_BUILD_DIR
)/.config
129 yes
'n' |
$(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_FLAGS
) oldconfig
133 $(call Build
/Compile
/Default
, \
134 CONFIG_PREFIX
="$(PKG_INSTALL_DIR)" \
139 define Package
/busybox
/install
140 $(INSTALL_DIR
) $(1)/etc
/init.d
141 $(INSTALL_DIR
) $(1)/usr
/sbin
142 $(CP
) $(PKG_INSTALL_DIR
)/* $(1)/
143 ifneq ($(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_FEATURE_SYSLOG
)$(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_FEATURE_SYSLOGD_CFG
),)
144 touch
$(1)/etc
/syslog.conf
146 ifneq ($(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_CROND
),)
147 $(INSTALL_BIN
) .
/files
/cron
$(1)/etc
/init.d
/cron
148 $(INSTALL_DIR
) $(1)/etc
/crontabs
150 ifneq ($(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_NTPD
),)
151 $(INSTALL_BIN
) .
/files
/sysntpd
$(1)/etc
/init.d
/sysntpd
152 $(INSTALL_BIN
) .
/files
/ntpd-hotplug
$(1)/usr
/sbin
/ntpd-hotplug
153 $(INSTALL_DIR
) $(1)/etc
/capabilities
$(1)/usr
/share
/acl.d
154 $(INSTALL_DATA
) .
/files
/ntpd.capabilities
$(1)/etc
/capabilities
/ntpd.json
155 $(INSTALL_DATA
) .
/files
/ntpd_acl.json
$(1)/usr
/share
/acl.d
/ntpd.json
160 Package
/busybox-selinux
/install = $(Package
/busybox
/install)
162 $(eval
$(call BuildPackage
,busybox
))
163 $(eval
$(call BuildPackage
,busybox-selinux
))