Contents of /trunk/core/grub/grub-2.06-r1.smage2
Parent Directory | Revision Log
Revision 33527 -
(show annotations)
(download)
Mon Jul 31 11:12:33 2023 UTC (9 months, 3 weeks ago) by niro
File size: 5372 byte(s)
Mon Jul 31 11:12:33 2023 UTC (9 months, 3 weeks ago) by niro
File size: 5372 byte(s)
-ver bump to 2.06-r1
1 | # $Id$ |
2 | |
3 | PNAME="grub" |
4 | PVER="2.06" |
5 | PBUILD="r1" |
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-6.4 |
14 | >= sys-dev/gettext-0.22 |
15 | >= sys-libs/zlib-1.2 |
16 | >= media-libs/freetype-2.13 |
17 | >= virtual/xz-utils |
18 | >= sys-apps/os-prober-1.56 |
19 | >= sys-fs/device-mapper-2.02 |
20 | >= sys-fs/dosfstools-4.2" |
21 | |
22 | SDEPEND=">= virtual/pkgconfig" |
23 | |
24 | SRCFILE="${PNAME}-${PVER}.tar.gz" |
25 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
26 | |
27 | sminclude mtools |
28 | |
29 | # grub.confd revision |
30 | CONF_REV=1.4 |
31 | |
32 | SRC_URI=( |
33 | gnu://${PNAME}/${SRCFILE} |
34 | mirror://${PNAME}/${SRCFILE} |
35 | mirror://${PNAME}/${PNAME}-2.06-confd.patch |
36 | mirror://${PNAME}/${PNAME}-2.02-cosmetic.patch |
37 | mirror://${PNAME}/${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch |
38 | mirror://${PNAME}/${PNAME}-2.06-e2fsprogs-1.47-fixes.patch |
39 | mirror://${PNAME}/grub.confd-${CONF_REV} |
40 | ) |
41 | |
42 | UP2DATE="updatecmd_gnu ${PNAME} gz" |
43 | |
44 | # grub doesn't like CFLAG optimation, |
45 | # and do you really want that at your bootloader ?? |
46 | unset CFLAGS |
47 | unset CXXFLAGS |
48 | |
49 | src_prepare() |
50 | { |
51 | munpack ${SRCFILE} || die |
52 | cd ${SRCDIR} |
53 | |
54 | # upstream fixes |
55 | mpatch -Np1 ${PNAME}-2.06-e2fsprogs-1.47-fixes.patch || die |
56 | |
57 | # use /etc/conf.d/grub instead of /etc/default/grub |
58 | mpatch ${PNAME}-2.06-confd.patch || die |
59 | # cosmetic fixes |
60 | mpatch ${PNAME}-2.02-cosmetic.patch || die |
61 | # generate pretty names from os-release if GRUB_DISTRIBUTOR is not set |
62 | mpatch ${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch |
63 | |
64 | # setup build dirs |
65 | install -d ${SRCDIR}/build_bios || die |
66 | install -d ${SRCDIR}/build_efi || die |
67 | } |
68 | |
69 | src_compile() |
70 | { |
71 | local myconf |
72 | local myarch |
73 | local efiemu |
74 | |
75 | # common configure options |
76 | # grub-mount requires fuse2 |
77 | # grub-mkfont requires freetype2 |
78 | myconf="--prefix=/usr |
79 | --host=${CHOST} |
80 | --build=${CHOST} |
81 | --mandir=/usr/share/man |
82 | --infodir=/usr/share/info |
83 | --datarootdir=/usr/share |
84 | --sysconfdir=/etc |
85 | --localstatedir=/var/lib |
86 | --libdir=/usr/$(mlibdir) |
87 | --disable-static |
88 | --enable-shared |
89 | --disable-werror |
90 | --disable-silent-rules |
91 | --enable-device-mapper |
92 | --enable-cache-stats |
93 | --enable-boot-time |
94 | --enable-grub-mkfont |
95 | --disable-grub-mount" |
96 | |
97 | # fix freetype build issues |
98 | export FREETYPE="pkg-config freetype2" |
99 | export BUILD_FREETYPE="pkg-config freetype2" |
100 | |
101 | # unset all build flags |
102 | unset CFLAGS |
103 | unset CPPFLAGS |
104 | unset CXXFLAGS |
105 | unset LDFLAGS |
106 | unset MAKEFLAGS |
107 | |
108 | # build bios version |
109 | cd ${SRCDIR}/build_bios |
110 | myarch="i386" |
111 | |
112 | if [[ ${ARCH} = x86_64 ]] |
113 | then |
114 | efiemu="--enable-efiemu" |
115 | else |
116 | efiemu="--disable-efiemu" |
117 | fi |
118 | |
119 | ../configure --with-platform=pc --target="${myarch}" ${myconf} ${efiemu} || die |
120 | mmake || die |
121 | |
122 | # build efi version |
123 | cd ${SRCDIR}/build_efi |
124 | case ${ARCH} in |
125 | x86_64) myarch="${ARCH}" ;; |
126 | i*86) myarch="i386" ;; |
127 | esac |
128 | |
129 | efiemu="--disable-efiemu" |
130 | |
131 | ../configure --with-platform=efi --target="${myarch}" ${myconf} ${efiemu} || die |
132 | mmake || die |
133 | } |
134 | |
135 | src_install() |
136 | { |
137 | local myarch |
138 | |
139 | # install bios version |
140 | cd ${SRCDIR}/build_bios |
141 | mmake DESTDIR=${BINDIR} install || die |
142 | # remove debugging related files |
143 | mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die |
144 | mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die |
145 | mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die |
146 | mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die |
147 | mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die |
148 | |
149 | # install efi version |
150 | cd ${SRCDIR}/build_efi |
151 | case ${ARCH} in |
152 | x86_64) myarch="${ARCH}" ;; |
153 | i*86) myarch="i386" ;; |
154 | esac |
155 | mmake DESTDIR=${BINDIR} install || die |
156 | # remove debugging related files |
157 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/\*.module || die |
158 | #mdelete -f /usr/$(mlibdir)/grub/${myarch}-efi/\*.image || die # may or may not exist |
159 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/kernel.exec || die |
160 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/gdb_grub || die |
161 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/gmodule.pl || die |
162 | |
163 | # not required by pretty name patch anymore |
164 | # set distribution |
165 | #echo 'GRUB_DISTRIBUTOR="Magellan-Linux"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die |
166 | |
167 | # setup a proper grub default conf |
168 | minstallconf grub.confd-${CONF_REV} grub || die |
169 | |
170 | # enable a splash screen by default |
171 | sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT=/s:\"\(.*\)\":\"\1 splash\":' ${BINDIR}/etc/conf.d/grub || die |
172 | |
173 | # needed dir |
174 | minstalldir /boot/grub || die |
175 | |
176 | # docs |
177 | cd ${SRCDIR} |
178 | minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die |
179 | } |
180 | |
181 | preinstall() |
182 | { |
183 | mount /boot &> /dev/null |
184 | } |
185 | |
186 | postinstall() |
187 | { |
188 | [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub |
189 | |
190 | # creates some essential links |
191 | [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot |
192 | |
193 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]] |
194 | then |
195 | # create a device.map |
196 | if [[ ! -f /boot/grub/device.map ]] |
197 | then |
198 | if [[ -x $(type -P grub-mkdevicemap) ]] |
199 | then |
200 | grub-mkdevicemap |
201 | fi |
202 | fi |
203 | |
204 | # needed by grub-mkconfig on the first run |
205 | if [[ ! -f /boot/grub/video.lst ]] |
206 | then |
207 | install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst |
208 | fi |
209 | |
210 | # update grub.cfg |
211 | LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg |
212 | |
213 | # install bootloader to disk |
214 | #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))" |
215 | local bootdisk |
216 | bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')" |
217 | |
218 | # Generate core.img, but don't let it be installed in boot sector |
219 | grub-install --no-floppy "${bootdisk}" |
220 | fi |
221 | } |