/[gentoo-x86]/sys-boot/grub/grub-9999-r1.ebuild
Gentoo

Contents of /sys-boot/grub/grub-9999-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.35 - (show annotations) (download)
Thu Jun 25 00:12:06 2015 UTC (3 years, 4 months ago) by floppym
Branch: MAIN
CVS Tags: HEAD
Changes since 1.34: +4 -16 lines
Add support for the U-Boot platform. Don't set TARGET_CC.

(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-9999-r1.ebuild,v 1.34 2015/04/08 20:32:47 mgorny Exp $
4
5 EAPI=5
6
7 if [[ ${PV} == 9999 ]]; then
8 AUTOTOOLS_AUTORECONF=1
9 GRUB_AUTOGEN=1
10 fi
11
12 if [[ -n ${GRUB_AUTOGEN} ]]; then
13 PYTHON_COMPAT=( python{2_7,3_3,3_4} )
14 inherit python-any-r1
15 fi
16
17 inherit autotools-utils bash-completion-r1 eutils flag-o-matic mount-boot multibuild pax-utils toolchain-funcs versionator
18
19 if [[ ${PV} != 9999 ]]; then
20 if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
21 # The quote style is to work with <=bash-4.2 and >=bash-4.3 #503860
22 MY_P=${P/_/'~'}
23 SRC_URI="mirror://gnu-alpha/${PN}/${MY_P}.tar.xz"
24 S=${WORKDIR}/${MY_P}
25 else
26 SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
27 mirror://gentoo/${P}.tar.xz
28 http://dev.gentoo.org/~floppym/dist/${P}.tar.xz"
29 S=${WORKDIR}/${P%_*}
30 fi
31 KEYWORDS="~amd64 ~x86"
32 PATCHES=()
33 else
34 inherit git-r3
35 EGIT_REPO_URI="git://git.sv.gnu.org/grub.git
36 http://git.savannah.gnu.org/r/grub.git"
37 fi
38
39 DEJAVU=dejavu-sans-ttf-2.34
40 UNIFONT=unifont-7.0.06
41 SRC_URI+=" fonts? ( mirror://gnu/unifont/${UNIFONT}/${UNIFONT}.pcf.gz )
42 themes? ( mirror://sourceforge/dejavu/${DEJAVU}.zip )"
43
44 DESCRIPTION="GNU GRUB boot loader"
45 HOMEPAGE="http://www.gnu.org/software/grub/"
46
47 # Includes licenses for dejavu and unifont
48 LICENSE="GPL-3 fonts? ( GPL-2-with-font-exception ) themes? ( BitstreamVera )"
49 SLOT="2"
50 IUSE="debug device-mapper doc efiemu +fonts mount +multislot nls static sdl test +themes truetype libzfs"
51
52 GRUB_ALL_PLATFORMS=( coreboot efi-32 efi-64 emu ieee1275 loongson multiboot qemu qemu-mips pc uboot xen )
53 IUSE+=" ${GRUB_ALL_PLATFORMS[@]/#/grub_platforms_}"
54
55 REQUIRED_USE="
56 grub_platforms_coreboot? ( fonts )
57 grub_platforms_qemu? ( fonts )
58 grub_platforms_ieee1275? ( fonts )
59 grub_platforms_loongson? ( fonts )
60 "
61
62 # os-prober: Used on runtime to detect other OSes
63 # xorriso (dev-libs/libisoburn): Used on runtime for mkrescue
64 RDEPEND="
65 app-arch/xz-utils
66 >=sys-libs/ncurses-5.2-r5
67 debug? (
68 sdl? ( media-libs/libsdl )
69 )
70 device-mapper? ( >=sys-fs/lvm2-2.02.45 )
71 libzfs? ( sys-fs/zfs )
72 mount? ( sys-fs/fuse )
73 truetype? ( media-libs/freetype:2= )
74 ppc? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
75 ppc64? ( sys-apps/ibm-powerpc-utils sys-apps/powerpc-utils )
76 "
77 DEPEND="${RDEPEND}
78 ${PYTHON_DEPS}
79 app-misc/pax-utils
80 sys-devel/flex
81 sys-devel/bison
82 sys-apps/help2man
83 sys-apps/texinfo
84 fonts? ( media-libs/freetype:2 )
85 grub_platforms_xen? ( app-emulation/xen-tools )
86 static? (
87 app-arch/xz-utils[static-libs(+)]
88 truetype? (
89 app-arch/bzip2[static-libs(+)]
90 media-libs/freetype[static-libs(+)]
91 sys-libs/zlib[static-libs(+)]
92 )
93 )
94 test? (
95 dev-libs/libisoburn
96 app-emulation/qemu
97 )
98 themes? (
99 app-arch/unzip
100 media-libs/freetype:2
101 )
102 "
103 RDEPEND+="
104 kernel_linux? (
105 grub_platforms_efi-32? ( sys-boot/efibootmgr )
106 grub_platforms_efi-64? ( sys-boot/efibootmgr )
107 )
108 !multislot? ( !sys-boot/grub:0 )
109 nls? ( sys-devel/gettext )
110 "
111
112 DEPEND+=" !!=media-libs/freetype-2.5.4"
113
114 STRIP_MASK="*/grub/*/*.{mod,img}"
115 RESTRICT="test"
116
117 QA_EXECSTACK="
118 usr/bin/grub*-emu*
119 usr/lib*/grub/*/*.mod
120 usr/lib*/grub/*/*.module
121 usr/lib*/grub/*/kernel.exec
122 usr/lib*/grub/*/kernel.img
123 "
124
125 QA_WX_LOAD="
126 usr/lib*/grub/*/kernel.exec
127 usr/lib*/grub/*/kernel.img
128 usr/lib*/grub/*/*.image
129 "
130
131 QA_PRESTRIPPED="
132 usr/lib.*/grub/.*/kernel.img
133 "
134
135 src_unpack() {
136 if [[ ${PV} == 9999 ]]; then
137 git-r3_src_unpack
138 fi
139 default_src_unpack
140 }
141
142 src_prepare() {
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 use doc && multibuild_for_best_variant run_in_build_dir \
269 emake -C docs DESTDIR="${D}" install-html
270
271 if use multislot; then
272 mv "${ED%/}"/usr/share/info/grub{,2}.info || die
273 fi
274
275 insinto /etc/default
276 newins "${FILESDIR}"/grub.default-3 grub
277 }
278
279 pkg_postinst() {
280 mount-boot_mount_boot_partition
281
282 if [[ -e "${ROOT%/}/boot/grub2/grub.cfg" ]]; then
283 ewarn "The grub directory has changed from /boot/grub2 to /boot/grub."
284 ewarn "Please run grub2-install and grub2-mkconfig -o /boot/grub/grub.cfg."
285
286 if [[ ! -e "${ROOT%/}/boot/grub/grub.cfg" ]]; then
287 mkdir -p "${ROOT%/}/boot/grub"
288 ln -s ../grub2/grub.cfg "${ROOT%/}/boot/grub/grub.cfg"
289 fi
290 fi
291
292 mount-boot_pkg_postinst
293
294 elog "For information on how to configure GRUB2 please refer to the guide:"
295 elog " http://wiki.gentoo.org/wiki/GRUB2_Quick_Start"
296
297 if has_version 'sys-boot/grub:0'; then
298 elog "A migration guide for GRUB Legacy users is available:"
299 elog " https://wiki.gentoo.org/wiki/GRUB2_Migration"
300 fi
301
302 if [[ -z ${REPLACING_VERSIONS} ]]; then
303 elog
304 elog "You may consider installing the following optional packages:"
305 optfeature "Detect other operating systems (grub-mkconfig)" sys-boot/os-prober
306 optfeature "Create rescue media (grub-mkrescue)" dev-libs/libisoburn
307 optfeature "Enable RAID device detection" sys-fs/mdadm
308 fi
309 }

  ViewVC Help
Powered by ViewVC 1.1.20