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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.88 Revision 1.89
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2013 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/Attic/grub-9999.ebuild,v 1.88 2013/04/27 20:58:24 floppym Exp $ 3# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/Attic/grub-9999.ebuild,v 1.89 2013/04/28 19:44:09 floppym Exp $
4 4
5EAPI=4 5EAPI=5
6AUTOTOOLS_AUTO_DEPEND=yes
6 7
8inherit autotools-utils eutils flag-o-matic multibuild pax-utils toolchain-funcs
9
7if [[ ${PV} == "9999" ]] ; then 10if [[ ${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"
12else
13 MY_P=${P/_/\~} 11 MY_P=${P/_/\~}
14 if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then 12 if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
15 SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz" 13 SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz"
16 else 14 else
17 SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz 15 SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
18 mirror://gentoo/${MY_P}.tar.xz" 16 mirror://gentoo/${MY_P}.tar.xz"
19 fi 17 fi
20 KEYWORDS="~amd64 ~x86" 18 KEYWORDS="~amd64 ~x86"
21 S=${WORKDIR}/${MY_P} 19 S=${WORKDIR}/${MY_P}
22 DO_AUTORECONF="true" 20 PATCHES=(
21 "${FILESDIR}/${P}-parallel-make.patch" #424231
22 "${FILESDIR}/${P}-no-gets.patch" #424703
23 "${FILESDIR}/${P}-config-quoting.patch" #426364
24 "${FILESDIR}/${P}-tftp-endian.patch" # 438612
25 "${FILESDIR}/${P}-hardcoded-awk.patch" #424137
26 "${FILESDIR}/${P}-freebsd.patch" #442050
27 "${FILESDIR}/${P}-compression.patch" #424527
28 "${FILESDIR}/${P}-zfs-feature-flag-support-r1.patch" #455358
29 "${FILESDIR}/${P}-20_linux_xen.patch" #463992
30 "${FILESDIR}/${P}-dmraid.patch" #430748
31 "${FILESDIR}/${P}-texinfo.patch"
32 )
33else
34 inherit bzr
35 EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
23fi 36fi
24
25inherit eutils flag-o-matic multiprocessing pax-utils toolchain-funcs ${DO_AUTORECONF:+autotools} ${LIVE_ECLASS}
26unset LIVE_ECLASS
27 37
28DESCRIPTION="GNU GRUB boot loader" 38DESCRIPTION="GNU GRUB boot loader"
29HOMEPAGE="http://www.gnu.org/software/grub/" 39HOMEPAGE="http://www.gnu.org/software/grub/"
30 40
31LICENSE="GPL-3" 41LICENSE="GPL-3"
32SLOT="2" 42SLOT="2"
33IUSE="custom-cflags debug device-mapper doc efiemu mount nls static sdl truetype libzfs" 43IUSE="custom-cflags debug device-mapper doc efiemu mount multislot nls static sdl truetype libzfs"
34 44
35GRUB_PLATFORMS=( 45GRUB_ALL_PLATFORMS=(
36 # everywhere: 46 # everywhere:
37 emu 47 emu
38 # mips only: 48 # mips only:
39 qemu-mips yeeloong 49 qemu-mips yeeloong
40 # amd64, x86, ppc, ppc64: 50 # amd64, x86, ppc, ppc64:
42 # amd64, x86: 52 # amd64, x86:
43 coreboot multiboot efi-32 pc qemu 53 coreboot multiboot efi-32 pc qemu
44 # amd64, ia64: 54 # amd64, ia64:
45 efi-64 55 efi-64
46) 56)
47IUSE+=" ${GRUB_PLATFORMS[@]/#/grub_platforms_}" 57IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}"
48 58
49REQUIRED_USE="grub_platforms_qemu? ( truetype ) 59REQUIRED_USE="grub_platforms_qemu? ( truetype )
50 grub_platforms_yeeloong? ( truetype )" 60 grub_platforms_yeeloong? ( truetype )"
51 61
52# os-prober: Used on runtime to detect other OSes 62# os-prober: Used on runtime to detect other OSes
67 ) 77 )
68 ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils ) 78 ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
69 ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils ) 79 ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
70" 80"
71DEPEND="${RDEPEND} 81DEPEND="${RDEPEND}
82 app-misc/pax-utils
72 >=dev-lang/python-2.5.2 83 >=dev-lang/python-2.5.2
73 sys-devel/flex 84 sys-devel/flex
74 sys-devel/bison 85 sys-devel/bison
75 sys-apps/help2man 86 sys-apps/help2man
76 sys-apps/texinfo 87 sys-apps/texinfo
88 >=sys-devel/autogen-5.10
77 static? ( 89 static? (
78 truetype? ( 90 truetype? (
79 app-arch/bzip2[static-libs(+)] 91 app-arch/bzip2[static-libs(+)]
80 media-libs/freetype[static-libs(+)] 92 media-libs/freetype[static-libs(+)]
81 sys-libs/zlib[static-libs(+)] 93 sys-libs/zlib[static-libs(+)]
85RDEPEND+=" 97RDEPEND+="
86 kernel_linux? ( 98 kernel_linux? (
87 grub_platforms_efi-32? ( sys-boot/efibootmgr ) 99 grub_platforms_efi-32? ( sys-boot/efibootmgr )
88 grub_platforms_efi-64? ( sys-boot/efibootmgr ) 100 grub_platforms_efi-64? ( sys-boot/efibootmgr )
89 ) 101 )
102 !multislot? ( !sys-boot/grub:0 )
90" 103"
91if [[ -n ${DO_AUTORECONF} ]] ; then
92 DEPEND+=" >=sys-devel/autogen-5.10"
93fi
94if [[ ${PV} != 9999 ]]; then
95 DEPEND+=" app-arch/xz-utils"
96fi
97 104
98export STRIP_MASK="*/grub/*/*.{mod,img}" 105STRIP_MASK="*/grub/*/*.{mod,img}"
99 106
100QA_EXECSTACK=" 107QA_EXECSTACK="
101 usr/bin/grub* 108 usr/bin/grub*
102 usr/sbin/grub* 109 usr/sbin/grub*
103 usr/lib*/grub/*/*.mod 110 usr/lib*/grub/*/*.mod
111 usr/lib*/grub/*/*.module
104 usr/lib*/grub/*/kernel.exec 112 usr/lib*/grub/*/kernel.exec
105 usr/lib*/grub/*/kernel.img 113 usr/lib*/grub/*/kernel.img
106 usr/lib*/grub/*/setjmp.module
107" 114"
108 115
109QA_WX_LOAD=" 116QA_WX_LOAD="
110 usr/lib*/grub/*/kernel.exec 117 usr/lib*/grub/*/kernel.exec
111 usr/lib*/grub/*/kernel.img 118 usr/lib*/grub/*/kernel.img
113" 120"
114 121
115QA_PRESTRIPPED=" 122QA_PRESTRIPPED="
116 usr/lib.*/grub/.*/kernel.img 123 usr/lib.*/grub/.*/kernel.img
117" 124"
118
119grub_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
131 grub_${phase} ${platform}
132
133 popd > /dev/null || die
134}
135
136grub_src_configure() {
137 local platform=$1
138 local with_platform=
139 local enable_efiemu="--disable-efiemu"
140
141 [[ -z ${platform} ]] && die "${FUNCNAME} [platform]"
142
143 # Used below for efi cross-building
144 tc-export CC NM OBJCOPY STRIP
145
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
151 case ${platform} in
152 efi-32)
153 if [[ ${CHOST} == x86_64* ]]; then
154 CTARGET="${CTARGET:-i386}"
155 TARGET_CC="${TARGET_CC:-${CC}}"
156 export TARGET_CC
157 fi
158 with_platform="--with-platform=efi"
159 ;;
160 efi-64)
161 if [[ ${CHOST} == i?86* ]]; then
162 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 fi
168 with_platform="--with-platform=efi"
169 ;;
170 guessed) ;;
171 *)
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 esac
180
181 ECONF_SOURCE="${S}" \
182 econf \
183 --libdir=/usr/lib \
184 --htmldir="${EPREFIX}/usr/share/doc/${PF}/html" \
185 --disable-werror \
186 --program-prefix= \
187 --program-transform-name="s,grub,grub2," \
188 --with-grubdir=grub2 \
189 ${with_platform} \
190 $(use_enable debug mm-debug) \
191 $(use_enable debug grub-emu-usb) \
192 $(use_enable device-mapper) \
193 ${enable_efiemu} \
194 $(use_enable mount grub-mount) \
195 $(use_enable nls) \
196 $(use_enable truetype grub-mkfont) \
197 $(use_enable libzfs) \
198 $(use sdl && use_enable debug grub-emu-sdl)
199
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}
205
206grub_src_compile() {
207 default_src_compile
208 pax-mark -mpes "${grub_binaries[@]}"
209}
210
211grub_build_docs() {
212 emake -C docs html
213}
214
215grub_src_install() {
216 default_src_install
217}
218
219grub_install_docs() {
220 emake -C docs DESTDIR="${D}" install-html
221}
222 125
223pkg_pretend() { 126pkg_pretend() {
224 if [[ ${MERGE_TYPE} != binary ]]; then 127 if [[ ${MERGE_TYPE} != binary ]]; then
225 # Bug 439082 128 # Bug 439082
226 if $(tc-getLD) --version | grep -q "GNU gold"; then 129 if $(tc-getLD) --version | grep -q "GNU gold"; then
230 fi 133 fi
231 fi 134 fi
232} 135}
233 136
234src_prepare() { 137src_prepare() {
235 if [[ ${PV} != 9999 ]]; then 138 [[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
236 epatch "${FILESDIR}/${P}-parallel-make.patch" #424231 139 sed -i -e /autoreconf/d autogen.sh || die
237 epatch "${FILESDIR}/${P}-no-gets.patch" #424703
238 epatch "${FILESDIR}/${P}-config-quoting.patch" #426364
239 epatch "${FILESDIR}/${P}-tftp-endian.patch" # 438612
240 epatch "${FILESDIR}/${P}-hardcoded-awk.patch" #424137
241 epatch "${FILESDIR}/${P}-freebsd.patch" #442050
242 epatch "${FILESDIR}/${P}-compression.patch" #424527
243 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 fi
248
249 # 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 epatch_user 140 epatch_user
256 141 bash autogen.sh || die
257 # autogen.sh does more than just run autotools
258 if [[ -n ${DO_AUTORECONF} ]] ; then
259 sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
260 (
261 autopoint() { :; } 142 autopoint() { return 0; }
262 . ./autogen.sh 143 eautoreconf
263 ) || die 144}
264 fi
265 145
266 # install into the right dir for eselect #372735 146grub_configure() {
267 sed -i \ 147 local platform
268 -e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
269 util/bash-completion.d/Makefile.in || die
270 148
271 # get enabled platforms 149 case ${MULTIBUILD_VARIANT} in
272 GRUB_ENABLED_PLATFORMS="" 150 efi-32)
273 local i 151 platform=efi
274 for i in ${GRUB_PLATFORMS[@]}; do 152 if [[ ${CTARGET:-${CHOST}} == x86_64* ]]; then
275 use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}" 153 local CTARGET=${CTARGET:-i386}
276 done 154 fi ;;
277 [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed" 155 efi-64)
278 einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}" 156 platform=efi
157 if [[ ${CTARGET:-${CHOST}} == i?86* ]]; then
158 local CTARGET=${CTARGET:-x86_64}
159 local TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
160 local TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
161 export TARGET_CFLAGS TARGET_CPPFLAGS
162 fi ;;
163 guessed) ;;
164 *) platform=${MULTIBUILD_VARIANT} ;;
165 esac
166
167 local myeconfargs=(
168 --disable-werror
169 --program-prefix=
170 --libdir=/usr/lib
171 --htmldir=/usr/share/doc/${PF}/html
172 $(use_enable debug mm-debug)
173 $(use_enable debug grub-emu-usb)
174 $(use_enable efiemu)
175 $(use_enable mount grub-mount)
176 $(use_enable nls)
177 $(use_enable truetype grub-mkfont)
178 $(use_enable libzfs)
179 $(use sdl && use_enable debug grub-emu-sdl)
180 ${platform:+--with-platform=}${platform}
181 )
182
183 if use multislot; then
184 myeconfargs+=(
185 --program-transform-name="s,grub,grub2,"
186 --with-grubdir=grub2
187 )
188 fi
189
190 autotools-utils_src_configure
279} 191}
280 192
281src_configure() { 193src_configure() {
282 local i
283
284 use custom-cflags || unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS 194 use custom-cflags || unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
285 use static && append-ldflags -static 195 use static && append-ldflags -static
286 use elibc_FreeBSD && append-cppflags "-isystem /usr/include"
287 196
288 # Sandbox bug 404013. 197 tc-export CC NM OBJCOPY STRIP
289 use libzfs && addpredict /etc/dfs:/dev/zfs 198 export TARGET_CC=${TARGET_CC:-${CC}}
290 199
291 multijob_init 200 # Portage will take care of cleaning up GRUB_PLATFORMS
292 for i in ${GRUB_ENABLED_PLATFORMS}; do 201 MULTIBUILD_VARIANTS=( ${GRUB_PLATFORMS:-guessed} )
293 multijob_child_init grub_run_phase ${FUNCNAME} ${i} 202 multibuild_parallel_foreach_variant grub_configure
294 done
295 multijob_finish || die
296} 203}
297 204
298src_compile() { 205src_compile() {
299 # Used for pax marking in grub_src_compile 206 multibuild_foreach_variant autotools-utils_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 207
317 local i 208 use doc && multibuild_for_best_variant \
318 209 autotools-utils_src_compile -C docs html
319 for i in ${GRUB_ENABLED_PLATFORMS}; do
320 grub_run_phase ${FUNCNAME} ${i}
321 done
322
323 # Just build docs once
324 use doc && grub_run_phase build_docs ${i}
325} 210}
326 211
327src_install() { 212src_install() {
328 local i 213 multibuild_foreach_variant autotools-utils_src_install \
214 bashcompletiondir=/usr/share/bash-completion
329 215
330 for i in ${GRUB_ENABLED_PLATFORMS}; do 216 use doc && multibuild_for_best_variant run_in_build_dir \
331 grub_run_phase ${FUNCNAME} ${i} 217 emake -C docs DESTDIR="${D}" install-html
332 done
333 218
334 use doc && grub_run_phase install_docs ${i} 219 if use multislot; then
335
336 mv "${ED}"usr/share/info/grub{,2}.info || die 220 mv "${ED}"usr/share/info/grub{,2}.info || die
221 fi
337 222
338 # can't be in docs array as we use default_src_install in different builddir
339 dodoc AUTHORS ChangeLog NEWS README THANKS TODO
340 insinto /etc/default 223 insinto /etc/default
341 newins "${FILESDIR}"/grub.default-2 grub 224 newins "${FILESDIR}"/grub.default-2 grub
342}
343 225
344pkg_preinst() { 226 cd "${ED}" || die
345 has_version "<sys-boot/grub-2.00-r2:2" && \ 227 pax-mark mpes $(scanelf -BF %F usr/{bin,sbin})
346 [[ "$(df -TP /boot | awk 'NR>1{print $2}')" = 'zfs' ]]
347 display_zfs_feature_flag_warning=$?
348} 228}
349 229
350pkg_postinst() { 230pkg_postinst() {
351 # display the link to guide
352 elog "For information on how to configure grub-2 please refer to the guide:" 231 elog "For information on how to configure grub-2 please refer to the guide:"
353 elog " http://wiki.gentoo.org/wiki/GRUB2_Quick_Start" 232 elog " http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
233 if [[ -z ${REPLACING_VERSIONS} ]]; then
354 if ! has_version sys-boot/os-prober; then 234 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." 235 elog "Install sys-boot/os-prober to enable detection of other operating systems using grub2-mkconfig."
356 fi 236 fi
357 if ! has_version dev-libs/libisoburn; then 237 if ! has_version dev-libs/libisoburn; then
358 elog "Install dev-libs/libisoburn to enable creation of rescue media using grub2-mkrescue." 238 elog "Install dev-libs/libisoburn to enable creation of rescue media using grub2-mkrescue."
359 fi 239 fi
360 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 240 fi
365 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} 241}

Legend:
Removed from v.1.88  
changed lines
  Added in v.1.89

  ViewVC Help
Powered by ViewVC 1.1.20