Magellan Linux

Contents of /trunk/core/grub/grub-2.00-r6.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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