/[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.82 - (show annotations) (download)
Thu Oct 11 02:14:09 2012 UTC (22 months, 1 week ago) by floppym
Branch: MAIN
Changes since 1.81: +2 -1 lines
Install modules in /usr/lib/grub.

(Portage version: 2.2.0_alpha136/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-9999.ebuild,v 1.81 2012/07/22 18:29:50 floppym Exp $
4
5 EAPI=4
6
7 if [[ ${PV} == "9999" ]] ; then
8 EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
9 LIVE_ECLASS="bzr"
10 SRC_URI=""
11 DO_AUTORECONF="true"
12 else
13 MY_P=${P/_/\~}
14 if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
15 SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz"
16 else
17 SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
18 mirror://gentoo/${MY_P}.tar.xz"
19 fi
20 KEYWORDS="~amd64 ~x86"
21 S=${WORKDIR}/${MY_P}
22 DO_AUTORECONF="true"
23 fi
24
25 inherit eutils flag-o-matic multiprocessing pax-utils toolchain-funcs ${DO_AUTORECONF:+autotools} ${LIVE_ECLASS}
26 unset LIVE_ECLASS
27
28 DESCRIPTION="GNU GRUB boot loader"
29 HOMEPAGE="http://www.gnu.org/software/grub/"
30
31 LICENSE="GPL-3"
32 SLOT="2"
33 IUSE="custom-cflags debug device-mapper doc efiemu mount nls static sdl truetype libzfs"
34
35 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 # amd64, ia64:
45 efi-64
46 )
47 IUSE+=" ${GRUB_PLATFORMS[@]/#/grub_platforms_}"
48
49 REQUIRED_USE="grub_platforms_qemu? ( truetype )"
50
51 # os-prober: Used on runtime to detect other OSes
52 # xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
53 RDEPEND="
54 app-arch/xz-utils
55 >=sys-libs/ncurses-5.2-r5
56 debug? (
57 sdl? ( media-libs/libsdl )
58 )
59 device-mapper? ( >=sys-fs/lvm2-2.02.45 )
60 libzfs? ( sys-fs/zfs )
61 mount? ( sys-fs/fuse )
62 truetype? (
63 media-libs/freetype
64 media-fonts/dejavu
65 >=media-fonts/unifont-5
66 )
67 ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
68 ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
69 "
70 DEPEND="${RDEPEND}
71 >=dev-lang/python-2.5.2
72 sys-devel/flex
73 sys-devel/bison
74 sys-apps/help2man
75 sys-apps/texinfo
76 static? (
77 truetype? (
78 app-arch/bzip2[static-libs(+)]
79 media-libs/freetype[static-libs(+)]
80 sys-libs/zlib[static-libs(+)]
81 )
82 )
83 "
84 RDEPEND+="
85 grub_platforms_efi-32? ( sys-boot/efibootmgr )
86 grub_platforms_efi-64? ( sys-boot/efibootmgr )
87 "
88 if [[ -n ${DO_AUTORECONF} ]] ; then
89 DEPEND+=" >=sys-devel/autogen-5.10"
90 else
91 DEPEND+=" app-arch/xz-utils"
92 fi
93
94 export STRIP_MASK="*/grub/*/*.{mod,img}"
95
96 QA_EXECSTACK="
97 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 "
104
105 QA_WX_LOAD="
106 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 "
114
115 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
127 grub_${phase} ${platform}
128
129 popd > /dev/null || die
130 }
131
132 grub_src_configure() {
133 local platform=$1
134 local with_platform=
135 local enable_efiemu="--disable-efiemu"
136
137 [[ -z ${platform} ]] && die "${FUNCNAME} [platform]"
138
139 # Used below for efi cross-building
140 tc-export CC NM OBJCOPY STRIP
141
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
147 case ${platform} in
148 efi-32)
149 if [[ ${CHOST} == x86_64* ]]; then
150 CTARGET="${CTARGET:-i386}"
151 TARGET_CC="${TARGET_CC:-${CC}}"
152 export TARGET_CC
153 fi
154 with_platform="--with-platform=efi"
155 ;;
156 efi-64)
157 if [[ ${CHOST} == i?86* ]]; then
158 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 fi
164 with_platform="--with-platform=efi"
165 ;;
166 guessed) ;;
167 *)
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 esac
176
177 ECONF_SOURCE="${S}" \
178 econf \
179 --libdir=/usr/lib \
180 --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
181 --disable-werror \
182 --program-prefix= \
183 --program-transform-name="s,grub,grub2," \
184 --with-grubdir=grub2 \
185 ${with_platform} \
186 $(use_enable debug mm-debug) \
187 $(use_enable debug grub-emu-usb) \
188 $(use_enable device-mapper) \
189 ${enable_efiemu} \
190 $(use_enable mount grub-mount) \
191 $(use_enable nls) \
192 $(use_enable truetype grub-mkfont) \
193 $(use_enable libzfs) \
194 $(use sdl && use_enable debug grub-emu-sdl)
195
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 }
201
202 grub_src_compile() {
203 default_src_compile
204 pax-mark -mpes "${grub_binaries[@]}"
205 }
206
207 grub_build_docs() {
208 emake -C docs html
209 }
210
211 grub_src_install() {
212 default_src_install
213 }
214
215 grub_install_docs() {
216 emake -C docs DESTDIR="${D}" install-html
217 }
218
219 src_prepare() {
220 if [[ ${PV} != 9999 ]]; then
221 epatch "${FILESDIR}/${P}-parallel-make.patch" #424231
222 epatch "${FILESDIR}/${P}-no-gets.patch" #424703
223 epatch "${FILESDIR}/${P}-config-quoting.patch" #426364
224 fi
225
226 # fix texinfo file name, bug 416035
227 sed -i \
228 -e 's/^\* GRUB:/* GRUB2:/' \
229 -e 's/(grub)/(grub2)/' -- \
230 "${S}"/docs/grub.texi
231
232 epatch_user
233
234 # autogen.sh does more than just run autotools
235 if [[ -n ${DO_AUTORECONF} ]] ; then
236 sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
237 (
238 autopoint() { :; }
239 . ./autogen.sh
240 ) || die
241 fi
242
243 # install into the right dir for eselect #372735
244 sed -i \
245 -e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
246 util/bash-completion.d/Makefile.in || die
247
248 # get enabled platforms
249 GRUB_ENABLED_PLATFORMS=""
250 local i
251 for i in ${GRUB_PLATFORMS[@]}; do
252 use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
253 done
254 [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
255 einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
256 }
257
258 src_configure() {
259 local i
260
261 use custom-cflags || unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
262 use static && append-ldflags -static
263
264 # Sandbox bug 404013.
265 use libzfs && addpredict /etc/dfs:/dev/zfs
266
267 multijob_init
268 for i in ${GRUB_ENABLED_PLATFORMS}; do
269 multijob_child_init grub_run_phase ${FUNCNAME} ${i}
270 done
271 multijob_finish || die
272 }
273
274 src_compile() {
275 # Used for pax marking in grub_src_compile
276 local grub_binaries=(
277 grub-editenv
278 grub-fstest
279 grub-menulst2cfg
280 grub-mkimage
281 grub-mklayout
282 grub-mkpasswd-pbkdf2
283 grub-mkrelpath
284 grub-script-check
285 grub-bios-setup
286 grub-ofpathname
287 grub-probe
288 grub-sparc64-setup
289 )
290 use mount && grub_binaries+=( grub-mount )
291 use truetype && grub_binaries+=( grub-mkfont )
292
293 local i
294
295 for i in ${GRUB_ENABLED_PLATFORMS}; do
296 grub_run_phase ${FUNCNAME} ${i}
297 done
298
299 # Just build docs once
300 use doc && grub_run_phase build_docs ${i}
301 }
302
303 src_install() {
304 local i
305
306 for i in ${GRUB_ENABLED_PLATFORMS}; do
307 grub_run_phase ${FUNCNAME} ${i}
308 done
309
310 use doc && grub_run_phase install_docs ${i}
311
312 mv "${ED}"usr/share/info/grub{,2}.info || die
313
314 # can't be in docs array as we use default_src_install in different builddir
315 dodoc AUTHORS ChangeLog NEWS README THANKS TODO
316 insinto /etc/default
317 newins "${FILESDIR}"/grub.default-2 grub
318 }
319
320 pkg_postinst() {
321 # display the link to guide
322 elog "For information on how to configure grub-2 please refer to the guide:"
323 elog " http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
324 if ! has_version sys-boot/os-prober; then
325 elog "Install sys-boot/os-prober to enable detection of other operating systems using grub2-mkconfig."
326 fi
327 if ! has_version dev-libs/libisoburn; then
328 elog "Install dev-libs/libisoburn to enable creation of rescue media using grub2-mkrescue."
329 fi
330 if has_version sys-boot/grub:0; then
331 ewarn "If you want to keep GRUB Legacy (grub-0.97) installed, please run"
332 ewarn "the following to add sys-boot/grub:0 to your world file."
333 ewarn "emerge --noreplace sys-boot/grub:0"
334 fi
335 }

  ViewVC Help
Powered by ViewVC 1.1.20