Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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.25.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:=27667e0f2328fdbd79cfd622e4453e5c57e58f781c5da97c9be337d93aa2a02e
  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_LICENSE:=GPL-2.0
  20. PKG_LICENSE_FILES:=LICENSE archival/libarchive/bz/LICENSE
  21. include $(INCLUDE_DIR)/package.mk
  22. ifeq ($(DUMP),)
  23. STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | mkhash md5)
  24. endif
  25. ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
  26. BB_MAKE_VERBOSE := V=1
  27. else
  28. BB_MAKE_VERBOSE :=
  29. endif
  30. define Package/busybox
  31. SECTION:=base
  32. CATEGORY:=Base system
  33. MAINTAINER:=Felix Fietkau <nbd@nbd.name>
  34. TITLE:=Core utilities for embedded Linux
  35. URL:=http://busybox.net/
  36. DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc +BUSYBOX_CONFIG_PAM:libpam +BUSYBOX_CONFIG_NTPD:jsonfilter
  37. MENU:=1
  38. endef
  39. define Package/busybox/description
  40. The Swiss Army Knife of embedded Linux.
  41. It slices, it dices, it makes Julian Fries.
  42. endef
  43. define Package/busybox/config
  44. source "$(SOURCE)/Config.in"
  45. endef
  46. BUSYBOX_SYM=$(if $(CONFIG_BUSYBOX_CUSTOM),CONFIG,DEFAULT)
  47. # don't create a version string containing the actual timestamp
  48. export KCONFIG_NOTIMESTAMP=1
  49. define Build/Configure
  50. rm -f $(PKG_BUILD_DIR)/.configured*
  51. grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" > $(PKG_BUILD_DIR)/.config
  52. yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) \
  53. CC="$(TARGET_CC)" \
  54. CROSS_COMPILE="$(TARGET_CROSS)" \
  55. KBUILD_HAVE_NLS=no \
  56. ARCH="$(ARCH)" \
  57. $(BB_MAKE_VERBOSE) \
  58. oldconfig
  59. endef
  60. LDLIBS:=m crypt
  61. ifdef CONFIG_BUSYBOX_USE_LIBRPC
  62. TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
  63. export LDFLAGS=$(TARGET_LDFLAGS)
  64. LDLIBS += rpc
  65. endif
  66. ifdef CONFIG_BUSYBOX_CONFIG_PAM
  67. TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
  68. export LDFLAGS=$(TARGET_LDFLAGS)
  69. LDLIBS += pam pam_misc pthread
  70. endif
  71. define Build/Compile
  72. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  73. CC="$(TARGET_CC)" \
  74. CROSS_COMPILE="$(TARGET_CROSS)" \
  75. KBUILD_HAVE_NLS=no \
  76. EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
  77. ARCH="$(ARCH)" \
  78. SKIP_STRIP=y \
  79. LDLIBS="$(LDLIBS)" \
  80. $(BB_MAKE_VERBOSE) \
  81. all
  82. rm -rf $(PKG_INSTALL_DIR)
  83. $(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
  84. $(MAKE) -C $(PKG_BUILD_DIR) \
  85. CC="$(TARGET_CC)" \
  86. CROSS_COMPILE="$(TARGET_CROSS)" \
  87. EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
  88. ARCH="$(ARCH)" \
  89. CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
  90. LDLIBS="$(LDLIBS)" \
  91. $(BB_MAKE_VERBOSE) \
  92. install
  93. endef
  94. define Package/busybox/install
  95. $(INSTALL_DIR) $(1)/etc/init.d
  96. $(CP) $(PKG_INSTALL_DIR)/* $(1)/
  97. $(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
  98. $(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
  99. $(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
  100. -rm -rf $(1)/lib64
  101. endef
  102. $(eval $(call BuildPackage,busybox))