busybox: fix typo in Makefile
[openwrt/staging/dedeckeh.git] / package / utils / busybox / Makefile
1 #
2 # Copyright (C) 2006-2020 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.31.1
12 PKG_RELEASE:=3
13 PKG_FLAGS:=essential
14
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:=d0f940a72f648943c1f2211e0e3117387c31d765137d92bd8284a3fb9752a998
19
20 PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam
21 PKG_BUILD_PARALLEL:=1
22 PKG_CHECK_FORMAT_SECURITY:=0
23
24 #Busybox use it's own PIE config flag and LDFLAGS are used with ld, not gcc.
25 PKG_ASLR_PIE:=0
26
27 PKG_LICENSE:=GPL-2.0
28 PKG_LICENSE_FILES:=LICENSE archival/libarchive/bz/LICENSE
29 PKG_CPE_ID:=cpe:/a:busybox:busybox
30
31 include $(INCLUDE_DIR)/package.mk
32
33 ifeq ($(DUMP),)
34 STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | mkhash md5)
35 endif
36
37 BUSYBOX_SYM=$(if $(CONFIG_BUSYBOX_CUSTOM),CONFIG,DEFAULT)
38 BUSYBOX_IF_ENABLED=$(if $(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_$(1)),$(2))
39
40 # All files provided by busybox will serve as fallback alternatives by opkg.
41 # There should be no need to enumerate ALTERNATIVES entries here
42 define Package/busybox/Default
43 SECTION:=base
44 CATEGORY:=Base system
45 MAINTAINER:=Felix Fietkau <nbd@nbd.name>
46 TITLE:=Core utilities for embedded Linux
47 URL:=http://busybox.net/
48 DEPENDS:=+BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter
49 endef
50
51 define Package/busybox
52 $(call Package/busybox/Default)
53 CONFLICTS:=busybox-selinux
54 VARIANT:=default
55 endef
56
57 define Package/busybox-selinux
58 $(call Package/busybox/Default)
59 TITLE += with SELinux support
60 DEPENDS += +libselinux
61 VARIANT:=selinux
62 PROVIDES:=busybox
63 endef
64
65 define Package/busybox/description
66 The Swiss Army Knife of embedded Linux.
67 It slices, it dices, it makes Julian Fries.
68 endef
69
70 define Package/busybox/config
71 source "$(SOURCE)/Config.in"
72 endef
73
74 ifdef CONFIG_BUSYBOX_CONFIG_FEATURE_SYSLOG
75 define Package/busybox/conffiles
76 /etc/syslog.conf
77 endef
78
79 Package/busybox-selinux/conffiles = $(Package/busybox/conffiles)
80 endif
81
82 # don't create a version string containing the actual timestamp
83 export KCONFIG_NOTIMESTAMP=1
84
85
86 ifndef CONFIG_USE_MUSL
87 LDLIBS:=m crypt
88 endif
89
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)
93 endif
94
95 ifeq ($(BUILD_VARIANT),selinux)
96 LDLIBS += selinux sepol
97 endif
98
99 TARGET_CFLAGS += -flto
100 TARGET_LDFLAGS += -flto=jobserver -fuse-linker-plugin
101
102 MAKE_VARS :=
103 MAKE_FLAGS += \
104 EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
105 EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
106 LDLIBS="$(LDLIBS)" \
107 LD="$(TARGET_CC)" \
108 SKIP_STRIP=y
109 ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
110 MAKE_FLAGS += V=1
111 endif
112
113 define Build/Configure
114 rm -f $(PKG_BUILD_DIR)/.config
115 touch $(PKG_BUILD_DIR)/.config
116 ifeq ($(DEVICE_TYPE),nas)
117 echo "CONFIG_HDPARM=y" >> $(PKG_BUILD_DIR)/.config
118 endif
119 ifeq ($(BUILD_VARIANT),selinux)
120 cat $(TOPDIR)/$(SOURCE)/selinux.config >> $(PKG_BUILD_DIR)/.config
121 endif
122 grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" >> $(PKG_BUILD_DIR)/.config
123 yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) oldconfig
124 endef
125
126 define Build/Compile
127 $(call Build/Compile/Default, \
128 CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
129 all install \
130 )
131 endef
132
133 define Package/busybox/install
134 $(INSTALL_DIR) $(1)/etc/init.d
135 $(INSTALL_DIR) $(1)/usr/sbin
136 $(CP) $(PKG_INSTALL_DIR)/* $(1)/
137 ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_CROND),)
138 $(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
139 endif
140 ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_NTPD),)
141 $(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
142 $(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
143 endif
144 ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_FEATURE_SUID),)
145 $(INSTALL_SUID) $(PKG_INSTALL_DIR)/bin/busybox $(1)/bin/busybox
146 endif
147 -rm -rf $(1)/lib64
148 endef
149
150 Package/busybox-selinux/install = $(Package/busybox/install)
151
152 $(eval $(call BuildPackage,busybox))
153 $(eval $(call BuildPackage,busybox-selinux))