Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-boot/grub: grub-0.97-r12.ebuild ChangeLog
Date: Thu, 31 May 2012 00:06:12
Message-Id: 20120531000601.CDA4E2004B@flycatcher.gentoo.org
1 vapier 12/05/31 00:06:01
2
3 Modified: ChangeLog
4 Added: grub-0.97-r12.ebuild
5 Log:
6 Build stage1/stage2 with -march=i[3456]86 based on target tuple to keep SSE/etc... insns from sneaking into the generated output #360513#115.
7
8 (Portage version: HEAD/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.207 sys-boot/grub/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/ChangeLog?rev=1.207&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/ChangeLog?rev=1.207&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/ChangeLog?r1=1.206&r2=1.207
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/sys-boot/grub/ChangeLog,v
20 retrieving revision 1.206
21 retrieving revision 1.207
22 diff -u -r1.206 -r1.207
23 --- ChangeLog 31 May 2012 00:01:18 -0000 1.206
24 +++ ChangeLog 31 May 2012 00:06:01 -0000 1.207
25 @@ -1,6 +1,12 @@
26 # ChangeLog for sys-boot/grub
27 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/ChangeLog,v 1.206 2012/05/31 00:01:18 vapier Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/ChangeLog,v 1.207 2012/05/31 00:06:01 vapier Exp $
30 +
31 +*grub-0.97-r12 (31 May 2012)
32 +
33 + 31 May 2012; Mike Frysinger <vapier@g.o> +grub-0.97-r12.ebuild:
34 + Build stage1/stage2 with -march=i[3456]86 based on target tuple to keep
35 + SSE/etc... insns from sneaking into the generated output #360513#115.
36
37 31 May 2012; Mike Frysinger <vapier@g.o> grub-0.97-r3.ebuild,
38 grub-0.97-r4.ebuild, grub-0.97-r5.ebuild, grub-0.97-r6.ebuild,
39
40
41
42 1.1 sys-boot/grub/grub-0.97-r12.ebuild
43
44 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/grub-0.97-r12.ebuild?rev=1.1&view=markup
45 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-boot/grub/grub-0.97-r12.ebuild?rev=1.1&content-type=text/plain
46
47 Index: grub-0.97-r12.ebuild
48 ===================================================================
49 # Copyright 1999-2012 Gentoo Foundation
50 # Distributed under the terms of the GNU General Public License v2
51 # $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-0.97-r12.ebuild,v 1.1 2012/05/31 00:06:01 vapier Exp $
52
53 # XXX: we need to review menu.lst vs grub.conf handling. We've been converting
54 # all systems to grub.conf (and symlinking menu.lst to grub.conf), but
55 # we never updated any of the source code (it still all wants menu.lst),
56 # and there is no indication that upstream is making the transition.
57
58 # If you need to roll a new grub-static distfile, here is how.
59 # - Robin H. Johnson <robbat2@g.o> - 29 Nov 2010
60 # USE='static -ncurses -netboot -custom-cflags' \
61 # GRUB_STATIC_PACKAGE_BUILDING=1 ebuild \
62 # grub-${PVR}.ebuild package && \
63 # cp -f ${PKGDIR}/${CAT}/${PF}.tbz2 ${DISTDIR}/grub-static-${PVR}.tar.bz2
64
65 inherit mount-boot eutils flag-o-matic toolchain-funcs autotools linux-info pax-utils
66
67 PATCHVER="1.14" # Should match the revision ideally
68 DESCRIPTION="GNU GRUB Legacy boot loader"
69 HOMEPAGE="http://www.gnu.org/software/grub/"
70 SRC_URI="mirror://gentoo/${P}.tar.gz
71 mirror://gnu-alpha/${PN}/${P}.tar.gz
72 mirror://gentoo/splash.xpm.gz
73 mirror://gentoo/${P}-patches-${PATCHVER}.tar.bz2"
74
75 LICENSE="GPL-2"
76 SLOT="0"
77 KEYWORDS="~amd64 ~x86 ~x86-fbsd"
78 IUSE="custom-cflags ncurses netboot static"
79
80 RDEPEND="ncurses? (
81 >=sys-libs/ncurses-5.2-r5
82 amd64? ( app-emulation/emul-linux-x86-baselibs )
83 )"
84 DEPEND="${RDEPEND}"
85
86 pkg_setup() {
87 case $(tc-arch) in
88 amd64) CONFIG_CHECK='~IA32_EMULATION' check_extra_config ;;
89 esac
90 }
91
92 src_unpack() {
93 unpack ${A}
94 cd "${S}"
95
96 # Grub will not handle a kernel larger than EXTENDED_MEMSIZE Mb as
97 # discovered in bug 160801. We can change this, however, using larger values
98 # for this variable means that Grub needs more memory to run and boot. For a
99 # kernel of size N, Grub needs (N+1)*2. Advanced users should set a custom
100 # value in make.conf, it is possible to make kernels ~16Mb in size, but it
101 # needs the kitchen sink built-in.
102 local t="custom"
103 if [[ -z ${GRUB_MAX_KERNEL_SIZE} ]] ; then
104 case $(tc-arch) in
105 amd64) GRUB_MAX_KERNEL_SIZE=9 ;;
106 x86) GRUB_MAX_KERNEL_SIZE=5 ;;
107 esac
108 t="default"
109 fi
110 einfo "Grub will support the ${t} maximum kernel size of ${GRUB_MAX_KERNEL_SIZE} Mb (GRUB_MAX_KERNEL_SIZE)"
111
112 sed -i \
113 -e "/^#define.*EXTENDED_MEMSIZE/s,3,${GRUB_MAX_KERNEL_SIZE},g" \
114 "${S}"/grub/asmstub.c \
115 || die
116
117 if [[ -n ${PATCHVER} ]] ; then
118 EPATCH_SUFFIX="patch" epatch "${WORKDIR}"/patch
119 eautoreconf
120 fi
121 }
122
123 src_compile() {
124 filter-flags -fPIE #168834
125
126 use amd64 && multilib_toolchain_setup x86
127
128 unset BLOCK_SIZE #73499
129
130 ### i686-specific code in the boot loader is a bad idea; disabling to ensure
131 ### at least some compatibility if the hard drive is moved to an older or
132 ### incompatible system.
133
134 # grub-0.95 added -fno-stack-protector detection, to disable ssp for stage2,
135 # but the objcopy's (faulty) test fails if -fstack-protector is default.
136 # create a cache telling configure that objcopy is ok, and add -C to econf
137 # to make use of the cache.
138 #
139 # CFLAGS has to be undefined running econf, else -fno-stack-protector detection fails.
140 # STAGE2_CFLAGS is not allowed to be used on emake command-line, it overwrites
141 # -fno-stack-protector detected by configure, removed from netboot's emake.
142 use custom-cflags || unset CFLAGS
143
144 export grub_cv_prog_objcopy_absolute=yes #79734
145 use static && append-ldflags -static
146
147 # Per bug 216625, the emul packages do not provide .a libs for performing
148 # suitable static linking
149 if use amd64 && use static ; then
150 if [ -z "${GRUB_STATIC_PACKAGE_BUILDING}" ]; then
151 die "You must use the grub-static package if you want a static Grub on amd64!"
152 else
153 eerror "You have set GRUB_STATIC_PACKAGE_BUILDING. This"
154 eerror "is specifically intended for building the tarballs for the"
155 eerror "grub-static package via USE='static -ncurses'."
156 eerror "All bets are now off."
157 ebeep 10
158 fi
159 fi
160
161 # build the net-bootable grub first, but only if "netboot" is set
162 if use netboot ; then
163 econf \
164 --libdir=/lib \
165 --datadir=/usr/lib/grub \
166 --exec-prefix=/ \
167 --disable-auto-linux-mem-opt \
168 --enable-diskless \
169 --enable-{3c{5{03,07,09,29,95},90x},cs89x0,davicom,depca,eepro{,100}} \
170 --enable-{epic100,exos205,ni5210,lance,ne2100,ni{50,65}10,natsemi} \
171 --enable-{ne,ns8390,wd,otulip,rtl8139,sis900,sk-g16,smc9000,tiara} \
172 --enable-{tulip,via-rhine,w89c840}
173
174 emake w89c840_o_CFLAGS="-O" || die
175
176 mv -f stage2/{nbgrub,pxegrub} "${S}"/
177 mv -f stage2/stage2 stage2/stage2.netboot
178
179 emake -j1 clean || die
180 fi
181
182 # Now build the regular grub
183 # Note that FFS and UFS2 support are broken for now - stage1_5 files too big
184 econf \
185 --libdir=/lib \
186 --datadir=/usr/lib/grub \
187 --exec-prefix=/ \
188 --disable-auto-linux-mem-opt \
189 $(use_with ncurses curses)
190
191 # sanity check due to common failure
192 use ncurses && ! grep -qs "HAVE_LIBCURSES.*1" config.h && die "USE=ncurses but curses not found"
193
194 emake || die "making regular stuff"
195 }
196
197 src_test() {
198 # non-default block size also give false pass/fails.
199 unset BLOCK_SIZE
200 emake -j1 check || die
201 }
202
203 src_install() {
204 emake DESTDIR="${D}" install || die
205 if use netboot ; then
206 exeinto /usr/lib/grub/${CHOST}
207 doexe nbgrub pxegrub stage2/stage2.netboot || die
208 fi
209
210 # bug 330745
211 pax-mark -m "${D}"/sbin/grub
212
213 dodoc AUTHORS BUGS ChangeLog NEWS README THANKS TODO
214 newdoc docs/menu.lst grub.conf.sample
215 dodoc "${FILESDIR}"/grub.conf.gentoo
216 prepalldocs
217
218 [ -n "${GRUB_STATIC_PACKAGE_BUILDING}" ] && \
219 mv \
220 "${D}"/usr/share/doc/${PF} \
221 "${D}"/usr/share/doc/grub-static-${PF/grub-}
222
223 insinto /usr/share/grub
224 doins "${DISTDIR}"/splash.xpm.gz
225 }
226
227 setup_boot_dir() {
228 local boot_dir=$1
229 local dir=${boot_dir}
230
231 mkdir -p "${dir}"
232 [[ ! -L ${dir}/boot ]] && ln -s . "${dir}/boot"
233 dir="${dir}/grub"
234 if [[ ! -e ${dir} ]] ; then
235 mkdir "${dir}" || die
236 fi
237
238 # change menu.lst to grub.conf
239 if [[ ! -e ${dir}/grub.conf ]] && [[ -e ${dir}/menu.lst ]] ; then
240 mv -f "${dir}"/menu.lst "${dir}"/grub.conf
241 ewarn
242 ewarn "*** IMPORTANT NOTE: menu.lst has been renamed to grub.conf"
243 ewarn
244 fi
245
246 if [[ ! -e ${dir}/menu.lst ]]; then
247 einfo "Linking from new grub.conf name to menu.lst"
248 ln -snf grub.conf "${dir}"/menu.lst
249 fi
250
251 if [[ -e ${dir}/stage2 ]] ; then
252 mv "${dir}"/stage2{,.old}
253 ewarn "*** IMPORTANT NOTE: you must run grub and install"
254 ewarn "the new version's stage1 to your MBR. Until you do,"
255 ewarn "stage1 and stage2 will still be the old version, but"
256 ewarn "later stages will be the new version, which could"
257 ewarn "cause problems such as an unbootable system."
258 ewarn "This means you must use either grub-install or perform"
259 ewarn "root/setup manually! For more help, see the handbook:"
260 ewarn "http://www.gentoo.org/doc/en/handbook/handbook-${ARCH}.xml?part=1&chap=10#grub-install-auto"
261 ebeep
262 fi
263
264 einfo "Copying files from /lib/grub, /usr/lib/grub and /usr/share/grub to ${dir}"
265 for x in \
266 "${ROOT}"/lib*/grub/*/* \
267 "${ROOT}"/usr/lib*/grub/*/* \
268 "${ROOT}"/usr/share/grub/* ; do
269 [[ -f ${x} ]] && cp -p "${x}" "${dir}"/
270 done
271
272 if [[ ! -e ${dir}/grub.conf ]] ; then
273 s="${ROOT}/usr/share/doc/${PF}/grub.conf.gentoo"
274 [[ -e "${s}" ]] && cat "${s}" >${dir}/grub.conf
275 [[ -e "${s}.gz" ]] && zcat "${s}.gz" >${dir}/grub.conf
276 [[ -e "${s}.bz2" ]] && bzcat "${s}.bz2" >${dir}/grub.conf
277 fi
278
279 # Per bug 218599, we support grub.conf.install for users that want to run a
280 # specific set of Grub setup commands rather than the default ones.
281 grub_config=${dir}/grub.conf.install
282 [[ -e ${grub_config} ]] || grub_config=${dir}/grub.conf
283 if [[ -e ${grub_config} ]] ; then
284 egrep \
285 -v '^[[:space:]]*(#|$|default|fallback|initrd|password|splashimage|timeout|title)' \
286 "${grub_config}" | \
287 /sbin/grub --batch \
288 --device-map="${dir}"/device.map \
289 > /dev/null
290 fi
291
292 # the grub default commands silently piss themselves if
293 # the default file does not exist ahead of time
294 if [[ ! -e ${dir}/default ]] ; then
295 grub-set-default --root-directory="${boot_dir}" default
296 fi
297 einfo "Grub has been installed to ${boot_dir} successfully."
298 }
299
300 pkg_postinst() {
301 mount-boot_mount_boot_partition
302
303 if [[ -n ${DONT_MOUNT_BOOT} ]]; then
304 elog "WARNING: you have DONT_MOUNT_BOOT in effect, so you must apply"
305 elog "the following instructions for your /boot!"
306 elog "Neglecting to do so may cause your system to fail to boot!"
307 elog
308 else
309 setup_boot_dir "${ROOT}"/boot
310 # Trailing output because if this is run from pkg_postinst, it gets mixed into
311 # the other output.
312 einfo ""
313 fi
314 elog "To interactively install grub files to another device such as a USB"
315 elog "stick, just run the following and specify the directory as prompted:"
316 elog " emerge --config =${PF}"
317 elog "Alternately, you can export GRUB_ALT_INSTALLDIR=/path/to/use to tell"
318 elog "grub where to install in a non-interactive way."
319
320 # needs to be after we call setup_boot_dir
321 mount-boot_pkg_postinst
322 }
323
324 pkg_config() {
325 local dir
326 if [ ! -d "${GRUB_ALT_INSTALLDIR}" ]; then
327 einfo "Enter the directory where you want to setup grub:"
328 read dir
329 else
330 dir="${GRUB_ALT_INSTALLDIR}"
331 fi
332 setup_boot_dir "${dir}"
333 }