x86: don't attempt to compile grub on darwin
[openwrt/staging/yousong.git] / package / grub / Makefile
1 #
2 # Copyright (C) 2006-2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id: Makefile 4855 2006-09-24 20:49:31Z nico $
8
9 include $(TOPDIR)/rules.mk
10 include $(INCLUDE_DIR)/kernel.mk
11
12 PKG_NAME:=grub
13 PKG_VERSION:=0.97
14 PKG_RELEASE:=1
15
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=ftp://alpha.gnu.org/gnu/grub
18 PKG_MD5SUM:=cd3f3eb54446be6003156158d51f4884
19
20 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/grub-$(PKG_VERSION)
21 PKG_TARGETS:=bin
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/grub
26 SECTION:=boot
27 DEPENDS:=@TARGET_x86
28 CATEGORY:=Boot Loaders
29 TITLE:=GRand Unified Bootloader
30 URL:=http://www.gnu.org/software/grub/
31 endef
32
33 ifeq ($(HOST_OS),Linux)
34 NATIVEGRUB-i386:=1
35 NATIVEGRUB-i686:=1
36 NATIVEGRUB:=$(NATIVEGRUB-$(HOST_ARCH))
37 endif
38
39 ifeq ($(NATIVEGRUB),)
40 CONFIGURE_FLAGS:= \
41 --target=$(GNU_TARGET_NAME) \
42 --host=$(GNU_TARGET_NAME) \
43 --build=$(GNU_HOST_NAME)
44 else
45 CONFIGURE_FLAGS:=
46 endif
47
48 ifneq ($(HOST_OS),Darwin)
49 define Build/Configure
50 (cd $(PKG_BUILD_DIR); \
51 LDFLAGS="-static" \
52 ./configure \
53 $(CONFIGURE_FLAGS) \
54 --program-prefix="" \
55 --program-suffix="" \
56 --prefix=/usr \
57 --exec-prefix=/usr \
58 --bindir=/usr/bin \
59 --sbindir=/usr/sbin \
60 --libexecdir=/usr/lib \
61 --sysconfdir=/etc \
62 --datadir=/usr/share \
63 --localstatedir=/var \
64 --mandir=/usr/man \
65 --infodir=/usr/info \
66 $(DISABLE_NLS) \
67 --disable-auto-linux-mem-opt \
68 )
69 endef
70
71 #
72 # ./configure detects whether the host compiler supports
73 # -fno-stack-protector but only sets STAGE2_CFLAGS accordingly
74 #
75 define Build/Compile
76 $(MAKE) -C $(PKG_BUILD_DIR) \
77 GRUB_CFLAGS="\$$$$(STAGE2_CFLAGS)" \
78 STAGE1_CFLAGS="\$$$$(STAGE2_CFLAGS)"
79 endef
80
81 define Build/InstallDev
82 $(MAKE) -C $(PKG_BUILD_DIR) \
83 DESTDIR="$(STAGING_DIR_HOST)" \
84 install
85 mv $(STAGING_DIR_HOST)/usr/sbin/grub $(STAGING_DIR_HOST)/bin
86 endef
87 endif
88
89 $(eval $(call BuildPackage,grub))