9fc98173f59c42695593675eb03daa6cbe73a3bd
[openwrt-10.03/.git] / package / grub / Makefile
1
2 # Copyright (C) 2006 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 PKG_CAT:=zcat
20
21 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/grub-$(PKG_VERSION)
22 PKG_TARGETS:=bin
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/grub
27   SECTION:=boot
28   DEPENDS:=@TARGET_x86
29   CATEGORY:=Boot Loaders
30   TITLE:=GRand Unified Bootloader
31   URL:=http://www.gnu.org/software/grub/
32 endef
33
34 ifeq ($(HOST_ARCH),x86_64)
35 CONFIGURE_FLAGS:= \
36         --target=$(GNU_TARGET_NAME) \
37         --host=$(GNU_TARGET_NAME) \
38         --build=$(GNU_HOST_NAME)
39 else
40 CONFIGURE_FLAGS:=
41 endif
42
43 define Build/Configure
44         (cd $(PKG_BUILD_DIR); \
45                 LDFLAGS="-static" \
46                 ./configure \
47                 $(CONFIGURE_FLAGS) \
48                 --program-prefix="" \
49                 --program-suffix="" \
50                 --prefix=/usr \
51                 --exec-prefix=/usr \
52                 --bindir=/usr/bin \
53                 --sbindir=/usr/sbin \
54                 --libexecdir=/usr/lib \
55                 --sysconfdir=/etc \
56                 --datadir=/usr/share \
57                 --localstatedir=/var \
58                 --mandir=/usr/man \
59                 --infodir=/usr/info \
60                 $(DISABLE_NLS) \
61                 --disable-auto-linux-mem-opt \
62         )
63 endef
64
65 #
66 # ./configure detects whether the host compiler supports 
67 # -fno-stack-protector but only sets STAGE2_CFLAGS accordingly
68 #
69 define Build/Compile
70         $(MAKE) -C $(PKG_BUILD_DIR) \
71                 GRUB_CFLAGS="\$$$$(STAGE2_CFLAGS)" \
72                 STAGE1_CFLAGS="\$$$$(STAGE2_CFLAGS)"
73 endef
74
75 define Build/InstallDev
76         $(MAKE) -C $(PKG_BUILD_DIR) \
77                 DESTDIR="$(STAGING_DIR_HOST)" \
78                 install
79         mv $(STAGING_DIR_HOST)/usr/sbin/grub $(STAGING_DIR_HOST)/bin
80 endef
81
82 $(eval $(call BuildPackage,grub))