2 # Copyright (C) 2006-2020 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
:=d568681c91a85edc6710770cebc1e80e042ad74d305b5c2e6d57a5f3de3b8fbd
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 BUSYBOX_SYM
=$(if
$(CONFIG_BUSYBOX_CUSTOM
),CONFIG
,DEFAULT
)
32 BUSYBOX_IF_ENABLED
=$(if
$(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_
$(1)),$(2))
34 ifneq ($(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_FEATURE_SUID
),)
35 PKG_FILE_MODES
:=/bin
/busybox
:root
:root
:4755
38 include $(INCLUDE_DIR
)/package.mk
41 STAMP_CONFIGURED
:=$(strip $(STAMP_CONFIGURED
))_
$(shell grep
'^CONFIG_BUSYBOX_' $(TOPDIR
)/.config | mkhash md5
)
44 # All files provided by busybox will serve as fallback alternatives by opkg.
45 # There should be no need to enumerate ALTERNATIVES entries here
46 define Package
/busybox
/Default
49 MAINTAINER
:=Felix Fietkau
<nbd@nbd.name
>
50 TITLE
:=Core utilities for embedded Linux
51 URL
:=http
://busybox.net
/
52 DEPENDS
:=+BUSYBOX_CONFIG_PAM
:libpam
+BUSYBOX_CONFIG_NTPD
:jsonfilter
53 USERID
:=ntp
=123:ntp
=123
56 define Package
/busybox
57 $(call Package
/busybox
/Default
)
58 CONFLICTS
:=busybox-selinux
62 define Package
/busybox-selinux
63 $(call Package
/busybox
/Default
)
64 TITLE
+= with SELinux support
65 DEPENDS
+= +libselinux
70 define Package
/busybox
/description
71 The Swiss Army Knife of embedded Linux.
72 It slices
, it dices
, it makes Julian Fries.
75 define Package
/busybox
/config
76 source
"$(SOURCE)/Config.in"
79 ifdef CONFIG_BUSYBOX_CONFIG_FEATURE_SYSLOG
80 define Package
/busybox
/conffiles
84 Package
/busybox-selinux
/conffiles
= $(Package
/busybox
/conffiles
)
87 # don't create a version string containing the actual timestamp
88 export KCONFIG_NOTIMESTAMP
=1
91 ifndef CONFIG_USE_MUSL
95 LDLIBS
+= $(call BUSYBOX_IF_ENABLED
,PAM
,pam pam_misc pthread
)
96 ifeq ($(CONFIG_USE_GLIBC
),y
)
97 LDLIBS
+= $(call BUSYBOX_IF_ENABLED
,NSLOOKUP_OPENWRT
,resolv
)
100 ifeq ($(BUILD_VARIANT
),selinux
)
101 LDLIBS
+= selinux sepol
104 TARGET_CFLAGS
+= -flto
105 TARGET_LDFLAGS
+= -flto
=jobserver
-fuse-linker-plugin
109 EXTRA_CFLAGS
="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
110 EXTRA_LDFLAGS
="$(TARGET_LDFLAGS)" \
114 ifneq ($(findstring c
,$(OPENWRT_VERBOSE
)),)
118 define Build
/Configure
119 rm -f
$(PKG_BUILD_DIR
)/.config
120 touch
$(PKG_BUILD_DIR
)/.config
121 ifeq ($(DEVICE_TYPE
),nas
)
122 echo
"CONFIG_HDPARM=y" >> $(PKG_BUILD_DIR
)/.config
124 ifeq ($(BUILD_VARIANT
),selinux
)
125 cat
$(TOPDIR
)/$(SOURCE
)/selinux.config
>> $(PKG_BUILD_DIR
)/.config
127 grep
'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR
)/.config | sed
-e
"s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" >> $(PKG_BUILD_DIR
)/.config
128 yes
'n' |
$(MAKE
) -C
$(PKG_BUILD_DIR
) $(MAKE_FLAGS
) oldconfig
132 $(call Build
/Compile
/Default
, \
133 CONFIG_PREFIX
="$(PKG_INSTALL_DIR)" \
138 define Package
/busybox
/install
139 $(INSTALL_DIR
) $(1)/etc
/init.d
140 $(INSTALL_DIR
) $(1)/usr
/sbin
141 $(CP
) $(PKG_INSTALL_DIR
)/* $(1)/
142 ifneq ($(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_CROND
),)
143 $(INSTALL_BIN
) .
/files
/cron
$(1)/etc
/init.d
/cron
145 ifneq ($(CONFIG_BUSYBOX_
$(BUSYBOX_SYM
)_NTPD
),)
146 $(INSTALL_BIN
) .
/files
/sysntpd
$(1)/etc
/init.d
/sysntpd
147 $(INSTALL_BIN
) .
/files
/ntpd-hotplug
$(1)/usr
/sbin
/ntpd-hotplug
148 $(INSTALL_DIR
) $(1)/etc
/capabilities
$(1)/usr
/share
/acl.d
149 $(INSTALL_DATA
) .
/files
/ntpd.capabilities
$(1)/etc
/capabilities
/ntpd.json
150 $(INSTALL_DATA
) .
/files
/ntpd_acl.json
$(1)/usr
/share
/acl.d
/ntpd.json
155 Package
/busybox-selinux
/install = $(Package
/busybox
/install)
157 $(eval
$(call BuildPackage
,busybox
))
158 $(eval
$(call BuildPackage
,busybox-selinux
))