Contents of /trunk/core/grub/grub-2.06-r4.smage2
Parent Directory | Revision Log
Revision 33587 -
(show annotations)
(download)
Thu Aug 10 11:11:02 2023 UTC (9 months ago) by niro
File size: 7137 byte(s)
Thu Aug 10 11:11:02 2023 UTC (9 months ago) by niro
File size: 7137 byte(s)
-try to enable grub-mount with fuse3 and do not use the conf.d patch
1 | # $Id$ |
2 | |
3 | PNAME="grub" |
4 | PVER="2.06" |
5 | PBUILD="r4" |
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 | UNIFONT_PVER=15.0.06 |
28 | UNIFONT_SRCFILE="unifont-${UNIFONT_PVER}.pcf.gz" |
29 | |
30 | sminclude mtools |
31 | |
32 | # grub.confd revision |
33 | CONF_REV=1.4 |
34 | |
35 | SRC_URI=( |
36 | gnu://${PNAME}/${SRCFILE} |
37 | https://unifoundry.com/pub/unifont/unifont-${UNIFONT_PVER}/font-builds/${UNIFONT_SRCFILE} |
38 | mirror://${PNAME}/${SRCFILE} |
39 | mirror://${PNAME}/${UNIFONT_SRCFILE} |
40 | mirror://${PNAME}/${PNAME}-2.06-confd.patch |
41 | mirror://${PNAME}/${PNAME}-2.02-cosmetic.patch |
42 | mirror://${PNAME}/${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch |
43 | mirror://${PNAME}/${PNAME}-2.06-e2fsprogs-1.47-fixes.patch |
44 | mirror://${PNAME}/grub.confd-${CONF_REV} |
45 | ) |
46 | |
47 | UP2DATE="updatecmd_gnu ${PNAME} gz" |
48 | |
49 | # grub doesn't like CFLAG optimation, |
50 | # and do you really want that at your bootloader ?? |
51 | unset CFLAGS |
52 | unset CXXFLAGS |
53 | unset LTOFLAGS |
54 | |
55 | src_prepare() |
56 | { |
57 | munpack ${SRCFILE} || die |
58 | cd ${SRCDIR} |
59 | |
60 | # upstream fixes |
61 | mpatch -Np1 ${PNAME}-2.06-e2fsprogs-1.47-fixes.patch || die |
62 | |
63 | # use /etc/conf.d/grub instead of /etc/default/grub |
64 | mpatch ${PNAME}-2.06-confd.patch || die |
65 | # cosmetic fixes |
66 | mpatch ${PNAME}-2.02-cosmetic.patch || die |
67 | # generate pretty names from os-release if GRUB_DISTRIBUTOR is not set |
68 | mpatch ${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch |
69 | |
70 | # http://savannah.gnu.org/bugs/?40330 and https://bugs.archlinux.org/task/37847 |
71 | gzip -cd ${SOURCEDIR}/${PNAME}/${UNIFONT_SRCFILE} > unifont.bdf || die |
72 | |
73 | # # run bootstrap (only required for versions from git) |
74 | # ./bootstrap --gnulib-srcdir="${SRCDIR}/gnulib/" --no-git || die |
75 | |
76 | # setup build dirs |
77 | install -d ${SRCDIR}/build_bios || die |
78 | install -d ${SRCDIR}/build_efi || die |
79 | if [[ ${ARCH} = x86_64 ]] |
80 | then |
81 | install -d ${SRCDIR}/build_efi_ia32 || die |
82 | fi |
83 | } |
84 | |
85 | src_compile() |
86 | { |
87 | local myconf |
88 | local myarch |
89 | local efiemu |
90 | |
91 | # common configure options |
92 | # grub-mount requires fuse3 |
93 | # grub-mkfont requires freetype2 |
94 | myconf="--prefix=/usr |
95 | --mandir=/usr/share/man |
96 | --infodir=/usr/share/info |
97 | --datarootdir=/usr/share |
98 | --sysconfdir=/etc |
99 | --localstatedir=/var/lib |
100 | --libdir=/usr/$(mlibdir) |
101 | --disable-static |
102 | --enable-shared |
103 | --enable-nls |
104 | --disable-werror |
105 | --disable-silent-rules |
106 | --enable-device-mapper |
107 | --enable-cache-stats |
108 | --enable-boot-time |
109 | --enable-grub-mkfont |
110 | --disable-grub-mount |
111 | --with-bootdir=/boot |
112 | --with-grubdir=grub" |
113 | |
114 | # fix freetype build issues |
115 | export FREETYPE="pkg-config freetype2" |
116 | export BUILD_FREETYPE="pkg-config freetype2" |
117 | |
118 | # unset all build flags |
119 | unset CFLAGS |
120 | unset CPPFLAGS |
121 | unset CXXFLAGS |
122 | unset LDFLAGS |
123 | unset MAKEFLAGS |
124 | unset MAKEOPTS |
125 | |
126 | # build bios version |
127 | cd ${SRCDIR}/build_bios |
128 | myarch="i386" |
129 | |
130 | if [[ ${ARCH} = x86_64 ]] |
131 | then |
132 | efiemu="--enable-efiemu" |
133 | else |
134 | efiemu="--disable-efiemu" |
135 | fi |
136 | |
137 | ../configure --with-platform=pc --target="${myarch}" ${myconf} ${efiemu} || die |
138 | make || die |
139 | |
140 | # build efi version |
141 | cd ${SRCDIR}/build_efi |
142 | case ${ARCH} in |
143 | x86_64) myarch="${ARCH}" ;; |
144 | i*86) myarch="i386" ;; |
145 | esac |
146 | |
147 | efiemu="--disable-efiemu" |
148 | |
149 | ../configure --with-platform=efi --target="${myarch}" ${myconf} ${efiemu} || die |
150 | make || die |
151 | |
152 | # build ia32 efi version on x86_64 |
153 | if [[ ${ARCH} = x86_64 ]] |
154 | then |
155 | cd ${SRCDIR}/build_efi_ia32 |
156 | myarch="i386" |
157 | efiemu="--disable-efiemu" |
158 | |
159 | ../configure --with-platform=efi --target="${myarch}" ${myconf} ${efiemu} || die |
160 | make || die |
161 | fi |
162 | } |
163 | |
164 | src_install() |
165 | { |
166 | local myarch |
167 | |
168 | # install efi version first |
169 | cd ${SRCDIR}/build_efi |
170 | case ${ARCH} in |
171 | x86_64) myarch="${ARCH}" ;; |
172 | i*86) myarch="i386" ;; |
173 | esac |
174 | mmake DESTDIR=${BINDIR} install || die |
175 | # remove debugging related files |
176 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/\*.module || die |
177 | #mdelete -f /usr/$(mlibdir)/grub/${myarch}-efi/\*.image || die # may or may not exist |
178 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/kernel.exec || die |
179 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/gdb_grub || die |
180 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/gmodule.pl || die |
181 | |
182 | # install efi_ia32 version |
183 | if [[ ${ARCH} = x86_64 ]] |
184 | then |
185 | cd ${SRCDIR}/build_efi_ia32 |
186 | myarch="i386" |
187 | |
188 | mmake DESTDIR=${BINDIR} install || die |
189 | # remove debugging related files |
190 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/\*.module || die |
191 | #mdelete -f /usr/$(mlibdir)/grub/${myarch}-efi/\*.image || die # may or may not exist |
192 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/kernel.exec || die |
193 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/gdb_grub || die |
194 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/gmodule.pl || die |
195 | fi |
196 | |
197 | # install bios version last |
198 | cd ${SRCDIR}/build_bios |
199 | mmake DESTDIR=${BINDIR} install || die |
200 | # remove debugging related files |
201 | mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die |
202 | mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die |
203 | mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die |
204 | mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die |
205 | mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die |
206 | |
207 | # not required by pretty name patch anymore |
208 | # set distribution |
209 | #echo 'GRUB_DISTRIBUTOR="Magellan-Linux"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die |
210 | |
211 | # setup a proper grub default conf |
212 | #minstallconf grub.confd-${CONF_REV} grub || die |
213 | minstalldir /etc/default |
214 | minstallfile -s grub.confd-${CONF_REV} /etc/default/grub || die |
215 | |
216 | # enable a splash screen by default |
217 | #sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT=/s:\"\(.*\)\":\"\1 splash\":' ${BINDIR}/etc/conf.d/grub || die |
218 | sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT=/s:\"\(.*\)\":\"\1 splash\":' ${BINDIR}/etc/default/grub || die |
219 | |
220 | # needed dir |
221 | minstalldir /boot/grub || die |
222 | |
223 | # # install unifont |
224 | # minstalldir /usr/share/fonts/unifont || die |
225 | # gunzip -c ${SOURCEDIR}/${PNAME}/${UNIFONT_SRCFILE} > ${BINDIR}/usr/share/fonts/unifont/unifont.pcf || die |
226 | |
227 | # docs |
228 | cd ${SRCDIR} |
229 | minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die |
230 | } |
231 | |
232 | preinstall() |
233 | { |
234 | mount /boot &> /dev/null |
235 | } |
236 | |
237 | postinstall() |
238 | { |
239 | [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub |
240 | |
241 | # creates some essential links |
242 | [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot |
243 | |
244 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]] |
245 | then |
246 | # create a device.map |
247 | if [[ ! -f /boot/grub/device.map ]] |
248 | then |
249 | if [[ -x $(type -P grub-mkdevicemap) ]] |
250 | then |
251 | grub-mkdevicemap |
252 | fi |
253 | fi |
254 | |
255 | # needed by grub-mkconfig on the first run |
256 | if [[ ! -f /boot/grub/video.lst ]] |
257 | then |
258 | install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst |
259 | fi |
260 | |
261 | # update grub.cfg |
262 | LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg |
263 | |
264 | # install bootloader to disk |
265 | #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))" |
266 | local bootdisk |
267 | bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')" |
268 | |
269 | # Generate core.img, but don't let it be installed in boot sector |
270 | grub-install --no-floppy "${bootdisk}" |
271 | fi |
272 | } |