Makefile 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #
  2. # Copyright (C) 2006-2012 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.19.4
  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:=9c0cae5a0379228e7b55e5b29528df8e
  16. PKG_BUILD_DEPENDS:=BUSYBOX_USE_LIBRPC:librpc
  17. PKG_BUILD_PARALLEL:=1
  18. include $(INCLUDE_DIR)/package.mk
  19. ifeq ($(DUMP),)
  20. STAMP_CONFIGURED:=$(strip $(STAMP_CONFIGURED))_$(shell $(SH_FUNC) grep '^CONFIG_BUSYBOX_' $(TOPDIR)/.config | md5s)
  21. endif
  22. init-y :=
  23. init-$(CONFIG_BUSYBOX_CONFIG_HTTPD) += httpd
  24. init-$(CONFIG_BUSYBOX_CONFIG_CROND) += cron
  25. init-$(CONFIG_BUSYBOX_CONFIG_TELNETD) += telnet
  26. define Package/busybox
  27. SECTION:=base
  28. CATEGORY:=Base system
  29. MAINTAINER:=Nicolas Thill <[email protected]>
  30. TITLE:=Core utilities for embedded Linux
  31. URL:=http://busybox.net/
  32. DEPENDS:=+BUSYBOX_USE_LIBRPC:librpc
  33. MENU:=1
  34. endef
  35. define Package/busybox/description
  36. The Swiss Army Knife of embedded Linux.
  37. It slices, it dices, it makes Julian Fries.
  38. endef
  39. define Package/busybox/config
  40. source "$(SOURCE)/Config.in"
  41. endef
  42. define Build/Configure
  43. rm -f $(PKG_BUILD_DIR)/.configured*
  44. grep 'CONFIG_BUSYBOX_' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_\\(.*\\),\\1\\2,g" > $(PKG_BUILD_DIR)/.config
  45. yes '' | $(MAKE) -C $(PKG_BUILD_DIR) \
  46. CC="$(TARGET_CC)" \
  47. CROSS_COMPILE="$(TARGET_CROSS)" \
  48. KBUILD_HAVE_NLS=no \
  49. ARCH="$(ARCH)" \
  50. oldconfig
  51. endef
  52. ifdef CONFIG_GCC_VERSION_LLVM
  53. TARGET_CFLAGS += -fnested-functions
  54. endif
  55. LDLIBS:=m crypt
  56. ifdef CONFIG_BUSYBOX_USE_LIBRPC
  57. TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
  58. export LDFLAGS=$(TARGET_LDFLAGS)
  59. LDLIBS += rpc
  60. endif
  61. define Build/Compile
  62. $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
  63. CC="$(TARGET_CC)" \
  64. CROSS_COMPILE="$(TARGET_CROSS)" \
  65. KBUILD_HAVE_NLS=no \
  66. EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
  67. ARCH="$(ARCH)" \
  68. SKIP_STRIP=y \
  69. LDLIBS="$(LDLIBS)" \
  70. all
  71. rm -rf $(PKG_INSTALL_DIR)
  72. $(FIND) $(PKG_BUILD_DIR) -lname "*busybox" -exec rm \{\} \;
  73. $(MAKE) -C $(PKG_BUILD_DIR) \
  74. CC="$(TARGET_CC)" \
  75. CROSS_COMPILE="$(TARGET_CROSS)" \
  76. EXTRA_CFLAGS="$(TARGET_CFLAGS)" \
  77. ARCH="$(ARCH)" \
  78. CONFIG_PREFIX="$(PKG_INSTALL_DIR)" \
  79. LDLIBS="$(LDLIBS)" \
  80. install
  81. endef
  82. define Package/busybox/install
  83. $(INSTALL_DIR) $(1)/etc/init.d
  84. $(CP) $(PKG_INSTALL_DIR)/* $(1)/
  85. for tmp in $(init-y); do \
  86. $(INSTALL_BIN) ./files/$$$$tmp $(1)/etc/init.d/$$$$tmp; \
  87. done
  88. -rm -rf $(1)/lib64
  89. endef
  90. $(eval $(call BuildPackage,busybox))