Annotation of /trunk/core/grub/grub-2.02-r2.smage2
Parent Directory | Revision Log
Revision 32053 -
(hide annotations)
(download)
Mon Mar 11 18:09:24 2019 UTC (5 years, 6 months ago) by niro
File size: 4925 byte(s)
Mon Mar 11 18:09:24 2019 UTC (5 years, 6 months ago) by niro
File size: 4925 byte(s)
-enabled efi grub build
1 | niro | 32047 | # $Id$ |
2 | |||
3 | PNAME="grub" | ||
4 | PVER="2.02" | ||
5 | PBUILD="r2" | ||
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 | >= sys-fs/dosfstools-4.1" | ||
21 | |||
22 | niro | 32049 | SDEPEND=">= dev-util/pkgconfig-0.25" |
23 | |||
24 | niro | 32047 | 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.02-confd-2.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}/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}-2.02-confd-2.patch || die | ||
55 | # cosmetic fixes | ||
56 | mpatch ${PNAME}-2.02-cosmetic.patch || die | ||
57 | # generate pretty names from os-release if GRUB_DISTRIBUTOR is not set | ||
58 | mpatch ${PNAME}-2.00-10_linux-pretty-names-from-etc-os-release.patch | ||
59 | |||
60 | # setup build dirs | ||
61 | install -d ${SRCDIR}/build_bios || die | ||
62 | install -d ${SRCDIR}/build_efi || die | ||
63 | } | ||
64 | |||
65 | src_compile() | ||
66 | { | ||
67 | local myconf | ||
68 | local myarch | ||
69 | |||
70 | # common configure options | ||
71 | # grub-mount requires fuse2 | ||
72 | # grub-mkfont requires freetype2 | ||
73 | myconf="--prefix=/usr | ||
74 | --host=${CHOST} | ||
75 | --build=${CHOST} | ||
76 | --mandir=/usr/share/man | ||
77 | --infodir=/usr/share/info | ||
78 | --datadir=/usr/share | ||
79 | --sysconfdir=/etc | ||
80 | --localstatedir=/var/lib | ||
81 | --libdir=/usr/$(mlibdir) | ||
82 | --disable-static | ||
83 | --enable-shared | ||
84 | --disable-efiemu | ||
85 | --disable-werror | ||
86 | --enable-device-mapper | ||
87 | --enable-grub-mkfont | ||
88 | --disable-grub-mount" | ||
89 | |||
90 | # fix freetype build issues | ||
91 | niro | 32050 | export FREETYPE="pkg-config freetype2" |
92 | export BUILD_FREETYPE="pkg-config freetype2" | ||
93 | niro | 32047 | |
94 | # build bios version | ||
95 | cd ${SRCDIR}/build_bios | ||
96 | myarch="i386" | ||
97 | ../configure --with-platform=pc --target="${myarch}" ${myconf} || die | ||
98 | mmake || die | ||
99 | |||
100 | # build efi version | ||
101 | cd ${SRCDIR}/build_efi | ||
102 | case ${ARCH} in | ||
103 | x86_64) myarch="${ARCH}" ;; | ||
104 | i*86) myarch="i386" ;; | ||
105 | esac | ||
106 | ../configure --with-platform=efi --target="${myarch}" ${myconf} || die | ||
107 | mmake || die | ||
108 | } | ||
109 | |||
110 | src_install() | ||
111 | { | ||
112 | local myarch | ||
113 | |||
114 | # install bios version | ||
115 | cd ${SRCDIR}/build_bios | ||
116 | mmake DESTDIR=${BINDIR} install || die | ||
117 | # remove debugging related files | ||
118 | mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die | ||
119 | mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die | ||
120 | mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die | ||
121 | mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die | ||
122 | mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die | ||
123 | |||
124 | # install efi version | ||
125 | cd ${SRCDIR}/build_efi | ||
126 | case ${ARCH} in | ||
127 | x86_64) myarch="${ARCH}" ;; | ||
128 | i*86) myarch="i386" ;; | ||
129 | esac | ||
130 | mmake DESTDIR=${BINDIR} install || die | ||
131 | # remove debugging related files | ||
132 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/\*.module || die | ||
133 | niro | 32053 | #mdelete -f /usr/$(mlibdir)/grub/${myarch}-efi/\*.image || die # may or may not exist |
134 | niro | 32047 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/kernel.exec || die |
135 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/gdb_grub || die | ||
136 | mdelete /usr/$(mlibdir)/grub/${myarch}-efi/gmodule.pl || die | ||
137 | |||
138 | # not required by pretty name patch anymore | ||
139 | # set distribution | ||
140 | #echo 'GRUB_DISTRIBUTOR="Magellan-Linux"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die | ||
141 | |||
142 | # setup a proper grub default conf | ||
143 | minstallconf grub.confd-${CONF_REV} grub || die | ||
144 | |||
145 | # enable a splash screen by default | ||
146 | sed -i '/^GRUB_CMDLINE_LINUX_DEFAULT=/s:\"\(.*\)\":\"\1 splash\":' ${BINDIR}/etc/conf.d/grub || die | ||
147 | |||
148 | # needed dir | ||
149 | minstalldir /boot/grub || die | ||
150 | |||
151 | # docs | ||
152 | cd ${SRCDIR} | ||
153 | minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die | ||
154 | } | ||
155 | |||
156 | preinstall() | ||
157 | { | ||
158 | mount /boot &> /dev/null | ||
159 | } | ||
160 | |||
161 | postinstall() | ||
162 | { | ||
163 | [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub | ||
164 | |||
165 | # creates some essential links | ||
166 | [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot | ||
167 | |||
168 | if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]] | ||
169 | then | ||
170 | # create a device.map | ||
171 | if [[ ! -f /boot/grub/device.map ]] | ||
172 | then | ||
173 | if [[ -x $(type -P grub-mkdevicemap) ]] | ||
174 | then | ||
175 | grub-mkdevicemap | ||
176 | fi | ||
177 | fi | ||
178 | |||
179 | # needed by grub-mkconfig on the first run | ||
180 | if [[ ! -f /boot/grub/video.lst ]] | ||
181 | then | ||
182 | install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst | ||
183 | fi | ||
184 | |||
185 | # update grub.cfg | ||
186 | LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg | ||
187 | |||
188 | # install bootloader to disk | ||
189 | #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))" | ||
190 | local bootdisk | ||
191 | bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')" | ||
192 | |||
193 | # Generate core.img, but don't let it be installed in boot sector | ||
194 | grub-install --no-floppy "${bootdisk}" | ||
195 | fi | ||
196 | } |