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

Contents of /sys-boot/grub/grub-9999.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.88 - (hide annotations) (download)
Sat Apr 27 20:58:24 2013 UTC (5 years, 7 months ago) by floppym
Branch: MAIN
Changes since 1.87: +5 -2 lines
Refresh live ebuild.

(Portage version: 2.2.0_alpha173/cvs/Linux x86_64, signed Manifest commit with key 0BBEEA1FEA4843A4)

1 floppym 1.86 # Copyright 1999-2013 Gentoo Foundation
2 vapier 1.1 # Distributed under the terms of the GNU General Public License v2
3 floppym 1.88 # $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-2.00-r3.ebuild,v 1.1 2013/04/27 20:56:04 floppym Exp $
4 vapier 1.21
5 scarabeus 1.37 EAPI=4
6 vapier 1.1
7     if [[ ${PV} == "9999" ]] ; then
8 vapier 1.29 EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
9 flameeyes 1.45 LIVE_ECLASS="bzr"
10 vapier 1.2 SRC_URI=""
11 flameeyes 1.45 DO_AUTORECONF="true"
12 vapier 1.2 else
13 scarabeus 1.37 MY_P=${P/_/\~}
14 floppym 1.68 if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
15 floppym 1.52 SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz"
16 floppym 1.50 else
17     SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
18 scarabeus 1.37 mirror://gentoo/${MY_P}.tar.xz"
19 floppym 1.50 fi
20 floppym 1.73 KEYWORDS="~amd64 ~x86"
21 scarabeus 1.37 S=${WORKDIR}/${MY_P}
22 floppym 1.75 DO_AUTORECONF="true"
23 vapier 1.1 fi
24    
25 floppym 1.78 inherit eutils flag-o-matic multiprocessing pax-utils toolchain-funcs ${DO_AUTORECONF:+autotools} ${LIVE_ECLASS}
26 scarabeus 1.37 unset LIVE_ECLASS
27    
28 vapier 1.32 DESCRIPTION="GNU GRUB boot loader"
29 vapier 1.1 HOMEPAGE="http://www.gnu.org/software/grub/"
30    
31 vapier 1.4 LICENSE="GPL-3"
32 scarabeus 1.37 SLOT="2"
33 floppym 1.79 IUSE="custom-cflags debug device-mapper doc efiemu mount nls static sdl truetype libzfs"
34 scarabeus 1.37
35 vapier 1.47 GRUB_PLATFORMS=(
36     # everywhere:
37     emu
38     # mips only:
39     qemu-mips yeeloong
40     # amd64, x86, ppc, ppc64:
41     ieee1275
42     # amd64, x86:
43     coreboot multiboot efi-32 pc qemu
44 floppym 1.56 # amd64, ia64:
45 vapier 1.47 efi-64
46     )
47     IUSE+=" ${GRUB_PLATFORMS[@]/#/grub_platforms_}"
48 scarabeus 1.37
49 floppym 1.86 REQUIRED_USE="grub_platforms_qemu? ( truetype )
50     grub_platforms_yeeloong? ( truetype )"
51 floppym 1.71
52 scarabeus 1.37 # os-prober: Used on runtime to detect other OSes
53     # xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
54     RDEPEND="
55 floppym 1.73 app-arch/xz-utils
56 scarabeus 1.37 >=sys-libs/ncurses-5.2-r5
57 vapier 1.32 debug? (
58     sdl? ( media-libs/libsdl )
59     )
60     device-mapper? ( >=sys-fs/lvm2-2.02.45 )
61 floppym 1.50 libzfs? ( sys-fs/zfs )
62     mount? ( sys-fs/fuse )
63 floppym 1.62 truetype? (
64     media-libs/freetype
65 scarabeus 1.69 media-fonts/dejavu
66 floppym 1.62 >=media-fonts/unifont-5
67     )
68 josejx 1.64 ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
69     ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
70 floppym 1.62 "
71 vapier 1.9 DEPEND="${RDEPEND}
72 mattst88 1.35 >=dev-lang/python-2.5.2
73 scarabeus 1.37 sys-devel/flex
74 floppym 1.70 sys-devel/bison
75 floppym 1.75 sys-apps/help2man
76 flameeyes 1.45 sys-apps/texinfo
77 floppym 1.62 static? (
78     truetype? (
79     app-arch/bzip2[static-libs(+)]
80     media-libs/freetype[static-libs(+)]
81     sys-libs/zlib[static-libs(+)]
82     )
83     )
84 scarabeus 1.37 "
85 floppym 1.55 RDEPEND+="
86 floppym 1.86 kernel_linux? (
87     grub_platforms_efi-32? ( sys-boot/efibootmgr )
88     grub_platforms_efi-64? ( sys-boot/efibootmgr )
89     )
90 floppym 1.55 "
91 flameeyes 1.45 if [[ -n ${DO_AUTORECONF} ]] ; then
92 floppym 1.75 DEPEND+=" >=sys-devel/autogen-5.10"
93 floppym 1.86 fi
94     if [[ ${PV} != 9999 ]]; then
95 scarabeus 1.37 DEPEND+=" app-arch/xz-utils"
96     fi
97    
98 floppym 1.50 export STRIP_MASK="*/grub/*/*.{mod,img}"
99    
100 scarabeus 1.37 QA_EXECSTACK="
101 floppym 1.50 usr/bin/grub*
102     usr/sbin/grub*
103     usr/lib*/grub/*/*.mod
104     usr/lib*/grub/*/kernel.exec
105     usr/lib*/grub/*/kernel.img
106     usr/lib*/grub/*/setjmp.module
107 scarabeus 1.37 "
108    
109 scarabeus 1.41 QA_WX_LOAD="
110 floppym 1.50 usr/lib*/grub/*/kernel.exec
111     usr/lib*/grub/*/kernel.img
112     usr/lib*/grub/*/*.image
113     "
114    
115     QA_PRESTRIPPED="
116     usr/lib.*/grub/.*/kernel.img
117 scarabeus 1.41 "
118    
119 scarabeus 1.37 grub_run_phase() {
120     local phase=$1
121     local platform=$2
122     [[ -z ${phase} || -z ${platform} ]] && die "${FUNCNAME} [phase] [platform]"
123    
124     [[ -d "${WORKDIR}/build-${platform}" ]] || \
125     { mkdir "${WORKDIR}/build-${platform}" || die ; }
126     pushd "${WORKDIR}/build-${platform}" > /dev/null || die
127    
128     echo ">>> Running ${phase} for platform \"${platform}\""
129     echo ">>> Working in: \"${WORKDIR}/build-${platform}\""
130 vapier 1.1
131 scarabeus 1.37 grub_${phase} ${platform}
132    
133     popd > /dev/null || die
134     }
135    
136     grub_src_configure() {
137     local platform=$1
138 floppym 1.56 local with_platform=
139 floppym 1.68 local enable_efiemu="--disable-efiemu"
140 scarabeus 1.37
141     [[ -z ${platform} ]] && die "${FUNCNAME} [platform]"
142    
143 floppym 1.58 # Used below for efi cross-building
144     tc-export CC NM OBJCOPY STRIP
145 floppym 1.59
146     estack_push CTARGET "${CTARGET}"
147     estack_push TARGET_CC "${TARGET_CC}"
148     estack_push TARGET_CFLAGS "${TARGET_CFLAGS}"
149     estack_push TARGET_CPPFLAGS "${TARGET_CPPFLAGS}"
150 scarabeus 1.37
151 floppym 1.56 case ${platform} in
152 floppym 1.58 efi-32)
153     if [[ ${CHOST} == x86_64* ]]; then
154 floppym 1.59 CTARGET="${CTARGET:-i386}"
155     TARGET_CC="${TARGET_CC:-${CC}}"
156     export TARGET_CC
157 floppym 1.58 fi
158     with_platform="--with-platform=efi"
159     ;;
160     efi-64)
161     if [[ ${CHOST} == i?86* ]]; then
162 floppym 1.59 CTARGET="${CTARGET:-x86_64}"
163     TARGET_CC="${TARGET_CC:-${CC}}"
164     TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
165     TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
166     export TARGET_CC TARGET_CFLAGS TARGET_CPPFLAGS
167 floppym 1.58 fi
168     with_platform="--with-platform=efi"
169     ;;
170 floppym 1.56 guessed) ;;
171 floppym 1.68 *)
172     with_platform="--with-platform=${platform}"
173     case ${CTARGET:-${CHOST}} in
174     i?86*|x86_64*)
175     enable_efiemu=$(use_enable efiemu)
176     ;;
177     esac
178     ;;
179 floppym 1.56 esac
180 mr_bones_ 1.57
181 floppym 1.50 ECONF_SOURCE="${S}" \
182 scarabeus 1.37 econf \
183 floppym 1.82 --libdir=/usr/lib \
184 floppym 1.79 --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
185 scarabeus 1.37 --disable-werror \
186 floppym 1.56 --program-prefix= \
187 floppym 1.54 --program-transform-name="s,grub,grub2," \
188 floppym 1.50 --with-grubdir=grub2 \
189 floppym 1.56 ${with_platform} \
190 scarabeus 1.38 $(use_enable debug mm-debug) \
191     $(use_enable debug grub-emu-usb) \
192 scarabeus 1.37 $(use_enable device-mapper) \
193 floppym 1.68 ${enable_efiemu} \
194 floppym 1.50 $(use_enable mount grub-mount) \
195 scarabeus 1.38 $(use_enable nls) \
196 scarabeus 1.37 $(use_enable truetype grub-mkfont) \
197 floppym 1.50 $(use_enable libzfs) \
198 floppym 1.56 $(use sdl && use_enable debug grub-emu-sdl)
199 floppym 1.59
200     estack_pop CTARGET CTARGET || die
201     estack_pop TARGET_CC TARGET_CC || die
202     estack_pop TARGET_CFLAGS TARGET_CFLAGS || die
203     estack_pop TARGET_CPPFLAGS TARGET_CPPFLAGS || die
204 scarabeus 1.37 }
205    
206     grub_src_compile() {
207     default_src_compile
208 floppym 1.50 pax-mark -mpes "${grub_binaries[@]}"
209 scarabeus 1.37 }
210    
211 floppym 1.79 grub_build_docs() {
212     emake -C docs html
213     }
214    
215 scarabeus 1.37 grub_src_install() {
216     default_src_install
217     }
218 vapier 1.1
219 floppym 1.79 grub_install_docs() {
220     emake -C docs DESTDIR="${D}" install-html
221     }
222    
223 floppym 1.85 pkg_pretend() {
224     if [[ ${MERGE_TYPE} != binary ]]; then
225     # Bug 439082
226     if $(tc-getLD) --version | grep -q "GNU gold"; then
227     eerror "GRUB does not function correctly when built with the gold linker."
228     eerror "Please select the bfd linker with binutils-config."
229     die "GNU gold detected"
230     fi
231     fi
232     }
233    
234 vapier 1.33 src_prepare() {
235 floppym 1.76 if [[ ${PV} != 9999 ]]; then
236 floppym 1.77 epatch "${FILESDIR}/${P}-parallel-make.patch" #424231
237     epatch "${FILESDIR}/${P}-no-gets.patch" #424703
238 floppym 1.81 epatch "${FILESDIR}/${P}-config-quoting.patch" #426364
239 floppym 1.83 epatch "${FILESDIR}/${P}-tftp-endian.patch" # 438612
240 ottxor 1.84 epatch "${FILESDIR}/${P}-hardcoded-awk.patch" #424137
241 floppym 1.86 epatch "${FILESDIR}/${P}-freebsd.patch" #442050
242     epatch "${FILESDIR}/${P}-compression.patch" #424527
243 floppym 1.88 epatch "${FILESDIR}/${P}-zfs-feature-flag-support-r1.patch" #455358
244     epatch "${FILESDIR}/${P}-20_linux_xen.patch" #463992
245     epatch "${FILESDIR}/${P}-dmraid.patch" #430748
246     epatch "${FILESDIR}/${P}-texinfo.patch"
247 floppym 1.76 fi
248 floppym 1.75
249 floppym 1.65 # fix texinfo file name, bug 416035
250     sed -i \
251     -e 's/^\* GRUB:/* GRUB2:/' \
252     -e 's/(grub)/(grub2)/' -- \
253     "${S}"/docs/grub.texi
254    
255 vapier 1.15 epatch_user
256 vapier 1.7
257     # autogen.sh does more than just run autotools
258 flameeyes 1.45 if [[ -n ${DO_AUTORECONF} ]] ; then
259 floppym 1.67 sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
260     (
261     autopoint() { :; }
262     . ./autogen.sh
263     ) || die
264 vapier 1.17 fi
265 vapier 1.34
266     # install into the right dir for eselect #372735
267     sed -i \
268     -e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
269     util/bash-completion.d/Makefile.in || die
270 scarabeus 1.37
271     # get enabled platforms
272     GRUB_ENABLED_PLATFORMS=""
273 floppym 1.77 local i
274 vapier 1.47 for i in ${GRUB_PLATFORMS[@]}; do
275 scarabeus 1.37 use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
276     done
277     [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
278 floppym 1.67 einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
279 vapier 1.6 }
280    
281 vapier 1.33 src_configure() {
282 scarabeus 1.37 local i
283    
284 floppym 1.76 use custom-cflags || unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
285 vapier 1.1 use static && append-ldflags -static
286 floppym 1.86 use elibc_FreeBSD && append-cppflags "-isystem /usr/include"
287 vapier 1.1
288 floppym 1.74 # Sandbox bug 404013.
289     use libzfs && addpredict /etc/dfs:/dev/zfs
290    
291 floppym 1.78 multijob_init
292 scarabeus 1.37 for i in ${GRUB_ENABLED_PLATFORMS}; do
293 floppym 1.78 multijob_child_init grub_run_phase ${FUNCNAME} ${i}
294 scarabeus 1.37 done
295 floppym 1.78 multijob_finish || die
296 vapier 1.33 }
297    
298     src_compile() {
299 floppym 1.50 # Used for pax marking in grub_src_compile
300     local grub_binaries=(
301     grub-editenv
302     grub-fstest
303     grub-menulst2cfg
304     grub-mkimage
305     grub-mklayout
306     grub-mkpasswd-pbkdf2
307     grub-mkrelpath
308     grub-script-check
309     grub-bios-setup
310     grub-ofpathname
311     grub-probe
312     grub-sparc64-setup
313     )
314     use mount && grub_binaries+=( grub-mount )
315     use truetype && grub_binaries+=( grub-mkfont )
316    
317 scarabeus 1.37 local i
318    
319     for i in ${GRUB_ENABLED_PLATFORMS}; do
320     grub_run_phase ${FUNCNAME} ${i}
321     done
322 floppym 1.79
323     # Just build docs once
324     use doc && grub_run_phase build_docs ${i}
325 vapier 1.1 }
326    
327     src_install() {
328 scarabeus 1.37 local i
329    
330     for i in ${GRUB_ENABLED_PLATFORMS}; do
331     grub_run_phase ${FUNCNAME} ${i}
332     done
333    
334 floppym 1.79 use doc && grub_run_phase install_docs ${i}
335    
336 floppym 1.50 mv "${ED}"usr/share/info/grub{,2}.info || die
337 alexxy 1.40
338 scarabeus 1.43 # can't be in docs array as we use default_src_install in different builddir
339 vapier 1.1 dodoc AUTHORS ChangeLog NEWS README THANKS TODO
340 scarabeus 1.37 insinto /etc/default
341 scarabeus 1.69 newins "${FILESDIR}"/grub.default-2 grub
342 floppym 1.50 }
343 scarabeus 1.44
344 floppym 1.86 pkg_preinst() {
345     has_version "<sys-boot/grub-2.00-r2:2" && \
346     [[ "$(df -TP /boot | awk 'NR>1{print $2}')" = 'zfs' ]]
347     display_zfs_feature_flag_warning=$?
348     }
349    
350 floppym 1.50 pkg_postinst() {
351 scarabeus 1.44 # display the link to guide
352 floppym 1.50 elog "For information on how to configure grub-2 please refer to the guide:"
353 floppym 1.60 elog " http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
354 floppym 1.63 if ! has_version sys-boot/os-prober; then
355     elog "Install sys-boot/os-prober to enable detection of other operating systems using grub2-mkconfig."
356     fi
357     if ! has_version dev-libs/libisoburn; then
358     elog "Install dev-libs/libisoburn to enable creation of rescue media using grub2-mkrescue."
359     fi
360 floppym 1.70 if has_version sys-boot/grub:0; then
361     ewarn "If you want to keep GRUB Legacy (grub-0.97) installed, please run"
362     ewarn "the following to add sys-boot/grub:0 to your world file."
363     ewarn "emerge --noreplace sys-boot/grub:0"
364     fi
365 floppym 1.86 if [[ $display_zfs_feature_flag_warning -eq 0 ]]; then
366     zfs_pool=$(df -TP /boot | awk 'NR>1{print $1}')
367     zfs_pool=${zfs_pool%%/*}
368     ewarn "The previous version of sys-boot/grub lacked support for ZFS feature flags."
369     ewarn "Your /boot is on ZFS. Running \"zpool upgrade ${zfs_pool}\" or \"zpool upgrade -a\""
370     ewarn "to upgrade your pool to support feature flags will prevent your system from booting."
371     ewarn "You should use grub2-install to reinstall your boot code. This will avoid problems."
372     fi
373 vapier 1.3 }

  ViewVC Help
Powered by ViewVC 1.1.20