Makefile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. #
  2. # Copyright (C) 2006-2016 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=busybox
  9. PKG_VERSION:=1.31.1
  10. PKG_RELEASE:=1
  11. PKG_FLAGS:=essential
  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:=d0f940a72f648943c1f2211e0e3117387c31d765137d92bd8284a3fb9752a998
  16. PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam
  17. PKG_BUILD_PARALLEL:=1
  18. PKG_CHECK_FORMAT_SECURITY:=0
  19. #Busybox use it's own PIE config flag and LDFLAGS are used with ld, not gcc.
  20. PKG_ASLR_PIE:=0
  21. PKG_LICENSE:=GPL-2.0
  22. PKG_LICENSE_FILES:=LICENSE archival/libarchive/bz/LICENSE
  23. PKG_CPE_ID:=cpe:/a:busybox:busybox
  24. include $(INCLUDE_DIR)/package.mk
  25. ifeq ($(DUMP),)
  26. STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | mkhash md5)
  27. endif
  28. BUSYBOX_SYM=$(if $(CONFIG_BUSYBOX_CUSTOM),CONFIG,DEFAULT)
  29. BUSYBOX_IF_ENABLED=$(if $(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_$(1)),$(2))
  30. # All files provided by busybox will serve as fallback alternatives by opkg.
  31. # There should be no need to enumerate ALTERNATIVES entries here
  32. define Package/busybox
  33. SECTION:=base
  34. CATEGORY:=Base system
  35. MAINTAINER:=Felix Fietkau <[email protected]>
  36. TITLE:=Core utilities for embedded Linux
  37. URL:=http://busybox.net/
  38. DEPENDS:=+BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter
  39. MENU:=1
  40. endef
  41. define Package/busybox/description
  42. The Swiss Army Knife of embedded Linux.
  43. It slices, it dices, it makes Julian Fries.
  44. endef
  45. define Package/busybox/config
  46. source "$(SOURCE)/Config.in"
  47. endef
  48. ifdef CONFIG_BUSYBOX_CONFIG_FEATURE_SYSLOG
  49. define Package/busybox/conffiles
  50. /etc/syslog.conf
  51. endef
  52. endif
  53. # don't create a version string containing the actual timestamp
  54. export KCONFIG_NOTIMESTAMP=1
  55. ifndef CONFIG_USE_MUSL
  56. LDLIBS:=m crypt
  57. endif
  58. LDLIBS += $(call BUSYBOX_IF_ENABLED,PAM,pam pam_misc pthread)
  59. ifeq ($(CONFIG_USE_GLIBC),y)
  60. LDLIBS += $(call BUSYBOX_IF_ENABLED,NSLOOKUP_OPENWRT,resolv)
  61. endif
  62. TARGET_CFLAGS += -flto
  63. TARGET_LDFLAGS += -flto=jobserver -fuse-linker-plugin
  64. MAKE_VARS :=
  65. MAKE_FLAGS += \
  66. EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
  67. EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
  68. LDLIBS="$(LDLIBS)" \
  69. LD="$(TARGET_CC)" \
  70. SKIP_STRIP=y
  71. ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  72. MAKE_FLAGS += V=1
  73. endif
  74. define Build/Configure
  75. rm -f $(PKG_BUILD_DIR)/.config
  76. touch $(PKG_BUILD_DIR)/.config
  77. ifeq ($(DEVICE_TYPE),nas)
  78. echo "CONFIG_HDPARM=y" >> $(PKG_BUILD_DIR)/.config
  79. endif
  80. grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" >> $(PKG_BUILD_DIR)/.config
  81. yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) oldconfig
  82. endef
  83. define Build/Compile
  84. $(call Build/Compile/Default, \
  85. CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
  86. all install \
  87. )
  88. endef
  89. define Package/busybox/install
  90. $(INSTALL_DIR) $(1)/etc/init.d
  91. $(INSTALL_DIR) $(1)/usr/sbin
  92. $(CP) $(PKG_INSTALL_DIR)/* $(1)/
  93. ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_CROND),)
  94. $(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
  95. endif
  96. ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_NTPD),)
  97. $(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
  98. $(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
  99. endif
  100. ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_FEATURE_SUID),)
  101. $(INSTALL_SUID) $(PKG_INSTALL_DIR)/bin/busybox $(1)/bin/busybox
  102. endif
  103. -rm -rf $(1)/lib64
  104. endef
  105. $(eval $(call BuildPackage,busybox))