harfbuzz: security bump to version 1.4.4
[buildroot-gz.git] / package / busybox / busybox.mk
blob577f2f2470aa2ffa734a55a4ce3d6f0b4af4a214
1 ################################################################################
3 # busybox
5 ################################################################################
7 BUSYBOX_VERSION = 1.26.2
8 BUSYBOX_SITE = http://www.busybox.net/downloads
9 BUSYBOX_SOURCE = busybox-$(BUSYBOX_VERSION).tar.bz2
10 BUSYBOX_LICENSE = GPLv2
11 BUSYBOX_LICENSE_FILES = LICENSE
13 define BUSYBOX_HELP_CMDS
14 @echo ' busybox-menuconfig - Run BusyBox menuconfig'
15 endef
17 BUSYBOX_CFLAGS = \
18 $(TARGET_CFLAGS)
20 BUSYBOX_LDFLAGS = \
21 $(TARGET_LDFLAGS)
23 # Link against libtirpc if available so that we can leverage its RPC
24 # support for NFS mounting with BusyBox
25 ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
26 BUSYBOX_DEPENDENCIES += libtirpc host-pkgconf
27 BUSYBOX_CFLAGS += "`$(PKG_CONFIG_HOST_BINARY) --cflags libtirpc`"
28 # Don't use LDFLAGS for -ltirpc, because LDFLAGS is used for
29 # the non-final link of modules as well.
30 BUSYBOX_CFLAGS_busybox += "`$(PKG_CONFIG_HOST_BINARY) --libs libtirpc`"
31 endif
33 BUSYBOX_BUILD_CONFIG = $(BUSYBOX_DIR)/.config
34 # Allows the build system to tweak CFLAGS
35 BUSYBOX_MAKE_ENV = \
36 $(TARGET_MAKE_ENV) \
37 CFLAGS="$(BUSYBOX_CFLAGS)" \
38 CFLAGS_busybox="$(BUSYBOX_CFLAGS_busybox)"
40 ifeq ($(BR2_REPRODUCIBLE),y)
41 BUSYBOX_MAKE_ENV += \
42 KCONFIG_NOTIMESTAMP=1
43 endif
45 BUSYBOX_MAKE_OPTS = \
46 CC="$(TARGET_CC)" \
47 ARCH=$(KERNEL_ARCH) \
48 PREFIX="$(TARGET_DIR)" \
49 EXTRA_LDFLAGS="$(BUSYBOX_LDFLAGS)" \
50 CROSS_COMPILE="$(TARGET_CROSS)" \
51 CONFIG_PREFIX="$(TARGET_DIR)" \
52 SKIP_STRIP=y
54 ifndef BUSYBOX_CONFIG_FILE
55 BUSYBOX_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG))
56 endif
58 BUSYBOX_KCONFIG_FILE = $(BUSYBOX_CONFIG_FILE)
59 BUSYBOX_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES))
60 BUSYBOX_KCONFIG_EDITORS = menuconfig xconfig gconfig
61 BUSYBOX_KCONFIG_OPTS = $(BUSYBOX_MAKE_OPTS)
63 define BUSYBOX_PERMISSIONS
64 /bin/busybox f 4755 0 0 - - - - -
65 endef
67 # If mdev will be used for device creation enable it and copy S10mdev to /etc/init.d
68 ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_MDEV),y)
69 define BUSYBOX_INSTALL_MDEV_SCRIPT
70 $(INSTALL) -D -m 0755 package/busybox/S10mdev \
71 $(TARGET_DIR)/etc/init.d/S10mdev
72 endef
73 define BUSYBOX_INSTALL_MDEV_CONF
74 $(INSTALL) -D -m 0644 package/busybox/mdev.conf \
75 $(TARGET_DIR)/etc/mdev.conf
76 endef
77 define BUSYBOX_SET_MDEV
78 $(call KCONFIG_ENABLE_OPT,CONFIG_MDEV,$(BUSYBOX_BUILD_CONFIG))
79 $(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_MDEV_CONF,$(BUSYBOX_BUILD_CONFIG))
80 $(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_MDEV_EXEC,$(BUSYBOX_BUILD_CONFIG))
81 $(call KCONFIG_ENABLE_OPT,CONFIG_FEATURE_MDEV_LOAD_FIRMWARE,$(BUSYBOX_BUILD_CONFIG))
82 endef
83 endif
85 # sha passwords need USE_BB_CRYPT_SHA
86 ifeq ($(BR2_TARGET_GENERIC_PASSWD_SHA256)$(BR2_TARGET_GENERIC_PASSWD_SHA512),y)
87 define BUSYBOX_SET_CRYPT_SHA
88 $(call KCONFIG_ENABLE_OPT,CONFIG_USE_BB_CRYPT_SHA,$(BUSYBOX_BUILD_CONFIG))
89 endef
90 endif
92 ifeq ($(BR2_USE_MMU),y)
93 define BUSYBOX_SET_MMU
94 $(call KCONFIG_DISABLE_OPT,CONFIG_NOMMU,$(BUSYBOX_BUILD_CONFIG))
95 endef
96 else
97 define BUSYBOX_SET_MMU
98 $(call KCONFIG_ENABLE_OPT,CONFIG_NOMMU,$(BUSYBOX_BUILD_CONFIG))
99 $(call KCONFIG_DISABLE_OPT,CONFIG_SWAPON,$(BUSYBOX_BUILD_CONFIG))
100 $(call KCONFIG_DISABLE_OPT,CONFIG_SWAPOFF,$(BUSYBOX_BUILD_CONFIG))
101 $(call KCONFIG_DISABLE_OPT,CONFIG_ASH,$(BUSYBOX_BUILD_CONFIG))
102 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH,$(BUSYBOX_BUILD_CONFIG))
103 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_BASH_COMPAT,$(BUSYBOX_BUILD_CONFIG))
104 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_BRACE_EXPANSION,$(BUSYBOX_BUILD_CONFIG))
105 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_HELP,$(BUSYBOX_BUILD_CONFIG))
106 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_INTERACTIVE,$(BUSYBOX_BUILD_CONFIG))
107 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_SAVEHISTORY,$(BUSYBOX_BUILD_CONFIG))
108 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_JOB,$(BUSYBOX_BUILD_CONFIG))
109 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_TICK,$(BUSYBOX_BUILD_CONFIG))
110 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_IF,$(BUSYBOX_BUILD_CONFIG))
111 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_LOOPS,$(BUSYBOX_BUILD_CONFIG))
112 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_CASE,$(BUSYBOX_BUILD_CONFIG))
113 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_FUNCTIONS,$(BUSYBOX_BUILD_CONFIG))
114 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_LOCAL,$(BUSYBOX_BUILD_CONFIG))
115 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_RANDOM_SUPPORT,$(BUSYBOX_BUILD_CONFIG))
116 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_EXPORT_N,$(BUSYBOX_BUILD_CONFIG))
117 $(call KCONFIG_ENABLE_OPT,CONFIG_HUSH_MODE_X,$(BUSYBOX_BUILD_CONFIG))
118 endef
119 endif
121 # If we're using static libs do the same for busybox
122 ifeq ($(BR2_STATIC_LIBS),y)
123 define BUSYBOX_PREFER_STATIC
124 $(call KCONFIG_ENABLE_OPT,CONFIG_STATIC,$(BUSYBOX_BUILD_CONFIG))
125 endef
126 endif
128 # Disable shadow passwords support if unsupported by the C library
129 ifeq ($(BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS),)
130 define BUSYBOX_INTERNAL_SHADOW_PASSWORDS
131 $(call KCONFIG_ENABLE_OPT,CONFIG_USE_BB_PWD_GRP,$(BUSYBOX_BUILD_CONFIG))
132 $(call KCONFIG_ENABLE_OPT,CONFIG_USE_BB_SHADOW,$(BUSYBOX_BUILD_CONFIG))
133 endef
134 endif
136 # We also need to use internal shadow password functions when using
137 # the musl C library, since some of them are not yet implemented by
138 # musl.
140 # Do not use utmp/wmtp support. wmtp support is not available in musl,
141 # and utmp support is not sufficient for Busybox.
142 ifeq ($(BR2_TOOLCHAIN_USES_MUSL),y)
143 define BUSYBOX_MUSL_TWEAKS
144 $(call KCONFIG_ENABLE_OPT,CONFIG_USE_BB_PWD_GRP,$(BUSYBOX_BUILD_CONFIG))
145 $(call KCONFIG_ENABLE_OPT,CONFIG_USE_BB_SHADOW,$(BUSYBOX_BUILD_CONFIG))
146 $(call KCONFIG_DISABLE_OPT,CONFIG_FEATURE_UTMP,$(BUSYBOX_BUILD_CONFIG))
147 $(call KCONFIG_DISABLE_OPT,CONFIG_FEATURE_WTMP,$(BUSYBOX_BUILD_CONFIG))
148 endef
149 endif
151 define BUSYBOX_INSTALL_UDHCPC_SCRIPT
152 if grep -q CONFIG_UDHCPC=y $(@D)/.config; then \
153 $(INSTALL) -m 0755 -D package/busybox/udhcpc.script \
154 $(TARGET_DIR)/usr/share/udhcpc/default.script; \
155 $(INSTALL) -m 0755 -d \
156 $(TARGET_DIR)/usr/share/udhcpc/default.script.d; \
158 endef
160 ifeq ($(BR2_INIT_BUSYBOX),y)
161 define BUSYBOX_SET_INIT
162 $(call KCONFIG_ENABLE_OPT,CONFIG_INIT,$(BUSYBOX_BUILD_CONFIG))
163 endef
164 endif
166 ifeq ($(BR2_PACKAGE_BUSYBOX_SELINUX),y)
167 BUSYBOX_DEPENDENCIES += host-pkgconf libselinux libsepol
168 define BUSYBOX_SET_SELINUX
169 $(call KCONFIG_ENABLE_OPT,CONFIG_SELINUX,$(BUSYBOX_BUILD_CONFIG))
170 $(call KCONFIG_ENABLE_OPT,CONFIG_SELINUXENABLED,$(BUSYBOX_BUILD_CONFIG))
171 endef
172 endif
174 define BUSYBOX_INSTALL_LOGGING_SCRIPT
175 if grep -q CONFIG_SYSLOGD=y $(@D)/.config; then \
176 $(INSTALL) -m 0755 -D package/busybox/S01logging \
177 $(TARGET_DIR)/etc/init.d/S01logging; \
178 else rm -f $(TARGET_DIR)/etc/init.d/S01logging; fi
179 endef
181 ifeq ($(BR2_INIT_BUSYBOX),y)
182 define BUSYBOX_INSTALL_INITTAB
183 $(INSTALL) -D -m 0644 package/busybox/inittab $(TARGET_DIR)/etc/inittab
184 endef
185 endif
187 ifeq ($(BR2_PACKAGE_BUSYBOX_WATCHDOG),y)
188 define BUSYBOX_SET_WATCHDOG
189 $(call KCONFIG_ENABLE_OPT,CONFIG_WATCHDOG,$(BUSYBOX_BUILD_CONFIG))
190 endef
191 define BUSYBOX_INSTALL_WATCHDOG_SCRIPT
192 $(INSTALL) -D -m 0755 package/busybox/S15watchdog \
193 $(TARGET_DIR)/etc/init.d/S15watchdog
194 $(SED) s/PERIOD/$(call qstrip,$(BR2_PACKAGE_BUSYBOX_WATCHDOG_PERIOD))/ \
195 $(TARGET_DIR)/etc/init.d/S15watchdog
196 endef
197 endif
199 # PAM support requires thread support in the toolchain
200 ifeq ($(BR2_PACKAGE_LINUX_PAM)$(BR2_TOOLCHAIN_HAS_THREADS),yy)
201 define BUSYBOX_LINUX_PAM
202 $(call KCONFIG_ENABLE_OPT,CONFIG_PAM,$(BUSYBOX_BUILD_CONFIG))
203 endef
204 BUSYBOX_DEPENDENCIES += linux-pam
205 endif
207 # Telnet support
208 define BUSYBOX_INSTALL_TELNET_SCRIPT
209 if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y $(@D)/.config; then \
210 $(INSTALL) -m 0755 -D package/busybox/S50telnet \
211 $(TARGET_DIR)/etc/init.d/S50telnet ; \
213 endef
215 # Enable "noclobber" in install.sh, to prevent BusyBox from overwriting any
216 # full-blown versions of apps installed by other packages with sym/hard links.
217 define BUSYBOX_NOCLOBBER_INSTALL
218 $(SED) 's/^noclobber="0"$$/noclobber="1"/' $(@D)/applets/install.sh
219 endef
221 define BUSYBOX_KCONFIG_FIXUP_CMDS
222 $(BUSYBOX_SET_MMU)
223 $(BUSYBOX_PREFER_STATIC)
224 $(BUSYBOX_SET_MDEV)
225 $(BUSYBOX_SET_CRYPT_SHA)
226 $(BUSYBOX_LINUX_PAM)
227 $(BUSYBOX_INTERNAL_SHADOW_PASSWORDS)
228 $(BUSYBOX_SET_INIT)
229 $(BUSYBOX_SET_WATCHDOG)
230 $(BUSYBOX_SET_SELINUX)
231 $(BUSYBOX_MUSL_TWEAKS)
232 endef
234 define BUSYBOX_CONFIGURE_CMDS
235 $(BUSYBOX_NOCLOBBER_INSTALL)
236 endef
238 define BUSYBOX_BUILD_CMDS
239 $(BUSYBOX_MAKE_ENV) $(MAKE) $(BUSYBOX_MAKE_OPTS) -C $(@D)
240 endef
242 define BUSYBOX_INSTALL_TARGET_CMDS
243 $(BUSYBOX_MAKE_ENV) $(MAKE) $(BUSYBOX_MAKE_OPTS) -C $(@D) install
244 $(BUSYBOX_INSTALL_INITTAB)
245 $(BUSYBOX_INSTALL_UDHCPC_SCRIPT)
246 $(BUSYBOX_INSTALL_MDEV_CONF)
247 endef
249 define BUSYBOX_INSTALL_INIT_SYSV
250 $(BUSYBOX_INSTALL_MDEV_SCRIPT)
251 $(BUSYBOX_INSTALL_LOGGING_SCRIPT)
252 $(BUSYBOX_INSTALL_WATCHDOG_SCRIPT)
253 $(BUSYBOX_INSTALL_TELNET_SCRIPT)
254 endef
256 # Checks to give errors that the user can understand
257 # Must be before we call to kconfig-package
258 ifeq ($(BR2_PACKAGE_BUSYBOX)$(BR_BUILDING),yy)
259 ifeq ($(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG)),)
260 $(error No BusyBox configuration file specified, check your BR2_PACKAGE_BUSYBOX_CONFIG setting)
261 endif
262 endif
264 $(eval $(kconfig-package))