[x86] grub: Natively build grub only on x86 linux hosts, cross compile everywhere...
[openwrt.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 define Build/Configure
49 (cd $(PKG_BUILD_DIR); \
50 LDFLAGS="-static" \
51 ./configure \
52 $(CONFIGURE_FLAGS) \
53 --program-prefix="" \
54 --program-suffix="" \
55 --prefix=/usr \
56 --exec-prefix=/usr \
57 --bindir=/usr/bin \
58 --sbindir=/usr/sbin \
59 --libexecdir=/usr/lib \
60 --sysconfdir=/etc \
61 --datadir=/usr/share \
62 --localstatedir=/var \
63 --mandir=/usr/man \
64 --infodir=/usr/info \
65 $(DISABLE_NLS) \
66 --disable-auto-linux-mem-opt \
67 )
68 endef
69
70 #
71 # ./configure detects whether the host compiler supports
72 # -fno-stack-protector but only sets STAGE2_CFLAGS accordingly
73 #
74 define Build/Compile
75 $(MAKE) -C $(PKG_BUILD_DIR) \
76 GRUB_CFLAGS="\$$$$(STAGE2_CFLAGS)" \
77 STAGE1_CFLAGS="\$$$$(STAGE2_CFLAGS)"
78 endef
79
80 define Build/InstallDev
81 $(MAKE) -C $(PKG_BUILD_DIR) \
82 DESTDIR="$(STAGING_DIR_HOST)" \
83 install
84 mv $(STAGING_DIR_HOST)/usr/sbin/grub $(STAGING_DIR_HOST)/bin
85 endef
86
87 $(eval $(call BuildPackage,grub))
This page took 0.04462 seconds and 5 git commands to generate.