Gentoo Archives: gentoo-commits

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