Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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:=5
  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. # 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 <nbd@nbd.name>
  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_LIBRECMC,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,$(LIBRECMC_VERBOSE)),)
  72. MAKE_FLAGS += V=1
  73. endif
  74. define Build/Configure
  75. grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" > $(PKG_BUILD_DIR)/.config
  76. yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_FLAGS) oldconfig
  77. endef
  78. define Build/Compile
  79. $(call Build/Compile/Default, \
  80. CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
  81. all install \
  82. )
  83. endef
  84. define Package/busybox/install
  85. $(INSTALL_DIR) $(1)/etc/init.d
  86. $(INSTALL_DIR) $(1)/usr/sbin
  87. $(CP) $(PKG_INSTALL_DIR)/* $(1)/
  88. ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_CROND),)
  89. $(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
  90. endif
  91. ifneq ($(CONFIG_BUSYBOX_$(BUSYBOX_SYM)_NTPD),)
  92. $(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
  93. $(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
  94. endif
  95. -rm -rf $(1)/lib64
  96. endef
  97. $(eval $(call BuildPackage,busybox))