/[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.66 - (show annotations) (download)
Tue Jun 5 19:02:50 2012 UTC (2 years, 3 months ago) by floppym
Branch: MAIN
Changes since 1.65: +5 -3 lines
Call autoreconf directly (via autogen.sh) since eautoreconf insists on callign autopoint. Bug 418081.

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

  ViewVC Help
Powered by ViewVC 1.1.20