Makefile 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #
  2. # Copyright (C) 2006-2015 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.23.2
  10. PKG_RELEASE:=1
  11. PKG_FLAGS:=essential
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
  13. PKG_SOURCE_URL:=http://www.busybox.net/downloads \
  14. http://distfiles.gentoo.org/distfiles/
  15. PKG_MD5SUM:=7925683d7dd105aabe9b6b618d48cc73
  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 $(SH_FUNC) grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | md5s)
  24. endif
  25. ifneq ($(findstring c,$(LIBRECMC_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@openwrt.org>
  34. TITLE:=Core utilities for embedded Linux
  35. URL:=http://busybox.net/
  36. DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc +BUSYBOX_CONFIG_PAM:libpam
  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. define Build/Configure
  48. rm -f $(PKG_BUILD_DIR)/.configured*
  49. grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" > $(PKG_BUILD_DIR)/.config
  50. yes 'n' | $(MAKE) -C $(PKG_BUILD_DIR) \
  51. CC="$(TARGET_CC)" \
  52. CROSS_COMPILE="$(TARGET_CROSS)" \
  53. KBUILD_HAVE_NLS=no \
  54. ARCH="$(ARCH)" \
  55. $(BB_MAKE_VERBOSE) \
  56. oldconfig
  57. endef
  58. LDLIBS:=m crypt
  59. ifdef CONFIG_BUSYBOX_USE_LIBRPC
  60. TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
  61. export LDFLAGS=$(TARGET_LDFLAGS)
  62. LDLIBS += rpc
  63. endif
  64. ifdef CONFIG_BUSYBOX_CONFIG_PAM
  65. TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
  66. export LDFLAGS=$(TARGET_LDFLAGS)
  67. LDLIBS += pam pam_misc pthread
  68. endif
  69. define Build/Compile
  70. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  71. CC="$(TARGET_CC)" \
  72. CROSS_COMPILE="$(TARGET_CROSS)" \
  73. KBUILD_HAVE_NLS=no \
  74. EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
  75. ARCH="$(ARCH)" \
  76. SKIP_STRIP=y \
  77. LDLIBS="$(LDLIBS)" \
  78. $(BB_MAKE_VERBOSE) \
  79. all
  80. rm -rf $(PKG_INSTALL_DIR)
  81. $(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
  82. $(MAKE) -C $(PKG_BUILD_DIR) \
  83. CC="$(TARGET_CC)" \
  84. CROSS_COMPILE="$(TARGET_CROSS)" \
  85. EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
  86. ARCH="$(ARCH)" \
  87. CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
  88. LDLIBS="$(LDLIBS)" \
  89. $(BB_MAKE_VERBOSE) \
  90. install
  91. endef
  92. define Package/busybox/install
  93. $(INSTALL_DIR) $(1)/etc/init.d
  94. $(CP) $(PKG_INSTALL_DIR)/* $(1)/
  95. $(INSTALL_BIN) ./files/cron $(1)/etc/init.d/cron
  96. $(INSTALL_BIN) ./files/telnet $(1)/etc/init.d/telnet
  97. $(INSTALL_BIN) ./files/sysntpd $(1)/etc/init.d/sysntpd
  98. $(INSTALL_BIN) ./files/ntpd-hotplug $(1)/usr/sbin/ntpd-hotplug
  99. -rm -rf $(1)/lib64
  100. endef
  101. $(eval $(call BuildPackage,busybox))