source: trunk/package/grub/Makefile @ 11542

Last change on this file since 11542 was 11542, checked in by agb, 8 years ago

[x86] grub: Natively build grub only on x86 linux hosts, cross compile everywhere else.

  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
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
9include $(TOPDIR)/rules.mk
10include $(INCLUDE_DIR)/kernel.mk
11
12PKG_NAME:=grub
13PKG_VERSION:=0.97
14PKG_RELEASE:=1
15
16PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17PKG_SOURCE_URL:=ftp://alpha.gnu.org/gnu/grub
18PKG_MD5SUM:=cd3f3eb54446be6003156158d51f4884
19
20PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/grub-$(PKG_VERSION)
21PKG_TARGETS:=bin
22
23include $(INCLUDE_DIR)/package.mk
24
25define 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/
31endef
32
33ifeq ($(HOST_OS),Linux)
34  NATIVEGRUB-i386:=1
35  NATIVEGRUB-i686:=1
36  NATIVEGRUB:=$(NATIVEGRUB-$(HOST_ARCH))
37endif
38
39ifeq ($(NATIVEGRUB),)
40CONFIGURE_FLAGS:= \
41        --target=$(GNU_TARGET_NAME) \
42        --host=$(GNU_TARGET_NAME) \
43        --build=$(GNU_HOST_NAME)
44else
45CONFIGURE_FLAGS:=
46endif
47
48define 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        )
68endef
69
70#
71# ./configure detects whether the host compiler supports
72# -fno-stack-protector but only sets STAGE2_CFLAGS accordingly
73#
74define Build/Compile
75        $(MAKE) -C $(PKG_BUILD_DIR) \
76                GRUB_CFLAGS="\$$$$(STAGE2_CFLAGS)" \
77                STAGE1_CFLAGS="\$$$$(STAGE2_CFLAGS)"
78endef
79
80define 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
85endef
86
87$(eval $(call BuildPackage,grub))
Note: See TracBrowser for help on using the repository browser.