Magellan Linux

Contents of /smage/trunk/core/grub/grub-2.00-r12.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 9049 - (show annotations) (download)
Mon Jun 13 11:42:19 2016 UTC (7 years, 10 months ago) by niro
File size: 5907 byte(s)
-added missing gettext sdep
1 # $Id$
2
3 PNAME="grub"
4 PVER="2.00"
5 PBUILD="r12"
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-libs/zlib-1.2.5
15 >= media-libs/freetype-2.5
16 >= sys-fs/device-mapper-2.02"
17
18 SDEPEND=">= sys-libs/ncurses-dev-5.9
19 >= sys-libs/zlib-dev-1.2.5
20 >= media-libs/freetype-dev-2.5
21 >= sys-dev/gettext-0.19"
22
23 SRCFILE="${PNAME}-${PVER}.tar.gz"
24 SRCDIR="${BUILDDIR}/${PNAME}-${PVER}"
25
26 ALX_PKG_KEEP="boot/grub
27 etc/conf.d
28 etc/grub.d
29 usr/sbin/grub-bios-setup
30 usr/sbin/grub-install
31 usr/sbin/grub-mkconfig
32 usr/sbin/grub-probe
33 usr/sbin/grub-reboot
34 usr/sbin/grub-set-default
35 usr/bin/grub-mkimage
36 usr/bin/grub-editenv
37 usr/bin/grub-mkrelpath
38 usr/bin/grub-script-check
39 usr/share/grub/grub-mkconfig_lib
40 usr/$(mlibdir)/grub/i386-pc"
41 sminclude mtools alx-split
42
43 # += to add injection files (alx.sminc)
44 SRC_URI+=(
45 gnu://${PNAME}/${SRCFILE}
46 mirror://${PNAME}/${SRCFILE}
47 mirror://${PNAME}/${PNAME}-${PVER}-confd.patch
48 mirror://${PNAME}/${PNAME}-${PVER}-cosmetic.patch
49 mirror://${PNAME}/${PNAME}-${PVER}-gnulib-gets.patch
50 mirror://${PNAME}/${PNAME}-${PVER}-freetype25.patch
51 mirror://${PNAME}/${PNAME}-${PVER}-10_linux-pretty-names-from-etc-os-release.patch
52 mirror://${PNAME}/${PNAME}-${PVER}-busybox.patch
53 mirror://${PNAME}/${PNAME}-${PVER}-alx-add-includedir-function.patch
54 mirror://${PNAME}/${PNAME}-${PVER}-alx-grub-install-fix-includedir-function-error-msg.patch
55 mirror://${PNAME}/${PNAME}-${PVER}-busybox-linux-install.patch
56 )
57
58 UP2DATE="updatecmd_gnu ${PNAME} gz"
59
60 # grub doesn't like CFLAG optimation,
61 # and do you really want that at your bootloader ??
62 unset CFLAGS
63 unset CXXFLAGS
64
65 src_prepare()
66 {
67 munpack ${SRCFILE} || die
68 cd ${SRCDIR}
69
70 # use /etc/conf.d/grub instead of /etc/default/grub
71 mpatch ${PNAME}-${PVER}-confd.patch || die
72 # cosmetic fixes
73 mpatch ${PNAME}-${PVER}-cosmetic.patch || die
74 # fix ftbfs with newer glibc (>= 2.16)
75 mpatch ${PNAME}-${PVER}-gnulib-gets.patch || die
76 # fix ftbfs with newer freetype (>= 2.5)
77 mpatch ${PNAME}-${PVER}-freetype25.patch || die
78 # generate pretty names from os-release if GRUB_DISTRIBUTOR is not set
79 mpatch ${PNAME}-${PVER}-10_linux-pretty-names-from-etc-os-release.patch
80
81 # fixes some issues with busybox
82 mpatch ${PNAME}-${PVER}-busybox.patch || die
83 mpatch ${PNAME}-${PVER}-busybox-linux-install.patch || die
84
85 # add includedir() function to grub-mkconfig_lib
86 # includedir() includes all grub configuration snippets of given directory
87 mpatch ${PNAME}-${PVER}-alx-add-includedir-function.patch || die
88 mpatch ${PNAME}-${PVER}-alx-grub-install-fix-includedir-function-error-msg.patch || die
89 }
90
91 src_compile()
92 {
93 cd ${SRCDIR}
94
95 mconfigure --disable-efiemu --disable-werror --disable-nls || die
96 mmake || die
97 }
98
99 alx_generic_src_install()
100 {
101 cd ${SRCDIR}
102
103 mmake DESTDIR=${BINDIR} install || die
104
105 # not required by pretty name patch anymore
106 # set distribution
107 #echo 'GRUB_DISTRIBUTOR="ALX Thinclient"' >> ${BINDIR}/usr/share/grub/grub-mkconfig_lib || die
108
109 # install only grub dir, no default config
110 minstalldir /boot/grub || die
111
112 # remove debugging related files
113 mdelete /usr/$(mlibdir)/grub/i386-pc/\*.module || die
114 mdelete /usr/$(mlibdir)/grub/i386-pc/\*.image || die
115 mdelete /usr/$(mlibdir)/grub/i386-pc/kernel.exec || die
116 mdelete /usr/$(mlibdir)/grub/i386-pc/gdb_grub || die
117 mdelete /usr/$(mlibdir)/grub/i386-pc/gmodule.pl || die
118
119 # docs
120 minstalldocs AUTHORS ChangeLog COPYING NEWS README THANKS TODO || die
121
122 # setup a proper grub default conf
123 minstalldir /etc/conf.d || die
124 mcinjectfile grub.confd /etc/conf.d/grub || die
125 # minstalldir /etc/conf.d/grub.d || die
126 # mcinjectfile grub-alx.confd /etc/conf.d/grub.d/10-alx || die
127
128 # # use custom creation scripts and delete the provided ones
129 # echo -e ${COLGREEN}" injecting custom grub-configs"${COLDEFAULT}
130 # local i
131 # for i in ${BINDIR}/etc/grub.d/10_linux \
132 # ${BINDIR}/etc/grub.d/20_linux_xen \
133 # ${BINDIR}/etc/grub.d/30_os-prober \
134 # ${BINDIR}/etc/grub.d/40_custom \
135 # ${BINDIR}/etc/grub.d/41_custom \
136 # ${BINDIR}/etc/grub.d/README
137 # do
138 # if [[ -f ${i} ]]
139 # then
140 # rm ${i} || die
141 # fi
142 # done
143 # mcinjectexec 05_alx_header /etc/grub.d/ || die
144 # mcinjectexec 10_alx /etc/grub.d/ || die
145
146 # only keep 10_linux script
147 for i in ${BINDIR}/etc/grub.d/20_linux_xen \
148 ${BINDIR}/etc/grub.d/30_os-prober \
149 ${BINDIR}/etc/grub.d/40_custom \
150 ${BINDIR}/etc/grub.d/41_custom \
151 ${BINDIR}/etc/grub.d/README
152 do
153 if [[ -f ${i} ]]
154 then
155 rm ${i} || die
156 fi
157 done
158 }
159
160 preinstall_grub()
161 {
162 mount /boot &> /dev/null
163
164 add_conf_prot_mask /etc/conf.d/grub /etc/grub.d /etc/conf.d/grub.d
165 }
166
167 postinstall_grub()
168 {
169 [ ! -d ${MROOT}/boot/grub ] && install -d ${MROOT}/boot/grub
170
171 # creates some essential links
172 [ ! -e ${MROOT}/boot/boot ] && ln -sf . ${MROOT}/boot/boot
173
174 # clean up old helpers, which are now consolidated to the '10_alx' script, and delete 10_alx too, we're using 10_linux now
175 local i
176 for i in 30_alx_hwdetect 40_alx_reset 10-alx
177 do
178 if [ -f ${MROOT}/etc/grub/${i} ]
179 then
180 rm ${MROOT}/etc/grub/${i}
181 fi
182 done
183 if [ -f ${MROOT}/etc/conf.d/grub.conf.d/10-alx ]
184 then
185 rm ${MROOT}/etc/conf.d/grub.conf.d/10-alx
186 fi
187
188 if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]] && [[ ${MAGE_BOOTSTRAP} != true ]]
189 then
190 # create a device.map
191 if [[ ! -f /boot/grub/device.map ]]
192 then
193 grub-mkdevicemap
194 fi
195
196 # needed by grub-mkconfig on the first run
197 if [[ ! -f /boot/grub/video.lst ]]
198 then
199 install -m0644 /$(mlibdir)/grub/*/video.lst /boot/grub/video.lst
200 fi
201
202 # update grub.cfg
203 LC_ALL=C grub-mkconfig -o /boot/grub/grub.cfg
204
205 # install bootloader to disk
206 #local bootpartition="$(df -h /boot |(read; awk '{print $1; exit}'))"
207 local bootdisk
208 bootdisk="$(grub-probe --target=drive /boot | sed 's:(\(.*\),.*):(\1):')"
209
210 # Generate core.img, but don't let it be installed in boot sector
211 grub-install --no-floppy "${bootdisk}"
212 fi
213 }