Magellan Linux

Contents of /branches/R11-stable/core/grub/grub-2.00-r5.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 21622 - (show annotations) (download)
Mon Jul 21 09:23:15 2014 UTC (9 years, 10 months ago) by niro
File size: 3224 byte(s)
-release branches/R11-stable
1 # $Id$
2
3 PNAME="grub"
4 PVER="2.00"
5 PBUILD="r5"
6
7 PCAT="sys-apps"
8
9 DESCRIPTION="GNU GRUB2 boot loader."
10 HOMEPAGE="http://www.gnu.org/software/grub/"
11
12 DEPEND=">= sys-libs/ncurses-5.9
13 >= sys-libs/zlib-1.2.5
14 >= media-libs/freetype-2.5
15 >= app-arch/xz-utils-5
16 >= sys-apps/os-prober-1.56
17 >= sys-fs/device-mapper-2.02"
18
19 SRCFILE="${PNAME}-${PVER}.tar.gz"
20 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
21
22 sminclude mtools
23
24 # grub.confd revision
25 CONF_REV=1.4
26
27 SRC_URI=(
28 gnu://${PNAME}/${SRCFILE}
29 mirror://${PNAME}/${SRCFILE}
30 mirror://${PNAME}/${PNAME}-${PVER}-confd.patch
31 mirror://${PNAME}/${PNAME}-${PVER}-cosmetic.patch
32 mirror://${PNAME}/${PNAME}-${PVER}-gnulib-gets.patch
33 mirror://${PNAME}/${PNAME}-${PVER}-freetype25.patch
34 mirror://${PNAME}/grub.confd-${CONF_REV}
35 )
36
37 UP2DATE="updatecmd_gnu ${PNAME} gz"
38
39 # grub doesn't like CFLAG optimation,
40 # and do you really want that at your bootloader ??
41 unset CFLAGS
42 unset CXXFLAGS
43
44 src_prepare()
45 {
46 munpack ${SRCFILE} || die
47 cd ${SRCDIR}
48
49 # use /etc/conf.d/grub instead of /etc/default/grub
50 mpatch ${PNAME}-${PVER}-confd.patch || die
51 # cosmetic fixes
52 mpatch ${PNAME}-${PVER}-cosmetic.patch || die
53 # fix ftbfs with newer glibc (>= 2.16)
54 mpatch ${PNAME}-${PVER}-gnulib-gets.patch || die
55 # fix ftbfs with newer freetype (>= 2.5)
56 mpatch ${PNAME}-${PVER}-freetype25.patch || die
57 }
58
59 src_compile()
60 {
61 cd ${SRCDIR}
62
63 mconfigure --disable-efiemu --disable-werror || die
64 mmake || die
65 }
66
67 src_install()
68 {
69 cd ${SRCDIR}
70
71 mmake DESTDIR=${BINDIR} install || die
72
73 # set distribution
74 echo 'GRUB_DISTRIBUTOR="Magellan-Linux"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die
75
76 # setup a proper grub default conf
77 minstallconf grub.confd-${CONF_REV} grub || die
78
79 # enable a splash screen by default
80 sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT=/s:\"\(.*\)\":\"\1 splash\":' ${BINDIR}/etc/conf.d/grub || die
81
82 # needed dir
83 minstalldir /boot/grub || die
84
85 # remove debugging related files
86 rm -v ${BINDIR}/usr/$(mlibdir)/grub/i386-pc/*.module || die
87 rm -v ${BINDIR}/usr/$(mlibdir)/grub/i386-pc/*.image || die
88 mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die
89 mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die
90 mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die
91
92 # docs
93 minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die
94 }
95
96 preinstall()
97 {
98 mount /boot &> /dev/null
99 }
100
101 postinstall()
102 {
103 [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub
104
105 # creates some essential links
106 [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot
107
108 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
109 then
110 # create a device.map
111 if [[ ! -f /boot/grub/device.map ]]
112 then
113 grub-mkdevicemap
114 fi
115
116 # needed by grub-mkconfig on the first run
117 if [[ ! -f /boot/grub/video.lst ]]
118 then
119 install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst
120 fi
121
122 # update grub.cfg
123 LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg
124
125 # install bootloader to disk
126 #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))"
127 local bootdisk
128 bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')"
129
130 # Generate core.img, but don't let it be installed in boot sector
131 grub-install --no-floppy "${bootdisk}"
132 fi
133 }