2 # Copyright (C) 2006-2010 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
9 include $(INCLUDE_DIR
)/kernel.mk
15 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
16 PKG_SOURCE_URL
:=ftp
://alpha.gnu.org
/gnu
/grub
17 PKG_MD5SUM
:=cd3f3eb54446be6003156158d51f4884
19 PKG_BUILD_DEPENDS
:= grub
/host
22 include $(INCLUDE_DIR
)/host-build.mk
23 include $(INCLUDE_DIR
)/package.mk
29 TITLE
:=GRand Unified Bootloader
30 URL
:=http
://www.gnu.org
/software
/grub
/
35 MY_CONFIGURE_ARGS
+= \
36 --disable-auto-linux-mem-opt \
40 ifeq ($(HOST_OS
),FreeBSD
)
41 MY_CONFIGURE_ARGS
+= --build
=$(GNU_HOST_NAME
) --host
=$(GNU_TARGET_NAME
) --target
=$(GNU_TARGET_NAME
)
44 MY_CONFIGURE_VARS
+= \
45 grub_cv_prog_objcopy_absolute
=yes \
47 CONFIGURE_ARGS
+= $(MY_CONFIGURE_ARGS
)
49 CONFIGURE_VARS
+= $(MY_CONFIGURE_VARS
)
51 ifeq ($(HOST_OS
),Darwin
)
52 HOST_CFLAGS
+= $(call host-cc-option
,-m32
)
53 HOST_CFLAGS
+= $(call host-cc-option
,-fnested-functions
)
56 HOST_CFLAGS
+= $(call host-cc-option
,-fno-stack-protector
)
57 HOST_CFLAGS
+= $(call host-cc-option
,-U_FORTIFY_SOURCE
)
59 HOST_CONFIGURE_ARGS
+= $(MY_CONFIGURE_ARGS
) \
60 --sbindir
="$(STAGING_DIR_HOST)/bin" \
63 HOST_CONFIGURE_VARS
+= $(MY_CONFIGURE_VARS
)
66 (cd
$(HOST_BUILD_DIR
); aclocal
&& autoconf
&& automake
)
67 $(call Host
/Configure
/Default
)
70 ifeq ($(HOST_OS
),Darwin
)
72 $(MAKE
) -C
$(HOST_BUILD_DIR
)/lib
73 $(MAKE
) -C
$(HOST_BUILD_DIR
)/stage2 libgrub.a
74 $(MAKE
) -C
$(HOST_BUILD_DIR
)/grub
77 $(MAKE
) -C
$(HOST_BUILD_DIR
)/grub
install
81 define Build
/InstallDev
82 $(INSTALL_DIR
) $(1)/usr
/lib
83 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/grub
$(1)/usr
/lib
/
86 define Package
/grub
/install
87 $(INSTALL_DIR
) $(1)/usr
/bin
88 $(CP
) $(PKG_INSTALL_DIR
)/usr
/bin
/* $(1)/usr
/bin
/
89 $(INSTALL_DIR
) $(1)/usr
/lib
90 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/* $(1)/usr
/lib
/
91 $(INSTALL_DIR
) $(1)/usr
/sbin
92 $(CP
) $(PKG_INSTALL_DIR
)/usr
/sbin
/* $(1)/usr
/sbin
/
95 ifeq ($(HOST_ARCH
),x86_64
)
96 define Require
/working-gcc-m32
97 echo
'int main(int argc, char **argv) { return 0; }' | \
98 gcc
-x c
-o
$(TMP_DIR
)/a.out
- -m32
-lc
102 $(eval
$(call Require
,working-gcc-m32
, \
103 Please
install 32 bits development files.
(gcc-multilib on Debian
/Ubuntu
, gcc.i686 and libgcc.i686 on CentOS
/Fedora
/RHEL
) \
106 $(eval
$(call HostBuild
))
107 $(eval
$(call BuildPackage
,grub
))