1
0

Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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:=4
  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. ifdef CONFIG_BUSYBOX_DEFAULT_NSLOOKUP_LEDE
  72. ifeq ($(CONFIG_USE_GLIBC),y)
  73. LDLIBS += resolv
  74. endif
  75. endif
  76. define Build/Compile
  77. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  78. CC="$(TARGET_CC)" \
  79. CROSS_COMPILE="$(TARGET_CROSS)" \
  80. KBUILD_HAVE_NLS=no \
  81. EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
  82. ARCH="$(ARCH)" \
  83. SKIP_STRIP=y \
  84. LDLIBS="$(LDLIBS)" \
  85. $(BB_MAKE_VERBOSE) \
  86. all
  87. rm -rf $(PKG_INSTALL_DIR)
  88. $(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
  89. $(MAKE) -C $(PKG_BUILD_DIR) \
  90. CC="$(TARGET_CC)" \
  91. CROSS_COMPILE="$(TARGET_CROSS)" \
  92. EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
  93. ARCH="$(ARCH)" \
  94. CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
  95. LDLIBS="$(LDLIBS)" \
  96. $(BB_MAKE_VERBOSE) \
  97. install
  98. endef
  99. define Package/busybox/install
  100. $(INSTALL_DIR) $(1)/etc/init.d
  101. $(CP) $(PKG_INSTALL_DIR)/* $(1)/
  102. $(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
  103. $(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
  104. $(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
  105. -rm -rf $(1)/lib64
  106. endef
  107. $(eval $(call BuildPackage,busybox))