Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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.28.4
  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:=e3c14a3699dc7e82fed397392957afc78e37bdf25398ac38ead6e84621b2ae6a
  16. PKG_BUILD_DEPENDS:=BUSYBOX_USE_LIBRPC:librpc BUSYBOX_CONFIG_PAM:libpam
  17. PKG_BUILD_PARALLEL:=1
  18. PKG_CHECK_FORMAT_SECURITY:=0
  19. PKG_INSTALL:=1
  20. #Busybox use it's own PIE config flag and LDFLAGS are used with ld, not gcc.
  21. PKG_ASLR_PIE:=0
  22. PKG_LICENSE:=GPL-2.0
  23. PKG_LICENSE_FILES:=LICENSE archival/libarchive/bz/LICENSE
  24. PKG_CPE_ID:=cpe:/a:busybox:busybox
  25. include $(INCLUDE_DIR)/package.mk
  26. ifeq ($(DUMP),)
  27. STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | mkhash md5)
  28. endif
  29. BUSYBOX_SYM=$(if $(CONFIG_BUSYBOX_CUSTOM),CONFIG,DEFAULT)
  30. BUSYBOX_IF_ENABLED=$(if $(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_$(1)),$(2))
  31. define Package/busybox
  32. SECTION:=base
  33. CATEGORY:=Base system
  34. MAINTAINER:=Felix Fietkau <[email protected]>
  35. TITLE:=Core utilities for embedded Linux
  36. URL:=http://busybox.net/
  37. DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc +BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter
  38. MENU:=1
  39. ALTERNATIVES:=\
  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. endef
  53. define Package/busybox/description
  54. The Swiss Army Knife of embedded Linux.
  55. It slices, it dices, it makes Julian Fries.
  56. endef
  57. define Package/busybox/config
  58. source "$(SOURCE)/Config.in"
  59. endef
  60. # don't create a version string containing the actual timestamp
  61. export KCONFIG_NOTIMESTAMP=1
  62. LDLIBS:=m crypt
  63. LDLIBS += $(call BUSYBOX_IF_ENABLED,PAM,pam pam_misc pthread)
  64. ifdef CONFIG_BUSYBOX_USE_LIBRPC
  65. LDLIBS += rpc
  66. endif
  67. ifeq ($(CONFIG_USE_GLIBC),y)
  68. LDLIBS += $(call BUSYBOX_IF_ENABLED,NSLOOKUP_OPENWRT,resolv)
  69. endif
  70. MAKE_VARS :=
  71. MAKE_FLAGS += \
  72. EXTRA_CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
  73. EXTRA_LDFLAGS="$(TARGET_LDFLAGS)" \
  74. LDLIBS="$(LDLIBS)" \
  75. SKIP_STRIP=y
  76. ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  77. MAKE_FLAGS += V=1
  78. endif
  79. MAKE_INSTALL_FLAGS += CONFIG_PREFIX="$(PKG_INSTALL_DIR)"
  80. define Build/Configure
  81. grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" > $(PKG_BUILD_DIR)/.config
  82. yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) oldconfig
  83. endef
  84. define Package/busybox/install
  85. $(INSTALL_DIR) $(1)/etc/init.d
  86. $(CP) $(PKG_INSTALL_DIR)/* $(1)/
  87. ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_CROND),)
  88. $(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
  89. endif
  90. ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_NTPD),)
  91. $(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
  92. $(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
  93. endif
  94. -rm -rf $(1)/lib64
  95. endef
  96. $(eval $(call BuildPackage,busybox))