/[gentoo-x86]/sys-boot/grub/grub-2.02_beta2-r7.ebuild
Gentoo

Contents of /sys-boot/grub/grub-2.02_beta2-r7.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (show annotations) (download)
Thu Aug 6 19:14:21 2015 UTC (3 years, 1 month ago) by floppym
Branch: MAIN
CVS Tags: HEAD
Changes since 1.14: +2 -2 lines
Backport another build fix for musl, bug 543840.

(Portage version: 2.2.20/cvs/Linux x86_64, signed Manifest commit with key 0BBEEA1FEA4843A4)

1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/grub-2.02_beta2-r7.ebuild,v 1.14 2015/08/02 18:42:41 ago Exp $
4
5 EAPI=5
6
7 AUTOTOOLS_AUTORECONF=1
8 GRUB_AUTOGEN=1
9
10 if [[ -n ${GRUB_AUTOGEN} ]]; then
11 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
12 inherit python-any-r1
13 fi
14
15 inherit autotools-utils bash-completion-r1 eutils flag-o-matic mount-boot multibuild pax-utils toolchain-funcs versionator
16
17 if [[ ${PV} != 9999 ]]; then
18 if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
19 # The quote style is to work with <=bash-4.2 and >=bash-4.3 #503860
20 MY_P=${P/_/'~'}
21 SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz
22 http://dev.gentoo.org/~floppym/dist/${P}-gentoo-r3.tar.xz"
23 S=${WORKDIR}/${MY_P}
24 else
25 SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
26 http://dev.gentoo.org/~floppym/dist/${P}.tar.xz"
27 S=${WORKDIR}/${P%_*}
28 fi
29 KEYWORDS="amd64 x86"
30 PATCHES=()
31 else
32 inherit git-r3
33 EGIT_REPO_URI="git://git.sv.gnu.org/grub.git
34 http://git.savannah.gnu.org/r/grub.git"
35 fi
36
37 DEJAVU=dejavu-sans-ttf-2.34
38 UNIFONT=unifont-7.0.06
39 SRC_URI+=" fonts? ( mirror://gnu/unifont/${UNIFONT}/${UNIFONT}.pcf.gz )
40 themes? ( mirror://sourceforge/dejavu/${DEJAVU}.zip )"
41
42 DESCRIPTION="GNU GRUB boot loader"
43 HOMEPAGE="http://www.gnu.org/software/grub/"
44
45 # Includes licenses for dejavu and unifont
46 LICENSE="GPL-3 fonts? ( GPL-2-with-font-exception ) themes? ( BitstreamVera )"
47 SLOT="2"
48 IUSE="debug device-mapper doc efiemu +fonts mount +multislot nls static sdl test +themes truetype libzfs"
49
50 GRUB_ALL_PLATFORMS=( coreboot efi-32 efi-64 emu ieee1275 loongson multiboot qemu qemu-mips pc uboot xen )
51 IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}"
52
53 REQUIRED_USE="
54 grub_platforms_coreboot? ( fonts )
55 grub_platforms_qemu? ( fonts )
56 grub_platforms_ieee1275? ( fonts )
57 grub_platforms_loongson? ( fonts )
58 "
59
60 # os-prober: Used on runtime to detect other OSes
61 # xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
62 RDEPEND="
63 app-arch/xz-utils
64 >=sys-libs/ncurses-5.2-r5
65 debug? (
66 sdl? ( media-libs/libsdl )
67 )
68 device-mapper? ( >=sys-fs/lvm2-2.02.45 )
69 libzfs? ( sys-fs/zfs )
70 mount? ( sys-fs/fuse )
71 truetype? ( media-libs/freetype:2= )
72 ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
73 ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
74 "
75 DEPEND="${RDEPEND}
76 ${PYTHON_DEPS}
77 app-misc/pax-utils
78 sys-devel/flex
79 sys-devel/bison
80 sys-apps/help2man
81 sys-apps/texinfo
82 fonts? ( media-libs/freetype:2 )
83 grub_platforms_xen? ( app-emulation/xen-tools )
84 static? (
85 app-arch/xz-utils[static-libs(+)]
86 truetype? (
87 app-arch/bzip2[static-libs(+)]
88 media-libs/freetype[static-libs(+)]
89 sys-libs/zlib[static-libs(+)]
90 )
91 )
92 test? (
93 dev-libs/libisoburn
94 app-emulation/qemu
95 )
96 themes? (
97 app-arch/unzip
98 media-libs/freetype:2
99 )
100 "
101 RDEPEND+="
102 kernel_linux? (
103 grub_platforms_efi-32? ( sys-boot/efibootmgr )
104 grub_platforms_efi-64? ( sys-boot/efibootmgr )
105 )
106 !multislot? ( !sys-boot/grub:0 )
107 nls? ( sys-devel/gettext )
108 "
109
110 DEPEND+=" !!=media-libs/freetype-2.5.4"
111
112 STRIP_MASK="*/grub/*/*.{mod,img}"
113 RESTRICT="test"
114
115 QA_EXECSTACK="
116 usr/bin/grub*-emu*
117 usr/lib*/grub/*/*.mod
118 usr/lib*/grub/*/*.module
119 usr/lib*/grub/*/kernel.exec
120 usr/lib*/grub/*/kernel.img
121 "
122
123 QA_WX_LOAD="
124 usr/lib*/grub/*/kernel.exec
125 usr/lib*/grub/*/kernel.img
126 usr/lib*/grub/*/*.image
127 "
128
129 QA_PRESTRIPPED="
130 usr/lib.*/grub/.*/kernel.img
131 "
132
133 src_unpack() {
134 if [[ ${PV} == 9999 ]]; then
135 git-r3_src_unpack
136 fi
137 default_src_unpack
138 }
139
140 src_prepare() {
141 EPATCH_SUFFIX="patch" EPATCH_FORCE="yes" epatch
142
143 [[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
144
145 sed -i -e /autoreconf/d autogen.sh || die
146
147 if use multislot; then
148 # fix texinfo file name, bug 416035
149 sed -i -e 's/^\* GRUB:/* GRUB2:/' -e 's/(grub)/(grub2)/' docs/grub.texi || die
150 fi
151
152 epatch_user
153
154 if [[ -n ${GRUB_AUTOGEN} ]]; then
155 python_setup
156 bash autogen.sh || die
157 fi
158
159 if [[ -n ${AUTOTOOLS_AUTORECONF} ]]; then
160 autopoint() { return 0; }
161 eautoreconf
162 fi
163 }
164
165 setup_fonts() {
166 ln -s "${WORKDIR}/${UNIFONT}.pcf" unifont.pcf || die
167 if use themes; then
168 ln -s "${WORKDIR}/${DEJAVU}/ttf/DejaVuSans.ttf" DejaVuSans.ttf || die
169 fi
170 }
171
172 grub_configure() {
173 local platform
174
175 case ${MULTIBUILD_VARIANT} in
176 efi-32)
177 platform=efi
178 if [[ ${CTARGET:-${CHOST}} == x86_64* ]]; then
179 local CTARGET=${CTARGET:-i386}
180 fi ;;
181 efi-64)
182 platform=efi
183 if [[ ${CTARGET:-${CHOST}} == i?86* ]]; then
184 local CTARGET=${CTARGET:-x86_64}
185 local TARGET_CFLAGS="-Os -march=x86-64 ${TARGET_CFLAGS}"
186 local TARGET_CPPFLAGS="-march=x86-64 ${TARGET_CPPFLAGS}"
187 export TARGET_CFLAGS TARGET_CPPFLAGS
188 fi ;;
189 guessed) ;;
190 *) platform=${MULTIBUILD_VARIANT} ;;
191 esac
192
193 local myeconfargs=(
194 --disable-werror
195 --program-prefix=
196 --libdir="${EPREFIX}"/usr/lib
197 --htmldir="${EPREFIX}"/usr/share/doc/${PF}/html
198 $(use_enable debug mm-debug)
199 $(use_enable debug grub-emu-usb)
200 $(use_enable device-mapper)
201 $(use_enable mount grub-mount)
202 $(use_enable nls)
203 $(use_enable themes grub-themes)
204 $(use_enable truetype grub-mkfont)
205 $(use_enable libzfs)
206 $(use sdl && use_enable debug grub-emu-sdl)
207 ${platform:+--with-platform=}${platform}
208
209 # Let configure detect this where supported
210 $(usex efiemu '' '--disable-efiemu')
211 )
212
213 if use multislot; then
214 myeconfargs+=( --program-transform-name="s,grub,grub2," )
215 fi
216
217 mkdir -p "${BUILD_DIR}" || die
218 run_in_build_dir setup_fonts
219
220 autotools-utils_src_configure
221 }
222
223 src_configure() {
224 # Bug 508758.
225 replace-flags -O3 -O2
226
227 # We don't want to leak flags onto boot code.
228 export HOST_CCASFLAGS=${CCASFLAGS}
229 export HOST_CFLAGS=${CFLAGS}
230 export HOST_CPPFLAGS=${CPPFLAGS}
231 export HOST_LDFLAGS=${LDFLAGS}
232 unset CCASFLAGS CFLAGS CPPFLAGS LDFLAGS
233
234 use static && HOST_LDFLAGS+=" -static"
235
236 tc-ld-disable-gold #439082 #466536 #526348
237 export TARGET_LDFLAGS="${TARGET_LDFLAGS} ${LDFLAGS}"
238 unset LDFLAGS
239
240 tc-export CC NM OBJCOPY RANLIB STRIP
241 tc-export BUILD_CC # Bug 485592
242
243 # Portage will take care of cleaning up GRUB_PLATFORMS
244 MULTIBUILD_VARIANTS=( ${GRUB_PLATFORMS:-guessed} )
245 multibuild_parallel_foreach_variant grub_configure
246 }
247
248 src_compile() {
249 # Sandbox bug 404013.
250 use libzfs && addpredict /etc/dfs:/dev/zfs
251
252 multibuild_foreach_variant autotools-utils_src_compile
253
254 use doc && multibuild_for_best_variant \
255 autotools-utils_src_compile -C docs html
256 }
257
258 src_test() {
259 # The qemu dependency is a bit complex.
260 # You will need to adjust QEMU_SOFTMMU_TARGETS to match the cpu/platform.
261 multibuild_foreach_variant autotools-utils_src_test
262 }
263
264 src_install() {
265 multibuild_foreach_variant autotools-utils_src_install \
266 bashcompletiondir="$(get_bashcompdir)"
267
268 local grub=grub
269 if use multislot; then
270 grub=grub2
271 mv "${ED%/}"/usr/share/info/grub{,2}.info || die
272 mv "${ED%/}"/$(get_bashcompdir)/grub{,2} || die
273 fi
274
275 bashcomp_alias ${grub} ${grub}-{install,set-default,mkrescue,reboot,script-check,editenv,sparc64-setup,mkfont,mkpasswd-pbkdf2,mkimage,bios-setup,mkconfig,probe}
276
277 use doc && multibuild_for_best_variant run_in_build_dir \
278 emake -C docs DESTDIR="${D}" install-html
279
280 insinto /etc/default
281 newins "${FILESDIR}"/grub.default-3 grub
282 }
283
284 pkg_postinst() {
285 mount-boot_mount_boot_partition
286
287 if [[ -e "${ROOT%/}/boot/grub2/grub.cfg" ]]; then
288 ewarn "The grub directory has changed from /boot/grub2 to /boot/grub."
289 ewarn "Please run grub2-install and grub2-mkconfig -o /boot/grub/grub.cfg."
290
291 if [[ ! -e "${ROOT%/}/boot/grub/grub.cfg" ]]; then
292 mkdir -p "${ROOT%/}/boot/grub"
293 ln -s ../grub2/grub.cfg "${ROOT%/}/boot/grub/grub.cfg"
294 fi
295 fi
296
297 mount-boot_pkg_postinst
298
299 elog "For information on how to configure GRUB2 please refer to the guide:"
300 elog " http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
301
302 if has_version 'sys-boot/grub:0'; then
303 elog "A migration guide for GRUB Legacy users is available:"
304 elog " https://wiki.gentoo.org/wiki/GRUB2_Migration"
305 fi
306
307 if [[ -z ${REPLACING_VERSIONS} ]]; then
308 elog
309 elog "You may consider installing the following optional packages:"
310 optfeature "Detect other operating systems (grub-mkconfig)" sys-boot/os-prober
311 optfeature "Create rescue media (grub-mkrescue)" dev-libs/libisoburn
312 optfeature "Enable RAID device detection" sys-fs/mdadm
313 fi
314 }

  ViewVC Help
Powered by ViewVC 1.1.20