/[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.39 - (hide annotations) (download)
Sun Aug 28 10:50:33 2011 UTC (2 years, 10 months ago) by scarabeus
Branch: MAIN
Changes since 1.38: +4 -1 lines
Fix hardcoded grub-probe call. Fixes bug #380879. Revision bump so everyone gets the update.

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

1 vapier 1.27 # Copyright 1999-2011 Gentoo Foundation
2 vapier 1.1 # Distributed under the terms of the GNU General Public License v2
3 scarabeus 1.39 # $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-9999.ebuild,v 1.38 2011/08/28 10:30:23 scarabeus Exp $
4 vapier 1.21
5 scarabeus 1.37 EAPI=4
6 vapier 1.1
7     if [[ ${PV} == "9999" ]] ; then
8 vapier 1.29 EBZR_REPO_URI="http://bzr.savannah.gnu.org/r/grub/trunk/grub/"
9 scarabeus 1.37 LIVE_ECLASS="autotools bzr"
10 vapier 1.2 SRC_URI=""
11     else
12 scarabeus 1.37 MY_P=${P/_/\~}
13     SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
14     mirror://gentoo/${MY_P}.tar.xz"
15     S=${WORKDIR}/${MY_P}
16 vapier 1.1 fi
17    
18 scarabeus 1.37 inherit mount-boot eutils flag-o-matic toolchain-funcs ${LIVE_ECLASS}
19     unset LIVE_ECLASS
20    
21 vapier 1.32 DESCRIPTION="GNU GRUB boot loader"
22 vapier 1.1 HOMEPAGE="http://www.gnu.org/software/grub/"
23    
24 vapier 1.4 LICENSE="GPL-3"
25 scarabeus 1.37 SLOT="2"
26     [[ ${PV} != "9999" ]] && KEYWORDS="~amd64 ~mips ~x86"
27 scarabeus 1.38 IUSE="custom-cflags debug device-mapper efiemu nls static sdl truetype"
28 scarabeus 1.37
29     GRUB_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
40     for i in ${GRUB_PLATFORMS}; do
41     IUSE+=" grub_platforms_${i}"
42     done
43     unset i
44    
45     # os-prober: Used on runtime to detect other OSes
46     # xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
47     RDEPEND="
48     dev-libs/libisoburn
49 vapier 1.18 dev-libs/lzo
50 scarabeus 1.37 sys-boot/os-prober
51     >=sys-libs/ncurses-5.2-r5
52 vapier 1.32 debug? (
53     sdl? ( media-libs/libsdl )
54     )
55     device-mapper? ( >=sys-fs/lvm2-2.02.45 )
56 vapier 1.24 truetype? ( media-libs/freetype >=media-fonts/unifont-5 )"
57 vapier 1.9 DEPEND="${RDEPEND}
58 mattst88 1.35 >=dev-lang/python-2.5.2
59 scarabeus 1.37 sys-devel/flex
60 vapier 1.36 virtual/yacc
61 scarabeus 1.37 "
62     if [[ ${PV} == "9999" ]]; then
63     DEPEND+=" >=sys-devel/autogen-5.10 sys-apps/help2man"
64     else
65     DEPEND+=" app-arch/xz-utils"
66     fi
67    
68     export STRIP_MASK="*/grub*/*/*.{mod,img}"
69     QA_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    
86     grub_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 vapier 1.1
98 scarabeus 1.37 grub_${phase} ${platform}
99    
100     popd > /dev/null || die
101     }
102    
103     grub_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
129     fi
130    
131     ECONF_SOURCE="${WORKDIR}/${P}/" \
132     econf \
133     --disable-werror \
134     --sbindir=/sbin \
135     --bindir=/bin \
136     --libdir=/$(get_libdir) \
137     --program-transform-name=s,grub,grub2, \
138 scarabeus 1.38 $(use_enable debug mm-debug) \
139     $(use_enable debug grub-emu-usb) \
140 scarabeus 1.37 $(use_enable device-mapper) \
141 scarabeus 1.38 $(use_enable efiemu) \
142     $(use_enable nls) \
143 scarabeus 1.37 $(use_enable truetype grub-mkfont) \
144     $(use sdl && use_enable debug grub-emu-sdl) \
145     ${platform}
146     }
147    
148     grub_src_compile() {
149     default_src_compile
150     }
151    
152     grub_src_install() {
153     default_src_install
154     }
155 vapier 1.1
156 vapier 1.33 src_prepare() {
157 scarabeus 1.37 local i j archs
158    
159 scarabeus 1.39 epatch \
160     "${FILESDIR}/1.99-call_proper_grub_probe.patch"
161    
162 vapier 1.15 epatch_user
163 vapier 1.7
164     # autogen.sh does more than just run autotools
165 vapier 1.17 if [[ ${PV} == "9999" ]] ; then
166 vapier 1.33 sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
167 vapier 1.17 (. ./autogen.sh) || die
168     fi
169 vapier 1.34
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 scarabeus 1.37
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 vapier 1.6 }
183    
184 vapier 1.33 src_configure() {
185 scarabeus 1.37 local i
186    
187 vapier 1.1 use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS
188     use static && append-ldflags -static
189    
190 scarabeus 1.37 for i in ${GRUB_ENABLED_PLATFORMS}; do
191     grub_run_phase ${FUNCNAME} ${i}
192     done
193 vapier 1.33 }
194    
195     src_compile() {
196 scarabeus 1.37 local i
197    
198     for i in ${GRUB_ENABLED_PLATFORMS}; do
199     grub_run_phase ${FUNCNAME} ${i}
200     done
201 vapier 1.1 }
202    
203     src_install() {
204 scarabeus 1.37 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     # can't be in docs array as we use defualt_src_install in different builddir
215 vapier 1.1 dodoc AUTHORS ChangeLog NEWS README THANKS TODO
216 scarabeus 1.37 insinto /etc/default
217     newins "${FILESDIR}"/grub.default grub
218     cat <<EOF >> "${ED}"/lib*/grub2/grub-mkconfig_lib
219 vapier 1.6 GRUB_DISTRIBUTOR="Gentoo"
220 scarabeus 1.37 EOF
221 vapier 1.3 }
222    
223     setup_boot_dir() {
224 scarabeus 1.37 local dir=$1
225 vapier 1.3
226 scarabeus 1.37 # display the link to guide if user didn't set up anything yet.
227     elog "For informations how to configure grub-2 please reffer to the guide:"
228     elog " http://dev.gentoo.org/~scarabeus/grub-2-guide.xml"
229    
230     if [[ ! -e ${dir}/grub.cfg && -e ${dir/2/}/menu.lst ]] ; then
231     # This is first grub2 install and we have old configuraton for
232     # grub1 around. Lets try to generate grub.cfg from it so user
233     # does not loose any stuff when rebooting.
234     # NOTE: in long term he still NEEDS to migrate to grub.d stuff.
235     einfo "Running: grub2-menulst2cfg '${dir/2/}/menu.lst' '${dir}/grub.cfg'"
236     grub2-menulst2cfg "${dir/2/}/menu.lst" "${dir}/grub.cfg" || \
237     ewarn "Running grub2-menulst2cfg failed!"
238    
239     einfo "Even if we just created configuration for your grub2 using old"
240     einfo "grub-legacy configuration file you should migrate to use new style"
241     einfo "configuration in '${ROOT}/etc/grub.d'."
242     einfo
243    
244     else
245     # we need to refresh the grub.cfg everytime just to play it safe
246     einfo "Running: grub2-mkconfig -o '${dir}/grub.cfg'"
247     grub2-mkconfig -o "${dir}/grub.cfg" || \
248     ewarn "Running grub2-mkconfig failed! Check your configuration files!"
249 vapier 1.3 fi
250    
251 scarabeus 1.37 elog "Remember to run \"grub2-mkconfig -o '${dir}/grub.cfg'\" every time"
252     elog "you update the configuration files!"
253    
254     elog "Remember to run grub2-install to install your grub every time"
255     elog "you update this package!"
256 vapier 1.1 }
257    
258     pkg_postinst() {
259 vapier 1.28 mount-boot_mount_boot_partition
260 vapier 1.27
261 scarabeus 1.37 setup_boot_dir "${ROOT}"boot/grub2
262 vapier 1.28
263 scarabeus 1.37 # needs to be called after we call setup_boot_dir
264 vapier 1.28 mount-boot_pkg_postinst
265 vapier 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20