/[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.45 - (hide annotations) (download)
Wed Nov 2 15:09:11 2011 UTC (2 years, 8 months ago) by flameeyes
Branch: MAIN
Changes since 1.44: +14 -5 lines
Fix info manual (was referencing old name); factor out autoreconf handling if we were to execute that on a non-live ebuild.

(Portage version: 2.2.0_alpha72/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 flameeyes 1.45 # $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-9999.ebuild,v 1.44 2011/10/04 18:23:19 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 flameeyes 1.45 LIVE_ECLASS="bzr"
10 vapier 1.2 SRC_URI=""
11 flameeyes 1.45 DO_AUTORECONF="true"
12 vapier 1.2 else
13 scarabeus 1.37 MY_P=${P/_/\~}
14     SRC_URI="mirror://gnu/${PN}/${MY_P}.tar.xz
15     mirror://gentoo/${MY_P}.tar.xz"
16     S=${WORKDIR}/${MY_P}
17 vapier 1.1 fi
18    
19 flameeyes 1.45 inherit mount-boot eutils flag-o-matic pax-utils toolchain-funcs ${DO_AUTORECONF:+autotools} ${LIVE_ECLASS}
20 scarabeus 1.37 unset LIVE_ECLASS
21    
22 vapier 1.32 DESCRIPTION="GNU GRUB boot loader"
23 vapier 1.1 HOMEPAGE="http://www.gnu.org/software/grub/"
24    
25 vapier 1.4 LICENSE="GPL-3"
26 scarabeus 1.37 SLOT="2"
27     [[ ${PV} != "9999" ]] && KEYWORDS="~amd64 ~mips ~x86"
28 scarabeus 1.38 IUSE="custom-cflags debug device-mapper efiemu nls static sdl truetype"
29 scarabeus 1.37
30     GRUB_PLATFORMS="coreboot efi-32 efi-64 emu ieee1275 multiboot pc qemu qemu-mips loongson"
31     # everywhere:
32     # emu
33     # mips only:
34     # qemu-mips, loongson
35     # amd64, x86, ppc, ppc64
36     # ieee1275
37     # amd64, x86
38     # coreboot, multiboot, efi-32, pc, qemu
39     # amd64
40     # efi-64
41     for i in ${GRUB_PLATFORMS}; do
42     IUSE+=" grub_platforms_${i}"
43     done
44     unset i
45    
46     # os-prober: Used on runtime to detect other OSes
47     # xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
48     RDEPEND="
49     dev-libs/libisoburn
50 vapier 1.18 dev-libs/lzo
51 scarabeus 1.37 sys-boot/os-prober
52     >=sys-libs/ncurses-5.2-r5
53 vapier 1.32 debug? (
54     sdl? ( media-libs/libsdl )
55     )
56     device-mapper? ( >=sys-fs/lvm2-2.02.45 )
57 vapier 1.24 truetype? ( media-libs/freetype >=media-fonts/unifont-5 )"
58 vapier 1.9 DEPEND="${RDEPEND}
59 mattst88 1.35 >=dev-lang/python-2.5.2
60 scarabeus 1.37 sys-devel/flex
61 vapier 1.36 virtual/yacc
62 flameeyes 1.45 sys-apps/texinfo
63 scarabeus 1.37 "
64 flameeyes 1.45 if [[ -n ${DO_AUTORECONF} ]] ; then
65 scarabeus 1.37 DEPEND+=" >=sys-devel/autogen-5.10 sys-apps/help2man"
66     else
67     DEPEND+=" app-arch/xz-utils"
68     fi
69    
70     export STRIP_MASK="*/grub*/*/*.{mod,img}"
71     QA_EXECSTACK="
72     lib64/grub2/*/setjmp.mod
73     lib64/grub2/*/kernel.img
74     sbin/grub2-probe
75     sbin/grub2-setup
76     sbin/grub2-mkdevicemap
77     bin/grub2-script-check
78     bin/grub2-fstest
79     bin/grub2-mklayout
80     bin/grub2-menulst2cfg
81     bin/grub2-mkrelpath
82     bin/grub2-mkpasswd-pbkdf2
83     bin/grub2-mkfont
84     bin/grub2-editenv
85     bin/grub2-mkimage
86     "
87    
88 scarabeus 1.41 QA_WX_LOAD="
89     lib*/grub2/*/kernel.img
90     lib*/grub2/*/setjmp.mod
91     "
92    
93 scarabeus 1.37 grub_run_phase() {
94     local phase=$1
95     local platform=$2
96     [[ -z ${phase} || -z ${platform} ]] && die "${FUNCNAME} [phase] [platform]"
97    
98     [[ -d "${WORKDIR}/build-${platform}" ]] || \
99     { mkdir "${WORKDIR}/build-${platform}" || die ; }
100     pushd "${WORKDIR}/build-${platform}" > /dev/null || die
101    
102     echo ">>> Running ${phase} for platform \"${platform}\""
103     echo ">>> Working in: \"${WORKDIR}/build-${platform}\""
104 vapier 1.1
105 scarabeus 1.37 grub_${phase} ${platform}
106    
107     popd > /dev/null || die
108     }
109    
110     grub_src_configure() {
111     local platform=$1
112     local target
113    
114     [[ -z ${platform} ]] && die "${FUNCNAME} [platform]"
115    
116     # if we have no platform then --with-platform=guessed does not work
117     [[ ${platform} == "guessed" ]] && platform=""
118    
119     # check if we have to specify the target (EFI)
120     # or just append correct --with-platform
121     if [[ -n ${platform} ]]; then
122     if [[ ${platform} == efi* ]]; then
123     # EFI platform hack
124     [[ ${platform/*-} == 32 ]] && target=i386
125     [[ ${platform/*-} == 64 ]] && target=x86_64
126     # program-prefix is required empty because otherwise it is equal to
127     # target variable, which we do not want at all
128     platform="
129     --with-platform=${platform/-*}
130     --target=${target}
131     --program-prefix=
132     "
133     else
134     platform=" --with-platform=${platform}"
135     fi
136     fi
137    
138     ECONF_SOURCE="${WORKDIR}/${P}/" \
139     econf \
140     --disable-werror \
141     --sbindir=/sbin \
142     --bindir=/bin \
143     --libdir=/$(get_libdir) \
144     --program-transform-name=s,grub,grub2, \
145 scarabeus 1.38 $(use_enable debug mm-debug) \
146     $(use_enable debug grub-emu-usb) \
147 scarabeus 1.37 $(use_enable device-mapper) \
148 scarabeus 1.38 $(use_enable efiemu) \
149     $(use_enable nls) \
150 scarabeus 1.37 $(use_enable truetype grub-mkfont) \
151     $(use sdl && use_enable debug grub-emu-sdl) \
152     ${platform}
153     }
154    
155     grub_src_compile() {
156     default_src_compile
157     }
158    
159     grub_src_install() {
160     default_src_install
161     }
162 vapier 1.1
163 vapier 1.33 src_prepare() {
164 scarabeus 1.37 local i j archs
165    
166 scarabeus 1.39 epatch \
167     "${FILESDIR}/1.99-call_proper_grub_probe.patch"
168    
169 vapier 1.15 epatch_user
170 vapier 1.7
171 flameeyes 1.45 # fix texinfo file name, as otherwise the grub2.info file will be
172     # useless
173     sed -i \
174     -e '/setfilename/s:grub.info:grub2.info:' \
175     -e 's:(grub):(grub2):' \
176     "${S}"/docs/grub.texi
177    
178 vapier 1.7 # autogen.sh does more than just run autotools
179 flameeyes 1.45 if [[ -n ${DO_AUTORECONF} ]] ; then
180 vapier 1.33 sed -i -e '/^autoreconf/s:^:set +e; e:' autogen.sh || die
181 vapier 1.17 (. ./autogen.sh) || die
182     fi
183 vapier 1.34
184     # install into the right dir for eselect #372735
185     sed -i \
186     -e '/^bashcompletiondir =/s:=.*:= $(datarootdir)/bash-completion:' \
187     util/bash-completion.d/Makefile.in || die
188 scarabeus 1.37
189     # get enabled platforms
190     GRUB_ENABLED_PLATFORMS=""
191     for i in ${GRUB_PLATFORMS}; do
192     use grub_platforms_${i} && GRUB_ENABLED_PLATFORMS+=" ${i}"
193     done
194     [[ -z ${GRUB_ENABLED_PLATFORMS} ]] && GRUB_ENABLED_PLATFORMS="guessed"
195 scarabeus 1.44 elog "Going to build following platforms: ${GRUB_ENABLED_PLATFORMS}"
196 vapier 1.6 }
197    
198 vapier 1.33 src_configure() {
199 scarabeus 1.37 local i
200    
201 vapier 1.1 use custom-cflags || unset CFLAGS CPPFLAGS LDFLAGS
202     use static && append-ldflags -static
203    
204 scarabeus 1.37 for i in ${GRUB_ENABLED_PLATFORMS}; do
205     grub_run_phase ${FUNCNAME} ${i}
206     done
207 vapier 1.33 }
208    
209     src_compile() {
210 scarabeus 1.37 local i
211    
212     for i in ${GRUB_ENABLED_PLATFORMS}; do
213     grub_run_phase ${FUNCNAME} ${i}
214     done
215 vapier 1.1 }
216    
217     src_install() {
218 scarabeus 1.37 local i
219    
220     for i in ${GRUB_ENABLED_PLATFORMS}; do
221     grub_run_phase ${FUNCNAME} ${i}
222     done
223    
224     # slot all collisions with grub legacy
225     mv "${ED}"/usr/share/info/grub.info \
226     "${ED}"/usr/share/info/grub2.info || die
227    
228 alexxy 1.40 # Do pax marking
229     local PAX=(
230     "sbin/grub2-probe"
231     "sbin/grub2-setup"
232     "sbin/grub2-mkdevicemap"
233     "bin/grub2-script-check"
234     "bin/grub2-fstest"
235     "bin/grub2-mklayout"
236     "bin/grub2-menulst2cfg"
237     "bin/grub2-mkrelpath"
238     "bin/grub2-mkpasswd-pbkdf2"
239     "bin/grub2-editenv"
240     "bin/grub2-mkimage"
241     )
242     for e in ${PAX[@]}; do
243 scarabeus 1.43 pax-mark -mp "${ED}/${e}"
244 alexxy 1.40 done
245    
246 scarabeus 1.43 # can't be in docs array as we use default_src_install in different builddir
247 vapier 1.1 dodoc AUTHORS ChangeLog NEWS README THANKS TODO
248 scarabeus 1.37 insinto /etc/default
249     newins "${FILESDIR}"/grub.default grub
250     cat <<EOF >> "${ED}"/lib*/grub2/grub-mkconfig_lib
251 vapier 1.6 GRUB_DISTRIBUTOR="Gentoo"
252 scarabeus 1.37 EOF
253 scarabeus 1.42
254 scarabeus 1.44 elog
255     elog "To configure GRUB 2, check the defaults in /etc/default/grub and"
256     elog "then run 'emerge --config =${CATEGORY}/${PF}'."
257    
258     # display the link to guide
259     show_doc_url
260     }
261    
262     show_doc_url() {
263     elog
264     elog "For informations how to configure grub-2 please refer to the guide:"
265     elog " http://dev.gentoo.org/~scarabeus/grub-2-guide.xml"
266 vapier 1.3 }
267    
268     setup_boot_dir() {
269 scarabeus 1.37 local dir=$1
270 scarabeus 1.44 local use_legacy='n'
271 scarabeus 1.37
272 scarabeus 1.43 # Make sure target directory exists
273     mkdir -p "${dir}"
274    
275 scarabeus 1.44 if [[ -e ${dir/2/}/menu.lst ]] ; then
276     # Legacy config exists, ask user what to do
277     einfo "Found legacy GRUB configuration. Do you want to convert it"
278     einfo "instead of using autoconfig (y/N)?"
279     read use_legacy
280    
281     use_legacy=${use_legacy,,[A-Z]}
282     fi
283    
284     if [[ ${use_legacy} == y* ]] ; then
285     grub1_cfg=${dir/2/}/menu.lst
286     grub2_cfg=${dir}/grub.cfg
287    
288     # GRUB legacy configuration exists. Use it instead of doing
289     # our normal autoconfigure.
290     #
291    
292     einfo "Converting legacy config at '${grub1_cfg}' for use by GRUB2."
293     ebegin "Running: grub2-menulst2cfg '${grub1_cfg}' '${grub2_cfg}'"
294     grub2-menulst2cfg "${grub1_cfg}" "${grub2_cfg}" &> /dev/null
295     eend $?
296    
297     ewarn
298     ewarn "Even though the conversion above succeeded, you are STRONGLY"
299     ewarn "URGED to upgrade to the new GRUB2 configuration format."
300 scarabeus 1.37
301 scarabeus 1.44 # Remind the user about the documentation
302     show_doc_url
303 scarabeus 1.37 else
304 scarabeus 1.44 # Run GRUB 2 autoconfiguration
305     einfo "Running GRUB 2 autoconfiguration."
306     ebegin "grub2-mkconfig -o '${dir}/grub.cfg'"
307     grub2-mkconfig -o "${dir}/grub.cfg" &> /dev/null
308     eend $?
309 vapier 1.3 fi
310    
311 scarabeus 1.44 einfo
312     einfo "Remember to run grub2-install to activate GRUB2 as your default"
313     einfo "bootloader."
314 vapier 1.1 }
315    
316 scarabeus 1.42 pkg_config() {
317     local dir
318    
319 vapier 1.28 mount-boot_mount_boot_partition
320 vapier 1.27
321 scarabeus 1.42 einfo "Enter the directory where you want to setup grub2 ('${ROOT}boot/grub2/'):"
322     read dir
323    
324     [[ -z ${dir} ]] && dir="${ROOT}"boot/grub2
325    
326     setup_boot_dir "${dir}"
327 vapier 1.28
328     mount-boot_pkg_postinst
329 vapier 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20