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

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50

  ViewVC Help
Powered by ViewVC 1.1.20