Makefile 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #
  2. # Copyright (C) 2006-2009 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. include $(INCLUDE_DIR)/kernel.mk
  9. PKG_NAME:=grub
  10. PKG_VERSION:=0.97
  11. PKG_RELEASE:=2
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  13. PKG_SOURCE_URL:=ftp://alpha.gnu.org/gnu/grub
  14. PKG_MD5SUM:=cd3f3eb54446be6003156158d51f4884
  15. PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/grub-$(PKG_VERSION)
  16. PKG_TARGETS:=bin
  17. include $(INCLUDE_DIR)/package.mk
  18. export grub_cv_prog_objcopy_absolute=yes
  19. define Package/grub
  20. SECTION:=boot
  21. DEPENDS:=@TARGET_x86
  22. CATEGORY:=Boot Loaders
  23. TITLE:=GRand Unified Bootloader
  24. URL:=http://www.gnu.org/software/grub/
  25. endef
  26. ifeq ($(HOST_OS),Linux)
  27. NATIVEGRUB-i386:=1
  28. NATIVEGRUB-i686:=1
  29. NATIVEGRUB:=$(NATIVEGRUB-$(HOST_ARCH))
  30. endif
  31. ifeq ($(NATIVEGRUB),)
  32. CONFIGURE_FLAGS:= \
  33. --target=$(GNU_TARGET_NAME) \
  34. --host=$(GNU_TARGET_NAME) \
  35. --build=$(GNU_HOST_NAME)
  36. else
  37. CONFIGURE_FLAGS:=
  38. endif
  39. ifneq ($(HOST_OS),Darwin)
  40. define Build/Configure
  41. (cd $(PKG_BUILD_DIR); \
  42. LDFLAGS="-static" \
  43. ./configure \
  44. $(CONFIGURE_FLAGS) \
  45. --program-prefix="" \
  46. --program-suffix="" \
  47. --prefix=/usr \
  48. --exec-prefix=/usr \
  49. --bindir=/usr/bin \
  50. --sbindir=/usr/sbin \
  51. --libexecdir=/usr/lib \
  52. --sysconfdir=/etc \
  53. --datadir=/usr/share \
  54. --localstatedir=/var \
  55. --mandir=/usr/man \
  56. --infodir=/usr/info \
  57. $(DISABLE_NLS) \
  58. --disable-auto-linux-mem-opt \
  59. )
  60. endef
  61. #
  62. # ./configure detects whether the host compiler supports
  63. # -fno-stack-protector but only sets STAGE2_CFLAGS accordingly
  64. #
  65. define Build/Compile
  66. $(MAKE) -C $(PKG_BUILD_DIR) \
  67. GRUB_CFLAGS="\$$$$(STAGE2_CFLAGS)" \
  68. STAGE1_CFLAGS="\$$$$(STAGE2_CFLAGS)"
  69. endef
  70. define Build/InstallDev
  71. $(MAKE) -C $(PKG_BUILD_DIR) \
  72. DESTDIR="$(STAGING_DIR_HOST)" \
  73. install
  74. mv $(STAGING_DIR_HOST)/usr/sbin/grub $(STAGING_DIR_HOST)/bin
  75. endef
  76. endif
  77. $(eval $(call BuildPackage,grub))