Contents of /smage/trunk/core/grub/grub-2.12-r1.smage2
Parent Directory | Revision Log
Revision 17802 -
(show annotations)
(download)
Thu Dec 28 12:54:25 2023 UTC (5 months, 1 week ago) by niro
File size: 9533 byte(s)
Thu Dec 28 12:54:25 2023 UTC (5 months, 1 week ago) by niro
File size: 9533 byte(s)
-ver bump to 2.12-r1
1 | # $Id$ |
2 | |
3 | PNAME="grub" |
4 | PVER="2.12" |
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-libs/zlib-1.2 |
15 | >= media-libs/freetype-2.13 |
16 | >= app-arch/liblzma-5.4 |
17 | >= sys-fs/device-mapper-2.02 |
18 | >= sys-fs/dosfstools-4.2 |
19 | >= sys-apps/efibootmgr-18" |
20 | |
21 | SDEPEND=">= virtual/pkgconfig |
22 | >= net-misc/rsync-3 |
23 | >= app-text/help2man-1 |
24 | >= sys-dev/autogen-5 |
25 | >= sys-dev/autoconf-10 |
26 | >= sys-dev/automake-10 |
27 | >= sys-libs/ncurses-dev-6.4 |
28 | >= app-arch/liblzma-dev-5.4 |
29 | >= media-libs/freetype-dev-2.13 |
30 | >= virtual/xz-utils |
31 | >= sys-fs/device-mapper-dev-2.02 |
32 | >= sys-fs/dosfstools-dev-4.2 |
33 | >= sys-apps/efibootmgr-dev-18" |
34 | |
35 | SRCFILE="${PNAME}-${PVER}.tar.gz" |
36 | SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" |
37 | |
38 | UNIFONT_PVER=15.1.04 |
39 | UNIFONT_SRCFILE="unifont-${UNIFONT_PVER}.pcf.gz" |
40 | |
41 | if [[ ${GRUB_GIT_SOURCE} = 1 ]] |
42 | then |
43 | GNULIB_SRCFILE="gnulib-20230809.tar.bz2" |
44 | GNULIB_SRCDIR="${BUILDDIR}/gnulib" |
45 | fi |
46 | |
47 | ALX_PKG_KEEP="boot/grub |
48 | etc/conf.d |
49 | etc/grub.d/00_header |
50 | etc/grub.d/10_linux |
51 | etc/grub.d/30_uefi-firmware |
52 | usr/sbin/grub-bios-setup |
53 | usr/sbin/grub-install |
54 | usr/sbin/grub-mkconfig |
55 | usr/sbin/grub-probe |
56 | usr/sbin/grub-reboot |
57 | usr/sbin/grub-set-default |
58 | usr/bin/grub-mkimage |
59 | usr/bin/grub-editenv |
60 | usr/bin/grub-mkrelpath |
61 | usr/bin/grub-script-check |
62 | usr/share/grub/grub-mkconfig_lib |
63 | usr/$(mlibdir)/grub/i386-pc |
64 | usr/$(mlibdir)/grub/i386-efi |
65 | usr/$(mlibdir)/grub/x86_64-efi" |
66 | sminclude mtools alx-split |
67 | |
68 | # grub.confd revision |
69 | CONF_REV=1.4 |
70 | |
71 | # grub sources from git |
72 | # 1=yes; 0=no |
73 | GRUB_GIT_SOURCE=0 |
74 | |
75 | # build ia32 on x64 platforms |
76 | # 1=yes; 0=no |
77 | BUILD_X64_IA32=1 |
78 | |
79 | msetfeature "!strip static !ccache !distcc" |
80 | |
81 | SRC_URI=( |
82 | gnu://${PNAME}/${SRCFILE} |
83 | https://unifoundry.com/pub/unifont/unifont-${UNIFONT_PVER}/font-builds/${UNIFONT_SRCFILE} |
84 | mirror://${PNAME}/${SRCFILE} |
85 | mirror://${PNAME}/${UNIFONT_SRCFILE} |
86 | mirror://${PNAME}/${PNAME}-2.12-confd.patch |
87 | mirror://${PNAME}/${PNAME}-2.12-cosmetic.patch |
88 | mirror://${PNAME}/${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch |
89 | mirror://${PNAME}/${PNAME}-2.00-alx-add-includedir-function.patch |
90 | mirror://${PNAME}/${PNAME}-2.12-ftbfs-extra-deps.patch |
91 | mirror://${PNAME}/grub.confd-${CONF_REV} |
92 | ) |
93 | |
94 | if [[ ${GRUB_GIT_SOURCE} = 1 ]] |
95 | then |
96 | SRC_URI+=( mirror://${PNAME}/${GNULIB_SRCFILE} ) |
97 | fi |
98 | |
99 | UP2DATE="updatecmd_gnu ${PNAME} gz" |
100 | |
101 | # grub doesn't like CFLAG optimation, |
102 | # and do you really want that at your bootloader ?? |
103 | unset CFLAGS |
104 | unset CXXFLAGS |
105 | unset LTOFLAGS |
106 | |
107 | src_prepare() |
108 | { |
109 | munpack ${SRCFILE} || die |
110 | if [[ ${GRUB_GIT_SOURCE} = 1 ]] |
111 | then |
112 | munpack ${GNULIB_SRCFILE} || die |
113 | fi |
114 | cd ${SRCDIR} |
115 | |
116 | # fix a ftbfs - upstream |
117 | # see: https://www.mail-archive.com/grub-devel@gnu.org/msg37754.html |
118 | mpatch ${PNAME}-2.12-ftbfs-extra-deps.patch || die |
119 | # create missing file |
120 | [ -e grub-core/extra_deps.lst ] || echo 'depends bli part_gpt' > grub-core/extra_deps.lst || die |
121 | |
122 | # use /etc/conf.d/grub instead of /etc/default/grub |
123 | mpatch ${PNAME}-2.12-confd.patch || die |
124 | # cosmetic fixes |
125 | mpatch ${PNAME}-2.12-cosmetic.patch || die |
126 | # generate pretty names from os-release if GRUB_DISTRIBUTOR is not set |
127 | mpatch ${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch |
128 | |
129 | # add includedir() function to grub-mkconfig_lib |
130 | # includedir() includes all grub configuration snippets of given directory |
131 | mpatch ${PNAME}-2.00-alx-add-includedir-function.patch || die |
132 | |
133 | # http://savannah.gnu.org/bugs/?40330 and https://bugs.archlinux.org/task/37847 |
134 | gzip -cd ${SOURCEDIR}/${PNAME}/${UNIFONT_SRCFILE} > unifont.bdf || die |
135 | |
136 | if [[ ${GRUB_GIT_SOURCE} = 1 ]] |
137 | then |
138 | # run bootstrap (only required for versions from git) |
139 | ./bootstrap --gnulib-srcdir=${GNULIB_SRCDIR} --no-git || die |
140 | fi |
141 | |
142 | # regen aclocal with automake 1.16 |
143 | WANT_AUTOMAKE=1.16 ./autogen.sh || die |
144 | |
145 | # setup build dirs |
146 | cp -r ${SRCDIR} ${BUILDDIR}/build_bios || die |
147 | cp -r ${SRCDIR} ${BUILDDIR}/build_efi || die |
148 | if [[ ${ARCH} = x86_64 ]] && [[ ${BUILD_X64_IA32} = 1 ]] |
149 | then |
150 | cp -r ${SRCDIR} ${BUILDDIR}/build_efi_ia32 || die |
151 | fi |
152 | } |
153 | |
154 | src_compile() |
155 | { |
156 | local myconf |
157 | local myarch |
158 | local efiemu |
159 | |
160 | # alx: --disable-nls |
161 | # |
162 | # common configure options |
163 | # grub-mount requires fuse3 |
164 | # grub-mkfont requires freetype2 |
165 | myconf="--prefix=/usr |
166 | --mandir=/usr/share/man |
167 | --infodir=/usr/share/info |
168 | --datarootdir=/usr/share |
169 | --sysconfdir=/etc |
170 | --localstatedir=/var/lib |
171 | --libdir=/usr/$(mlibdir) |
172 | --disable-static |
173 | --enable-shared |
174 | --disable-nls |
175 | --disable-werror |
176 | --disable-silent-rules |
177 | --enable-device-mapper |
178 | --enable-cache-stats |
179 | --enable-boot-time |
180 | --enable-grub-mkfont |
181 | --disable-grub-mount |
182 | --with-bootdir=/boot |
183 | --with-grubdir=grub" |
184 | |
185 | # fix freetype build issues |
186 | export FREETYPE="pkg-config freetype2" |
187 | export BUILD_FREETYPE="pkg-config freetype2" |
188 | |
189 | # set version |
190 | export PACKAGE_VERSION="${PVER}-${PBUILD}" |
191 | |
192 | # unset all build flags |
193 | unset CFLAGS |
194 | unset CPPFLAGS |
195 | unset CXXFLAGS |
196 | unset LDFLAGS |
197 | unset LTOFLAGS |
198 | unset MAKEFLAGS |
199 | unset MAKEOPTS |
200 | |
201 | # build bios version |
202 | cd ${BUILDDIR}/build_bios |
203 | myarch="i386" |
204 | |
205 | if [[ ${ARCH} = x86_64 ]] |
206 | then |
207 | efiemu="--enable-efiemu" |
208 | else |
209 | efiemu="--disable-efiemu" |
210 | fi |
211 | |
212 | ./configure --with-platform=pc --target="${myarch}" ${myconf} ${efiemu} || die |
213 | make || die |
214 | |
215 | # build efi version |
216 | cd ${BUILDDIR}/build_efi |
217 | case ${ARCH} in |
218 | x86_64) myarch="${ARCH}" ;; |
219 | i*86) myarch="i386" ;; |
220 | esac |
221 | |
222 | efiemu="--disable-efiemu" |
223 | |
224 | ./configure --with-platform=efi --target="${myarch}" ${myconf} ${efiemu} || die |
225 | make || die |
226 | |
227 | # build ia32 efi version on x86_64 |
228 | if [[ ${ARCH} = x86_64 ]] && [[ ${BUILD_X64_IA32} = 1 ]] |
229 | then |
230 | cd ${BUILDDIR}/build_efi_ia32 |
231 | myarch="i386" |
232 | efiemu="--disable-efiemu" |
233 | |
234 | ./configure --with-platform=efi --target="${myarch}" ${myconf} ${efiemu} || die |
235 | make || die |
236 | fi |
237 | } |
238 | |
239 | alx_generic_src_install() |
240 | { |
241 | local myarch |
242 | |
243 | # install efi version first |
244 | cd ${BUILDDIR}/build_efi |
245 | case ${ARCH} in |
246 | x86_64) myarch="${ARCH}" ;; |
247 | i*86) myarch="i386" ;; |
248 | esac |
249 | make DESTDIR=${BINDIR} install || die |
250 | # remove debugging related files |
251 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/\*.module || die |
252 | #mdelete -f /usr/$(mlibdir)/grub/${myarch}-efi/\*.image || die # may or may not exist |
253 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/kernel.exec || die |
254 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/gdb_grub || die |
255 | #mdelete /usr/$(mlibdir)/grub/${myarch}-efi/gmodule.pl || die |
256 | |
257 | # install efi_ia32 version |
258 | if [[ ${ARCH} = x86_64 ]] && [[ ${BUILD_X64_IA32} = 1 ]] |
259 | then |
260 | cd ${BUILDDIR}/build_efi_ia32 |
261 | myarch="i386" |
262 | |
263 | make DESTDIR=${BINDIR} install || die |
264 | # remove debugging related files |
265 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/\*.module || die |
266 | #mdelete -f /usr/$(mlibdir)/grub/${myarch}-efi/\*.image || die # may or may not exist |
267 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/kernel.exec || die |
268 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/gdb_grub || die |
269 | #mdelete /usr/$(mlibdir)/grub/${myarch}-efi/gmodule.pl || die |
270 | fi |
271 | |
272 | # install bios version last |
273 | cd ${BUILDDIR}/build_bios |
274 | make DESTDIR=${BINDIR} install || die |
275 | # remove debugging related files |
276 | mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die |
277 | mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die |
278 | mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die |
279 | mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die |
280 | #mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die |
281 | |
282 | # not required by pretty name patch anymore |
283 | # set distribution |
284 | #echo 'GRUB_DISTRIBUTOR="Magellan-Linux"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die |
285 | |
286 | # # setup a proper grub default conf |
287 | # minstallconf grub.confd-${CONF_REV} grub || die |
288 | # |
289 | # # enable a splash screen by default |
290 | # sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT=/s:\"\(.*\)\":\"\1 splash\":' ${BINDIR}/etc/conf.d/grub || die |
291 | |
292 | # install alx grub conf file |
293 | minstalldir /etc/conf.d || die |
294 | mcinjectfile grub.confd /etc/conf.d/grub || die |
295 | |
296 | # needed dir |
297 | minstalldir /boot/grub || die |
298 | |
299 | # install unifont |
300 | minstalldir /usr/share/fonts/unifont || die |
301 | gunzip -c ${SOURCEDIR}/grub/${UNIFONT_SRCFILE} > ${BINDIR}/usr/share/fonts/unifont/unifont.pcf || die |
302 | |
303 | # docs |
304 | cd ${SRCDIR} |
305 | minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die |
306 | } |
307 | |
308 | preinstall_grub() |
309 | { |
310 | mount /boot &> /dev/null |
311 | |
312 | add_conf_prot_mask /etc/conf.d/grub /etc/grub.d /etc/conf.d/grub.d |
313 | } |
314 | |
315 | postinstall_grub() |
316 | { |
317 | [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub |
318 | |
319 | # creates some essential links |
320 | [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot |
321 | |
322 | # clean up old helpers, which are now consolidated to the '10_alx' script, and delete 10_alx too, we're using 10_linux now |
323 | local i |
324 | for i in 30_alx_hwdetect 40_alx_reset 10-alx |
325 | do |
326 | if [ -f ${MROOT}/etc/grub/${i} ] |
327 | then |
328 | rm ${MROOT}/etc/grub/${i} |
329 | fi |
330 | done |
331 | if [ -f ${MROOT}/etc/conf.d/grub.conf.d/10-alx ] |
332 | then |
333 | rm ${MROOT}/etc/conf.d/grub.conf.d/10-alx |
334 | fi |
335 | |
336 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]] |
337 | then |
338 | # create a device.map |
339 | if [[ ! -f /boot/grub/device.map ]] |
340 | then |
341 | if [[ -x $(type -P grub-mkdevicemap) ]] |
342 | then |
343 | grub-mkdevicemap |
344 | fi |
345 | fi |
346 | |
347 | # needed by grub-mkconfig on the first run |
348 | if [[ ! -f /boot/grub/video.lst ]] |
349 | then |
350 | install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst |
351 | fi |
352 | |
353 | # update grub.cfg |
354 | LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg |
355 | |
356 | # install bootloader to disk |
357 | #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))" |
358 | local bootdisk |
359 | bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')" |
360 | |
361 | # Generate core.img, but don't let it be installed in boot sector |
362 | grub-install --no-floppy "${bootdisk}" |
363 | fi |
364 | } |