Magellan Linux

Annotation of /trunk/core/grub/grub-2.02-r3.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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