/[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.85 - (hide annotations) (download)
Sat Oct 20 21:46:34 2012 UTC (17 months, 3 weeks ago) by floppym
Branch: MAIN
Changes since 1.84: +12 -1 lines
Add pkg_pretend check to bail out if we are using the gold linker. Bug 439082 by Ambroz Bizjak.

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

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

  ViewVC Help
Powered by ViewVC 1.1.20