/[gentoo-alt]/trunk/overlay/sys-boot/grub/grub-0.97-r2.ebuild
Gentoo

Contents of /trunk/overlay/sys-boot/grub/grub-0.97-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1307 - (show annotations) (download)
Thu Jul 20 01:41:48 2006 UTC (8 years, 3 months ago) by flameeyes
File size: 4995 byte(s)
Add grub with modified nxstack patch (waiting for new patchset in main tree).
1 # Copyright 1999-2006 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-0.97-r2.ebuild,v 1.6 2006/05/13 04:59:32 vapier Exp $
4
5 inherit mount-boot eutils flag-o-matic toolchain-funcs
6
7 PATCHVER="1.2"
8 DESCRIPTION="GNU GRUB Legacy boot loader"
9 HOMEPAGE="http://www.gnu.org/software/grub/"
10 SRC_URI="mirror://gentoo/${P}.tar.gz
11 ftp://alpha.gnu.org/gnu/${PN}/${P}.tar.gz
12 mirror://gentoo/splash.xpm.gz
13 mirror://gentoo/${P}-patches-${PATCHVER}.tar.bz2"
14
15 LICENSE="GPL-2"
16 SLOT="0"
17 KEYWORDS="~amd64 ~x86"
18 IUSE="static netboot custom-cflags"
19
20 RDEPEND=">=sys-libs/ncurses-5.2-r5"
21 DEPEND="${RDEPEND}
22 >=sys-devel/automake-1.7
23 >=sys-devel/autoconf-2.5"
24 PROVIDE="virtual/bootloader"
25
26 pkg_setup() {
27 if use amd64 ; then
28 ABI_ALLOW="x86"
29 ABI="x86"
30 fi
31 }
32
33 src_unpack() {
34 unpack ${A}
35 cd "${S}"
36
37 # patch breaks booting for some people #111885
38 rm "${WORKDIR}"/patch/400_*
39
40 if [[ -n ${PATCHVER} ]] ; then
41 EPATCH_SUFFIX="patch"
42 EPATCH_EXCLUDE="040_all_grub-0.96-nxstack.patch"
43 epatch "${WORKDIR}"/patch
44
45 EPATCH_EXCLUDE=""
46 # FreeBSD modified version
47 epatch "${FILESDIR}/040_all_grub-0.96-nxstack.patch"
48
49 # a bunch of patches apply to raw autotool files
50 autoconf || die "autoconf failed"
51 aclocal || die "aclocal failed"
52 automake || die "automake failed"
53 fi
54 }
55
56 src_compile() {
57 unset BLOCK_SIZE #73499
58
59 ### i686-specific code in the boot loader is a bad idea; disabling to ensure
60 ### at least some compatibility if the hard drive is moved to an older or
61 ### incompatible system.
62
63 # grub-0.95 added -fno-stack-protector detection, to disable ssp for stage2,
64 # but the objcopy's (faulty) test fails if -fstack-protector is default.
65 # create a cache telling configure that objcopy is ok, and add -C to econf
66 # to make use of the cache.
67 #
68 # CFLAGS has to be undefined running econf, else -fno-stack-protector detection fails.
69 # STAGE2_CFLAGS is not allowed to be used on emake command-line, it overwrites
70 # -fno-stack-protector detected by configure, removed from netboot's emake.
71 use custom-cflags || unset CFLAGS
72
73 export grub_cv_prog_objcopy_absolute=yes #79734
74 use static && append-ldflags -static
75
76 # build the net-bootable grub first, but only if "netboot" is set
77 if use netboot ; then
78 econf \
79 --libdir=/lib \
80 --datadir=/usr/lib/grub \
81 --exec-prefix=/ \
82 --disable-auto-linux-mem-opt \
83 --enable-diskless \
84 --enable-{3c{5{03,07,09,29,95},90x},cs89x0,davicom,depca,eepro{,100}} \
85 --enable-{epic100,exos205,ni5210,lance,ne2100,ni{50,65}10,natsemi} \
86 --enable-{ne,ns8390,wd,otulip,rtl8139,sis900,sk-g16,smc9000,tiara} \
87 --enable-{tulip,via-rhine,w89c840} || die "netboot econf failed"
88
89 emake w89c840_o_CFLAGS="-O" || die "making netboot stuff"
90
91 mv -f stage2/{nbgrub,pxegrub} "${S}"/
92 mv -f stage2/stage2 stage2/stage2.netboot
93
94 make clean || die "make clean failed"
95 fi
96
97 # Now build the regular grub
98 # Note that FFS and UFS2 support are broken for now - stage1_5 files too big
99 econf \
100 --libdir=/lib \
101 --datadir=/usr/lib/grub \
102 --exec-prefix=/ \
103 --disable-auto-linux-mem-opt || die "econf failed"
104 emake || die "making regular stuff"
105 }
106
107 src_test() {
108 # non-default block size also give false pass/fails.
109 unset BLOCK_SIZE
110 make check || die "make check failed"
111 }
112
113 src_install() {
114 make DESTDIR="${D}" install || die
115 if use netboot ; then
116 exeinto /usr/lib/grub/${CHOST}
117 doexe nbgrub pxegrub stage2/stage2.netboot || die "netboot install"
118 fi
119
120 insinto /boot/grub
121 doins "${DISTDIR}"/splash.xpm.gz
122 newins docs/menu.lst grub.conf.sample
123
124 dodoc AUTHORS BUGS ChangeLog NEWS README THANKS TODO
125 newdoc docs/menu.lst grub.conf.sample
126 }
127
128 setup_boot_dir() {
129 local dir="${1}"
130
131 [[ ! -e "${dir}" ]] && die "${dir} does not exist!"
132
133 [[ ! -e "${dir}/grub" ]] && mkdir "${dir}/grub"
134
135 # change menu.lst to grub.conf
136 if [[ ! -e "${dir}/grub/grub.conf" && -e "${dir}/grub/menu.lst" ]] ; then
137 mv -f "${dir}/grub/menu.lst ${dir}/grub/grub.conf"
138 ewarn
139 ewarn "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
140 ewarn
141 fi
142
143 if [[ ! -e "${dir}"/grub/menu.lst ]]; then
144 einfo "Linking from new grub.conf name to menu.lst"
145 ln -snf grub.conf "${dir}/grub/menu.lst"
146 fi
147
148 [[ -e "${dir}"/grub/stage2 ]] && mv "${dir}"/grub/stage2{,.old}
149
150 einfo "Copying files from /lib/grub and /usr/lib/grub to "${dir}""
151 for x in /lib*/grub/*/* /usr/lib*/grub/*/* ; do
152 [[ -f ${x} ]] && cp -p ${x} "${dir}"/grub/
153 done
154
155 if [[ -e "${dir}"/grub/grub.conf ]] ; then
156 egrep -v '^[[:space:]]*(#|$|default|fallback|splashimage|timeout|title)' "${dir}"/grub/grub.conf | \
157 /sbin/grub --batch \
158 --device-map="${dir}"/grub/device.map \
159 > /dev/null
160 fi
161 }
162
163 pkg_postinst() {
164 [[ ${ROOT} != "/" ]] && return 0
165 setup_boot_dir /boot
166 einfo "To install grub files to another device (like a usb stick), just run:"
167 einfo " emerge --config =${PF}"
168 }
169
170 pkg_config() {
171 local dir
172 einfo "Enter the directory where you want to setup grub:"
173 read dir
174 setup_boot_dir ${dir}
175 }

  ViewVC Help
Powered by ViewVC 1.1.20