Makefile 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.30.1
  10. PKG_RELEASE:=2
  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:=3d1d04a4dbd34048f4794815a5c48ebb9eb53c5277e09ffffc060323b95dfbdc
  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. define Package/busybox
  31. SECTION:=base
  32. CATEGORY:=Base system
  33. MAINTAINER:=Felix Fietkau <[email protected]>
  34. TITLE:=Core utilities for embedded Linux
  35. URL:=http://busybox.net/
  36. DEPENDS:=+BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter
  37. MENU:=1
  38. ALTERNATIVES:=\
  39. $(call BUSYBOX_IF_ENABLED,FIND, 100:/usr/bin/find:/bin/busybox) \
  40. $(call BUSYBOX_IF_ENABLED,FLOCK, 100:/usr/bin/flock:/bin/busybox) \
  41. $(call BUSYBOX_IF_ENABLED,FREE, 100:/usr/bin/free:/bin/busybox) \
  42. $(call BUSYBOX_IF_ENABLED,IP, 100:/sbin/ip:/bin/busybox) \
  43. $(call BUSYBOX_IF_ENABLED,KILL, 100:/bin/kill:/bin/busybox) \
  44. $(call BUSYBOX_IF_ENABLED,PGREP, 100:/usr/bin/pgrep:/bin/busybox) \
  45. $(call BUSYBOX_IF_ENABLED,PKILL, 100:/usr/bin/pkill:/bin/busybox) \
  46. $(call BUSYBOX_IF_ENABLED,PMAP, 100:/usr/bin/pmap:/bin/busybox) \
  47. $(call BUSYBOX_IF_ENABLED,PS, 100:/bin/ps:/bin/busybox) \
  48. $(call BUSYBOX_IF_ENABLED,PWDX, 100:/usr/bin/pwdx:/bin/busybox) \
  49. $(call BUSYBOX_IF_ENABLED,TOP, 100:/usr/bin/top:/bin/busybox) \
  50. $(call BUSYBOX_IF_ENABLED,UPTIME, 100:/usr/bin/uptime:/bin/busybox) \
  51. $(call BUSYBOX_IF_ENABLED,WATCH, 100:/bin/watch:/bin/busybox) \
  52. $(call BUSYBOX_IF_ENABLED,WGET, 100:/usr/bin/wget:/bin/busybox) \
  53. $(call BUSYBOX_IF_ENABLED,XARGS, 100:/usr/bin/xargs:/bin/busybox) \
  54. endef
  55. define Package/busybox/description
  56. The Swiss Army Knife of embedded Linux.
  57. It slices, it dices, it makes Julian Fries.
  58. endef
  59. define Package/busybox/config
  60. source "$(SOURCE)/Config.in"
  61. endef
  62. ifdef CONFIG_BUSYBOX_CONFIG_FEATURE_SYSLOG
  63. define Package/busybox/conffiles
  64. /etc/syslog.conf
  65. endef
  66. endif
  67. # don't create a version string containing the actual timestamp
  68. export KCONFIG_NOTIMESTAMP=1
  69. ifndef CONFIG_USE_MUSL
  70. LDLIBS:=m crypt
  71. endif
  72. LDLIBS += $(call BUSYBOX_IF_ENABLED,PAM,pam pam_misc pthread)
  73. ifeq ($(CONFIG_USE_GLIBC),y)
  74. LDLIBS += $(call BUSYBOX_IF_ENABLED,NSLOOKUP_OPENWRT,resolv)
  75. endif
  76. TARGET_CFLAGS += -flto
  77. TARGET_LDFLAGS += -flto=jobserver -fuse-linker-plugin
  78. MAKE_VARS :=
  79. MAKE_FLAGS += \
  80. EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
  81. EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
  82. LDLIBS="$(LDLIBS)" \
  83. LD="$(TARGET_CC)" \
  84. SKIP_STRIP=y
  85. ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  86. MAKE_FLAGS += V=1
  87. endif
  88. define Build/Configure
  89. grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" > $(PKG_BUILD_DIR)/.config
  90. yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) oldconfig
  91. endef
  92. define Build/Compile
  93. $(call Build/Compile/Default, \
  94. CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
  95. all install \
  96. )
  97. endef
  98. define Package/busybox/install
  99. $(INSTALL_DIR) $(1)/etc/init.d
  100. $(INSTALL_DIR) $(1)/usr/sbin
  101. $(CP) $(PKG_INSTALL_DIR)/* $(1)/
  102. ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_CROND),)
  103. $(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
  104. endif
  105. ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_NTPD),)
  106. $(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
  107. $(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
  108. endif
  109. -rm -rf $(1)/lib64
  110. endef
  111. $(eval $(call BuildPackage,busybox))