[adm5120] fix support for 2.6.38 kernel
[openwrt.git] / 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
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=grub
12 PKG_VERSION:=0.97
13 PKG_RELEASE:=3
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=ftp://alpha.gnu.org/gnu/grub
17 PKG_MD5SUM:=cd3f3eb54446be6003156158d51f4884
18
19 PKG_BUILD_DEPENDS:= grub/host
20 PKG_INSTALL:=1
21
22 include $(INCLUDE_DIR)/host-build.mk
23 include $(INCLUDE_DIR)/package.mk
24
25 define 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
32 endef
33
34
35 MY_CONFIGURE_ARGS += \
36 --disable-auto-linux-mem-opt \
37 --disable-hercules \
38 --without-curses \
39
40 MY_CONFIGURE_VARS += \
41 grub_cv_prog_objcopy_absolute=yes \
42
43 CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS)
44
45 CONFIGURE_VARS += $(MY_CONFIGURE_VARS)
46
47 ifeq ($(HOST_OS),Darwin)
48 HOST_CFLAGS += $(call host-cc-option,-m32)
49 HOST_CFLAGS += $(call host-cc-option,-fnested-functions)
50 endif
51
52 ifeq ($(HOST_OS),FreeBSD)
53 ifeq ($(HOST_ARCH),amd64)
54 HOST_CFLAGS += $(call host-cc-option,-m32)
55 HOST_CFLAGS += $(call host-cc-option,-B/usr/lib32)
56 HOST_CFLAGS += $(call host-cc-option,-L/usr/lib32)
57 endif
58 endif
59
60 HOST_CFLAGS += $(call host-cc-option,-fno-stack-protector)
61 HOST_CFLAGS += $(call host-cc-option,-U_FORTIFY_SOURCE)
62
63 HOST_CONFIGURE_ARGS += $(MY_CONFIGURE_ARGS) \
64 --sbindir="$(STAGING_DIR_HOST)/bin" \
65 --disable-graphics \
66
67 HOST_CONFIGURE_VARS += $(MY_CONFIGURE_VARS)
68
69 define Host/Configure
70 (cd $(HOST_BUILD_DIR); aclocal && autoconf && automake)
71 $(call Host/Configure/Default)
72 endef
73
74 ifeq ($(HOST_OS),Darwin)
75 define Host/Compile
76 $(MAKE) -C $(HOST_BUILD_DIR)/lib
77 $(MAKE) -C $(HOST_BUILD_DIR)/stage2 libgrub.a
78 $(MAKE) -C $(HOST_BUILD_DIR)/grub
79 endef
80 define Host/Install
81 $(MAKE) -C $(HOST_BUILD_DIR)/grub install
82 endef
83 endif
84
85 define Build/InstallDev
86 $(INSTALL_DIR) $(1)/usr/lib
87 $(CP) $(PKG_INSTALL_DIR)/usr/lib/grub $(1)/usr/lib/
88 endef
89
90 define Package/grub/install
91 $(INSTALL_DIR) $(1)/usr/bin
92 $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
93 $(INSTALL_DIR) $(1)/usr/lib
94 $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
95 $(INSTALL_DIR) $(1)/usr/sbin
96 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
97 endef
98
99 ifeq ($(HOST_ARCH),x86_64)
100 define Require/working-gcc-m32
101 echo 'int main(int argc, char **argv) { return 0; }' | \
102 gcc -x c -o $(TMP_DIR)/a.out - -m32 -lc
103 endef
104 endif
105
106 $(eval $(call Require,working-gcc-m32, \
107 Please install 32 bit development files. (gcc-multilib on Debian/Ubuntu, gcc.i686, libgcc.i686, and glibc-devel.i686 on CentOS/Fedora/RHEL) \
108 ))
109
110 $(eval $(call HostBuild))
111 $(eval $(call BuildPackage,grub))
This page took 0.045676 seconds and 5 git commands to generate.