/[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.35 Revision 1.40
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 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.35 2011/08/21 03:18:11 mattst88 Exp $ 3# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/Attic/grub-9999.ebuild,v 1.40 2011/08/31 11:27:51 alexxy Exp $
4 4
5# XXX: need to implement a grub.conf migration in pkg_postinst before we ~arch 5EAPI=4
6EAPI="2"
7
8inherit mount-boot eutils flag-o-matic toolchain-funcs
9 6
10if [[ ${PV} == "9999" ]] ; then 7if [[ ${PV} == "9999" ]] ; then
11 EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/" 8 EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
12 inherit autotools bzr 9 LIVE_ECLASS="autotools bzr"
13 SRC_URI="" 10 SRC_URI=""
14else 11else
15 SRC_URI="ftp://alpha.gnu.org/gnu/${PN}/${P}.tar.gz 12 MY_P=${P/_/\~}
13 SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
16 mirror://gentoo/${P}.tar.gz" 14 mirror://gentoo/${MY_P}.tar.xz"
15 S=${WORKDIR}/${MY_P}
17fi 16fi
17
18inherit mount-boot eutils flag-o-matic pax-utils toolchain-funcs ${LIVE_ECLASS}
19unset LIVE_ECLASS
18 20
19DESCRIPTION="GNU GRUB boot loader" 21DESCRIPTION="GNU GRUB boot loader"
20HOMEPAGE="http://www.gnu.org/software/grub/" 22HOMEPAGE="http://www.gnu.org/software/grub/"
21 23
22LICENSE="GPL-3" 24LICENSE="GPL-3"
23use multislot && SLOT="2" || SLOT="0" 25SLOT="2"
24KEYWORDS="" 26[[ ${PV} != "9999" ]] && KEYWORDS="~amd64 ~mips ~x86"
25IUSE="custom-cflags debug device-mapper multislot static sdl truetype" 27IUSE="custom-cflags debug device-mapper efiemu nls static sdl truetype"
26 28
27RDEPEND=">=sys-libs/ncurses-5.2-r5 29GRUB_PLATFORMS="coreboot efi-32 efi-64 emu ieee1275 multiboot pc qemu qemu-mips loongson"
30# everywhere:
31# emu
32# mips only:
33# qemu-mips, loongson
34# amd64, x86, ppc, ppc64
35# ieee1275
36# amd64, x86
37# coreboot, multiboot, efi-32, pc, qemu
38# amd64
39# efi-64
40for i in ${GRUB_PLATFORMS}; do
41 IUSE+=" grub_platforms_${i}"
42done
43unset i
44
45# os-prober: Used on runtime to detect other OSes
46# xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
47RDEPEND="
48 dev-libs/libisoburn
28 dev-libs/lzo 49 dev-libs/lzo
50 sys-boot/os-prober
51 >=sys-libs/ncurses-5.2-r5
29 debug? ( 52 debug? (
30 sdl? ( media-libs/libsdl ) 53 sdl? ( media-libs/libsdl )
31 ) 54 )
32 device-mapper? ( >=sys-fs/lvm2-2.02.45 ) 55 device-mapper? ( >=sys-fs/lvm2-2.02.45 )
33 truetype? ( media-libs/freetype >=media-fonts/unifont-5 )" 56 truetype? ( media-libs/freetype >=media-fonts/unifont-5 )"
34DEPEND="${RDEPEND} 57DEPEND="${RDEPEND}
35 >=dev-lang/python-2.5.2 58 >=dev-lang/python-2.5.2
36 sys-devel/bison
37 sys-devel/flex" 59 sys-devel/flex
38[[ ${PV} == "9999" ]] && DEPEND+=" >=sys-devel/autogen-5.10 sys-apps/help2man" 60 virtual/yacc
39 61"
40export STRIP_MASK="*/grub/*/*.mod"
41QA_EXECSTACK="sbin/grub-probe sbin/grub-setup sbin/grub-mkdevicemap bin/grub-script-check bin/grub-fstest"
42
43src_prepare() {
44 epatch_user
45
46 # autogen.sh does more than just run autotools
47 # need to eautomake due to weirdness #296013
48 if [[ ${PV} == "9999" ]] ; then 62if [[ ${PV} == "9999" ]]; then
49 sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die 63 DEPEND+=" >=sys-devel/autogen-5.10 sys-apps/help2man"
50 (. ./autogen.sh) || die 64else
65 DEPEND+=" app-arch/xz-utils"
66fi
67
68export STRIP_MASK="*/grub*/*/*.{mod,img}"
69QA_EXECSTACK="
70 lib64/grub2/*/setjmp.mod
71 lib64/grub2/*/kernel.img
72 sbin/grub2-probe
73 sbin/grub2-setup
74 sbin/grub2-mkdevicemap
75 bin/grub2-script-check
76 bin/grub2-fstest
77 bin/grub2-mklayout
78 bin/grub2-menulst2cfg
79 bin/grub2-mkrelpath
80 bin/grub2-mkpasswd-pbkdf2
81 bin/grub2-mkfont
82 bin/grub2-editenv
83 bin/grub2-mkimage
84"
85
86grub_run_phase() {
87 local phase=$1
88 local platform=$2
89 [[ -z ${phase} || -z ${platform} ]] && die "${FUNCNAME} [phase] [platform]"
90
91 [[ -d "${WORKDIR}/build-${platform}" ]] || \
92 { mkdir "${WORKDIR}/build-${platform}" || die ; }
93 pushd "${WORKDIR}/build-${platform}" > /dev/null || die
94
95 echo ">>> Running ${phase} for platform \"${platform}\""
96 echo ">>> Working in: \"${WORKDIR}/build-${platform}\""
97
98 grub_${phase} ${platform}
99
100 popd > /dev/null || die
101}
102
103grub_src_configure() {
104 local platform=$1
105 local target
106
107 [[ -z ${platform} ]] && die "${FUNCNAME} [platform]"
108
109 # if we have no platform then --with-platform=guessed does not work
110 [[ ${platform} == "guessed" ]] && platform=""
111
112 # check if we have to specify the target (EFI)
113 # or just append correct --with-platform
114 if [[ -n ${platform} ]]; then
115 if [[ ${platform} == efi* ]]; then
116 # EFI platform hack
117 [[ ${platform/*-} == 32 ]] && target=i386
118 [[ ${platform/*-} == 64 ]] && target=x86_64
119 # program-prefix is required empty because otherwise it is equal to
120 # target variable, which we do not want at all
121 platform="
122 --with-platform=${platform/-*}
123 --target=${target}
124 --program-prefix=
125 "
126 else
127 platform=" --with-platform=${platform}"
128 fi
51 fi 129 fi
52 130
53 # install into the right dir for eselect #372735 131 ECONF_SOURCE="${WORKDIR}/${P}/" \
54 sed -i \
55 -e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
56 util/bash-completion.d/Makefile.in || die
57}
58
59src_configure() {
60 use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS
61 use static && append-ldflags -static
62
63 econf \ 132 econf \
64 --disable-werror \ 133 --disable-werror \
65 --sbindir=/sbin \ 134 --sbindir=/sbin \
66 --bindir=/bin \ 135 --bindir=/bin \
67 --libdir=/$(get_libdir) \ 136 --libdir=/$(get_libdir) \
68 --disable-efiemu \ 137 --program-transform-name=s,grub,grub2, \
138 $(use_enable debug mm-debug) \
139 $(use_enable debug grub-emu-usb) \
69 $(use_enable device-mapper) \ 140 $(use_enable device-mapper) \
141 $(use_enable efiemu) \
142 $(use_enable nls) \
70 $(use_enable truetype grub-mkfont) \ 143 $(use_enable truetype grub-mkfont) \
71 $(use_enable debug mm-debug) \
72 $(use sdl && use_enable debug grub-emu-sdl) \ 144 $(use sdl && use_enable debug grub-emu-sdl) \
73 $(use_enable debug grub-emu-usb) 145 ${platform}
146}
147
148grub_src_compile() {
149 default_src_compile
150}
151
152grub_src_install() {
153 default_src_install
154}
155
156src_prepare() {
157 local i j archs
158
159 epatch \
160 "${FILESDIR}/1.99-call_proper_grub_probe.patch"
161
162 epatch_user
163
164 # autogen.sh does more than just run autotools
165 if [[ ${PV} == "9999" ]] ; then
166 sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
167 (. ./autogen.sh) || die
168 fi
169
170 # install into the right dir for eselect #372735
171 sed -i \
172 -e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
173 util/bash-completion.d/Makefile.in || die
174
175 # get enabled platforms
176 GRUB_ENABLED_PLATFORMS=""
177 for i in ${GRUB_PLATFORMS}; do
178 use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
179 done
180 [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
181 einfo "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
182}
183
184src_configure() {
185 local i
186
187 use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS
188 use static && append-ldflags -static
189
190 for i in ${GRUB_ENABLED_PLATFORMS}; do
191 grub_run_phase ${FUNCNAME} ${i}
192 done
74} 193}
75 194
76src_compile() { 195src_compile() {
77 emake -j1 || die 196 local i
197
198 for i in ${GRUB_ENABLED_PLATFORMS}; do
199 grub_run_phase ${FUNCNAME} ${i}
200 done
78} 201}
79 202
80src_install() { 203src_install() {
81 emake DESTDIR="${D}" install || die 204 local i
205
206 for i in ${GRUB_ENABLED_PLATFORMS}; do
207 grub_run_phase ${FUNCNAME} ${i}
208 done
209
210 # slot all collisions with grub legacy
211 mv "${ED}"/usr/share/info/grub.info \
212 "${ED}"/usr/share/info/grub2.info || die
213
214 # Do pax marking
215 local PAX=(
216 "sbin/grub2-probe"
217 "sbin/grub2-setup"
218 "sbin/grub2-mkdevicemap"
219 "bin/grub2-script-check"
220 "bin/grub2-fstest"
221 "bin/grub2-mklayout"
222 "bin/grub2-menulst2cfg"
223 "bin/grub2-mkrelpath"
224 "bin/grub2-mkpasswd-pbkdf2"
225 "bin/grub2-editenv"
226 "bin/grub2-mkimage"
227 )
228 for e in ${PAX[@]}; do
229 pax-mark -mpx "${ED}/${e}"
230 done
231
232 # can't be in docs array as we use defualt_src_install in different builddir
82 dodoc AUTHORS ChangeLog NEWS README THANKS TODO 233 dodoc AUTHORS ChangeLog NEWS README THANKS TODO
83
84 insinto /etc/defaults 234 insinto /etc/default
85 doins "${FILESDIR}"/defaults || die 235 newins "${FILESDIR}"/grub.default grub
86 cat <<-EOF >> "${D}"/lib*/grub/grub-mkconfig_lib 236 cat <<EOF >> "${ED}"/lib*/grub2/grub-mkconfig_lib
87 GRUB_DISTRIBUTOR="Gentoo" 237 GRUB_DISTRIBUTOR="Gentoo"
88 EOF 238EOF
239}
89 240
90 if use multislot ; then 241setup_boot_dir() {
91 sed -i "s:grub-install:grub2-install:" "${D}"/sbin/grub-install || die 242 local dir=$1
92 mv "${D}"/sbin/grub{,2}-install || die 243
93 mv "${D}"/sbin/grub{,2}-set-default || die 244 # display the link to guide if user didn't set up anything yet.
94 mv "${D}"/usr/share/man/man8/grub{,2}-install.8 || die 245 elog "For informations how to configure grub-2 please reffer to the guide:"
95 mv "${D}"/usr/share/info/grub{,2}.info || die 246 elog " http://dev.gentoo.org/~scarabeus/grub-2-guide.xml"
247
248 if [[ ! -e ${dir}/grub.cfg && -e ${dir/2/}/menu.lst ]] ; then
249 # This is first grub2 install and we have old configuraton for
250 # grub1 around. Lets try to generate grub.cfg from it so user
251 # does not loose any stuff when rebooting.
252 # NOTE: in long term he still NEEDS to migrate to grub.d stuff.
253 einfo "Running: grub2-menulst2cfg '${dir/2/}/menu.lst' '${dir}/grub.cfg'"
254 grub2-menulst2cfg "${dir/2/}/menu.lst" "${dir}/grub.cfg" || \
255 ewarn "Running grub2-menulst2cfg failed!"
256
257 einfo "Even if we just created configuration for your grub2 using old"
258 einfo "grub-legacy configuration file you should migrate to use new style"
259 einfo "configuration in '${ROOT}/etc/grub.d'."
260 einfo
261
262 else
263 # we need to refresh the grub.cfg everytime just to play it safe
264 einfo "Running: grub2-mkconfig -o '${dir}/grub.cfg'"
265 grub2-mkconfig -o "${dir}/grub.cfg" || \
266 ewarn "Running grub2-mkconfig failed! Check your configuration files!"
96 fi 267 fi
97}
98 268
99setup_boot_dir() { 269 elog "Remember to run \"grub2-mkconfig -o '${dir}/grub.cfg'\" every time"
100 local boot_dir=$1 270 elog "you update the configuration files!"
101 local dir=${boot_dir}/grub
102 271
103 if [[ ! -e ${dir}/grub.cfg ]] ; then 272 elog "Remember to run grub2-install to install your grub every time"
104 einfo "Running: grub-mkconfig -o '${dir}/grub.cfg'" 273 elog "you update this package!"
105 grub-mkconfig -o "${dir}/grub.cfg"
106 fi
107
108 #local install=grub-install
109 #use multislot && install="grub2-install --grub-setup=/bin/true"
110 #einfo "Running: ${install} "
111 #${install}
112} 274}
113 275
114pkg_postinst() { 276pkg_postinst() {
115 mount-boot_mount_boot_partition 277 mount-boot_mount_boot_partition
116 278
117 if use multislot ; then
118 elog "You have installed grub2 with USE=multislot, so to coexist"
119 elog "with grub1, the grub2 install binary is named grub2-install."
120 fi
121 setup_boot_dir "${ROOT}"boot 279 setup_boot_dir "${ROOT}"boot/grub2
122 280
123 # needs to be after we call setup_boot_dir 281 # needs to be called after we call setup_boot_dir
124 mount-boot_pkg_postinst 282 mount-boot_pkg_postinst
125} 283}

Legend:
Removed from v.1.35  
changed lines
  Added in v.1.40

  ViewVC Help
Powered by ViewVC 1.1.20