/[gentoo-x86]/sys-boot/grub/grub-0.97-r14.ebuild
Gentoo

Contents of /sys-boot/grub/grub-0.97-r14.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Sun Jun 14 20:36:32 2015 UTC (3 years, 6 months ago) by ulm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +2 -9 lines
[QA] Remove emul-linux-x86-* from dependencies.

(Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key 9433907D693FB5B8!)

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

  ViewVC Help
Powered by ViewVC 1.1.20