Root/package/grub/Makefile

1#
2# Copyright (C) 2006-2010 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9include $(INCLUDE_DIR)/kernel.mk
10
11PKG_NAME:=grub
12PKG_VERSION:=0.97
13PKG_RELEASE:=3
14
15PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16PKG_SOURCE_URL:=ftp://alpha.gnu.org/gnu/grub
17PKG_MD5SUM:=cd3f3eb54446be6003156158d51f4884
18
19PKG_BUILD_DEPENDS:= grub/host
20PKG_INSTALL:=1
21
22include $(INCLUDE_DIR)/host-build.mk
23include $(INCLUDE_DIR)/package.mk
24
25define Package/grub
26  SUBMENU:=Boot Loaders
27  CATEGORY:=Utilities
28  SECTION:=utils
29  TITLE:=GRand Unified Bootloader
30  URL:=http://www.gnu.org/software/grub/
31  DEPENDS:=@TARGET_x86
32endef
33
34
35MY_CONFIGURE_ARGS += \
36    --disable-auto-linux-mem-opt \
37    --disable-hercules \
38    --without-curses \
39
40MY_CONFIGURE_VARS += \
41    grub_cv_prog_objcopy_absolute=yes \
42
43CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS)
44
45CONFIGURE_VARS += $(MY_CONFIGURE_VARS)
46
47ifeq ($(HOST_OS),Darwin)
48  HOST_CFLAGS += $(call host-cc-option,-m32)
49  HOST_CFLAGS += $(call host-cc-option,-fnested-functions)
50endif
51
52HOST_CFLAGS += $(call host-cc-option,-fno-stack-protector)
53HOST_CFLAGS += $(call host-cc-option,-U_FORTIFY_SOURCE)
54
55HOST_CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS) \
56    --sbindir="$(STAGING_DIR_HOST)/bin" \
57    --disable-graphics \
58
59HOST_CONFIGURE_VARS += $(MY_CONFIGURE_VARS)
60
61define Host/Configure
62    (cd $(HOST_BUILD_DIR); aclocal && autoconf && automake)
63    $(call Host/Configure/Default)
64endef
65
66ifeq ($(HOST_OS),Darwin)
67  define Host/Compile
68    $(MAKE) -C $(HOST_BUILD_DIR)/lib
69    $(MAKE) -C $(HOST_BUILD_DIR)/stage2 libgrub.a
70    $(MAKE) -C $(HOST_BUILD_DIR)/grub
71  endef
72  define Host/Install
73    $(MAKE) -C $(HOST_BUILD_DIR)/grub install
74  endef
75endif
76
77define Build/InstallDev
78    $(INSTALL_DIR) $(1)/usr/lib
79    $(CP) $(PKG_INSTALL_DIR)/usr/lib/grub $(1)/usr/lib/
80endef
81
82define Package/grub/install
83    $(INSTALL_DIR) $(1)/usr/bin
84    $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
85    $(INSTALL_DIR) $(1)/usr/lib
86    $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
87    $(INSTALL_DIR) $(1)/usr/sbin
88    $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
89endef
90
91ifeq ($(HOST_ARCH),x86_64)
92  define Require/working-gcc-m32
93    echo 'int main(int argc, char **argv) { return 0; }' | \
94        gcc -x c -o $(TMP_DIR)/a.out - -m32 -lc
95  endef
96endif
97
98$(eval $(call Require,working-gcc-m32, \
99    Please install 32 bits development files. (gcc-multilib on Debian/Ubuntu, gcc.i686 and libgcc.i686 on CentOS/Fedora/RHEL) \
100))
101
102$(eval $(call HostBuild))
103$(eval $(call BuildPackage,grub))
104

Archive Download this file



interactive