/[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.72 - (show annotations) (download)
Fri Jun 29 03:10:31 2012 UTC (2 years, 2 months ago) by floppym
Branch: MAIN
Changes since 1.71: +2 -4 lines
Add ~amd64 keyword for grub:2.

(Portage version: 2.2.0_alpha113/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.71 2012/06/29 03:02:58 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"
21 S=${WORKDIR}/${MY_P}
22 fi
23
24 inherit eutils flag-o-matic pax-utils toolchain-funcs ${DO_AUTORECONF:+autotools} ${LIVE_ECLASS}
25 unset LIVE_ECLASS
26
27 DESCRIPTION="GNU GRUB boot loader"
28 HOMEPAGE="http://www.gnu.org/software/grub/"
29
30 LICENSE="GPL-3"
31 SLOT="2"
32 IUSE="custom-cflags debug device-mapper efiemu mount nls static sdl truetype libzfs"
33
34 GRUB_PLATFORMS=(
35 # everywhere:
36 emu
37 # mips only:
38 qemu-mips yeeloong
39 # amd64, x86, ppc, ppc64:
40 ieee1275
41 # amd64, x86:
42 coreboot multiboot efi-32 pc qemu
43 # amd64, ia64:
44 efi-64
45 )
46 IUSE+=" ${GRUB_PLATFORMS[@]/#/grub_platforms_}"
47
48 REQUIRED_USE="grub_platforms_qemu? ( truetype )"
49
50 # os-prober: Used on runtime to detect other OSes
51 # xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
52 RDEPEND="
53 dev-libs/lzo
54 >=sys-libs/ncurses-5.2-r5
55 debug? (
56 sdl? ( media-libs/libsdl )
57 )
58 device-mapper? ( >=sys-fs/lvm2-2.02.45 )
59 libzfs? ( sys-fs/zfs )
60 mount? ( sys-fs/fuse )
61 truetype? (
62 media-libs/freetype
63 media-fonts/dejavu
64 >=media-fonts/unifont-5
65 )
66 ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
67 ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
68 "
69 DEPEND="${RDEPEND}
70 >=dev-lang/python-2.5.2
71 sys-devel/flex
72 sys-devel/bison
73 sys-apps/texinfo
74 static? (
75 truetype? (
76 app-arch/bzip2[static-libs(+)]
77 media-libs/freetype[static-libs(+)]
78 sys-libs/zlib[static-libs(+)]
79 )
80 )
81 "
82 RDEPEND+="
83 grub_platforms_efi-32? ( sys-boot/efibootmgr )
84 grub_platforms_efi-64? ( sys-boot/efibootmgr )
85 "
86 if [[ -n ${DO_AUTORECONF} ]] ; then
87 DEPEND+=" >=sys-devel/autogen-5.10 sys-apps/help2man"
88 else
89 DEPEND+=" app-arch/xz-utils"
90 fi
91
92 export STRIP_MASK="*/grub/*/*.{mod,img}"
93
94 QA_EXECSTACK="
95 usr/bin/grub*
96 usr/sbin/grub*
97 usr/lib*/grub/*/*.mod
98 usr/lib*/grub/*/kernel.exec
99 usr/lib*/grub/*/kernel.img
100 usr/lib*/grub/*/setjmp.module
101 "
102
103 QA_WX_LOAD="
104 usr/lib*/grub/*/kernel.exec
105 usr/lib*/grub/*/kernel.img
106 usr/lib*/grub/*/*.image
107 "
108
109 QA_PRESTRIPPED="
110 usr/lib.*/grub/.*/kernel.img
111 "
112
113 grub_run_phase() {
114 local phase=$1
115 local platform=$2
116 [[ -z ${phase} || -z ${platform} ]] && die "${FUNCNAME} [phase] [platform]"
117
118 [[ -d "${WORKDIR}/build-${platform}" ]] || \
119 { mkdir "${WORKDIR}/build-${platform}" || die ; }
120 pushd "${WORKDIR}/build-${platform}" > /dev/null || die
121
122 echo ">>> Running ${phase} for platform \"${platform}\""
123 echo ">>> Working in: \"${WORKDIR}/build-${platform}\""
124
125 grub_${phase} ${platform}
126
127 popd > /dev/null || die
128 }
129
130 grub_src_configure() {
131 local platform=$1
132 local with_platform=
133 local enable_efiemu="--disable-efiemu"
134
135 [[ -z ${platform} ]] && die "${FUNCNAME} [platform]"
136
137 # Used below for efi cross-building
138 tc-export CC NM OBJCOPY STRIP
139
140 estack_push CTARGET "${CTARGET}"
141 estack_push TARGET_CC "${TARGET_CC}"
142 estack_push TARGET_CFLAGS "${TARGET_CFLAGS}"
143 estack_push TARGET_CPPFLAGS "${TARGET_CPPFLAGS}"
144
145 case ${platform} in
146 efi-32)
147 if [[ ${CHOST} == x86_64* ]]; then
148 CTARGET="${CTARGET:-i386}"
149 TARGET_CC="${TARGET_CC:-${CC}}"
150 export TARGET_CC
151 fi
152 with_platform="--with-platform=efi"
153 ;;
154 efi-64)
155 if [[ ${CHOST} == i?86* ]]; then
156 CTARGET="${CTARGET:-x86_64}"
157 TARGET_CC="${TARGET_CC:-${CC}}"
158 TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
159 TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
160 export TARGET_CC TARGET_CFLAGS TARGET_CPPFLAGS
161 fi
162 with_platform="--with-platform=efi"
163 ;;
164 guessed) ;;
165 *)
166 with_platform="--with-platform=${platform}"
167 case ${CTARGET:-${CHOST}} in
168 i?86*|x86_64*)
169 enable_efiemu=$(use_enable efiemu)
170 ;;
171 esac
172 ;;
173 esac
174
175 ECONF_SOURCE="${S}" \
176 econf \
177 --disable-werror \
178 --program-prefix= \
179 --program-transform-name="s,grub,grub2," \
180 --with-grubdir=grub2 \
181 ${with_platform} \
182 $(use_enable debug mm-debug) \
183 $(use_enable debug grub-emu-usb) \
184 $(use_enable device-mapper) \
185 ${enable_efiemu} \
186 $(use_enable mount grub-mount) \
187 $(use_enable nls) \
188 $(use_enable truetype grub-mkfont) \
189 $(use_enable libzfs) \
190 $(use sdl && use_enable debug grub-emu-sdl)
191
192 estack_pop CTARGET CTARGET || die
193 estack_pop TARGET_CC TARGET_CC || die
194 estack_pop TARGET_CFLAGS TARGET_CFLAGS || die
195 estack_pop TARGET_CPPFLAGS TARGET_CPPFLAGS || die
196 }
197
198 grub_src_compile() {
199 default_src_compile
200 pax-mark -mpes "${grub_binaries[@]}"
201 }
202
203 grub_src_install() {
204 default_src_install
205 }
206
207 src_prepare() {
208 local i j
209
210 # fix texinfo file name, bug 416035
211 sed -i \
212 -e 's/^\* GRUB:/* GRUB2:/' \
213 -e 's/(grub)/(grub2)/' -- \
214 "${S}"/docs/grub.texi
215
216 epatch_user
217
218 # autogen.sh does more than just run autotools
219 if [[ -n ${DO_AUTORECONF} ]] ; then
220 sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
221 (
222 autopoint() { :; }
223 . ./autogen.sh
224 ) || die
225 fi
226
227 # install into the right dir for eselect #372735
228 sed -i \
229 -e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
230 util/bash-completion.d/Makefile.in || die
231
232 # get enabled platforms
233 GRUB_ENABLED_PLATFORMS=""
234 for i in ${GRUB_PLATFORMS[@]}; do
235 use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
236 done
237 [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
238 einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
239 }
240
241 src_configure() {
242 local i
243
244 use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS
245 use libzfs && addpredict /etc/dfs
246 use static && append-ldflags -static
247
248 for i in ${GRUB_ENABLED_PLATFORMS}; do
249 grub_run_phase ${FUNCNAME} ${i}
250 done
251 }
252
253 src_compile() {
254 # Used for pax marking in grub_src_compile
255 local grub_binaries=(
256 grub-editenv
257 grub-fstest
258 grub-menulst2cfg
259 grub-mkimage
260 grub-mklayout
261 grub-mkpasswd-pbkdf2
262 grub-mkrelpath
263 grub-script-check
264 grub-bios-setup
265 grub-ofpathname
266 grub-probe
267 grub-sparc64-setup
268 )
269 use mount && grub_binaries+=( grub-mount )
270 use truetype && grub_binaries+=( grub-mkfont )
271
272 local i
273
274 for i in ${GRUB_ENABLED_PLATFORMS}; do
275 grub_run_phase ${FUNCNAME} ${i}
276 done
277 }
278
279 src_install() {
280 local i
281
282 for i in ${GRUB_ENABLED_PLATFORMS}; do
283 grub_run_phase ${FUNCNAME} ${i}
284 done
285
286 mv "${ED}"usr/share/info/grub{,2}.info || die
287
288 # can't be in docs array as we use default_src_install in different builddir
289 dodoc AUTHORS ChangeLog NEWS README THANKS TODO
290 insinto /etc/default
291 newins "${FILESDIR}"/grub.default-2 grub
292 }
293
294 pkg_postinst() {
295 # display the link to guide
296 elog "For information on how to configure grub-2 please refer to the guide:"
297 elog " http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
298 if ! has_version sys-boot/os-prober; then
299 elog "Install sys-boot/os-prober to enable detection of other operating systems using grub2-mkconfig."
300 fi
301 if ! has_version dev-libs/libisoburn; then
302 elog "Install dev-libs/libisoburn to enable creation of rescue media using grub2-mkrescue."
303 fi
304 if has_version sys-boot/grub:0; then
305 ewarn "If you want to keep GRUB Legacy (grub-0.97) installed, please run"
306 ewarn "the following to add sys-boot/grub:0 to your world file."
307 ewarn "emerge --noreplace sys-boot/grub:0"
308 fi
309 }

  ViewVC Help
Powered by ViewVC 1.1.20