1 # Maintainer : Keshav P R <(the.ridikulus.rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)>
3 _pkgname="grub2-efi-bzr"
5 pkgname="${_pkgname}" ## Dummy pkgname for AUR interface
7 # pkgname="grub2-efi-x86_64-bzr" ## Uncomment for grub2 BZR Main Trunk for x86_64-UEFI
8 # pkgname="grub2-efi-x86_64-bzr-exp" ## Uncomment for grub2 BZR Experimental Branch for x86_64-UEFI
9 # pkgname="grub2-efi-i386-bzr" ## Uncomment for grub2 BZR Main Trunk for i386-UEFI
10 # pkgname="grub2-efi-i386-bzr-exp" ## Uncomment for grub2 BZR Experimental Branch for i386-UEFI
13 url="http://www.gnu.org/software/grub/"
14 arch=('i686' 'x86_64')
17 makedepends=('bzr' 'rsync' 'xz' 'bdf-unifont' 'python2' 'autogen' 'texinfo' 'help2man' 'gettext' 'device-mapper' 'fuse')
18 depends=('xz' 'freetype2' 'device-mapper' 'fuse' 'gettext' 'dosfstools' 'efibootmgr')
19 optdepends=('libisoburn: provides xorriso for generating grub2 rescue iso using grub-mkrescue'
20 'mtools: for manipulating FAT fs image files')
22 install="${_pkgname}.install"
23 backup=('etc/default/grub' 'etc/grub.d/40_custom')
24 conflicts=('grub2-common')
26 source=('grub.default'
27 'grub.cfg.uefi.example'
28 'grub2_automake_1.11.2_pkglib_to_pkgdata.patch'
29 'grub-mkconfig-Use_outside_GRUB_PREFIX_if_defined.patch'
30 'archlinux_grub2_mkconfig_fixes.patch')
32 sha256sums=('4f895edb21c59ceae02b55d7a5c1d6881e0d0a229f00e4339f4326b5dfffaf3f'
33 '9d2cdb4ca04b6a8ace90f279e4ad52136d12faae881c07152f2871474d0ecbab'
34 '54c9c9aef89005157b9f3b0250a5601fff52db782eff3882fa5d278344ade111'
35 'df1780d3bc136cfdbc4f942a12d2d27e03b5fa95c4067766059aa132254c42c5'
36 '1247d438774b98792d1a3f7bde64d0def05743b0bff68cae7614e7a8454b3f8d')
40 grub2-efi-x86_64-bzr )
41 pkgdesc="The GNU GRand Unified Bootloader version 2 - x86_64 UEFI - BZR Main Trunk with grub-extras"
43 conflicts+=('grub2-efi-x86_64')
44 provides=('grub2-efi-x86_64')
46 _trns_name="grub2_efi_x86_64_bzr"
47 _bzrtrunk="bzr://bzr.savannah.gnu.org/grub/trunk/grub/"
48 # _bzrtrunk="lp:grub/grub2"
51 grub2-efi-x86_64-bzr-exp )
52 pkgdesc="The GNU GRand Unified Bootloader version 2 - x86_64 UEFI - BZR Experimental branch with grub-extras"
54 conflicts+=('grub2-efi-x86_64')
55 provides=('grub2-efi-x86_64')
57 _trns_name="grub2_efi_x86_64_bzr_exp"
58 _bzrtrunk="bzr://bzr.savannah.gnu.org/grub/branches/experimental/"
59 # _bzrtrunk="lp:~the-ridikulus-rat/grub/grub2-bzr-exp"
63 pkgdesc="The GNU GRand Unified Bootloader version 2 - i386 UEFI - BZR Main Trunk with grub-extras"
65 conflicts+=('grub2-efi-i386')
66 provides=('grub2-efi-i386')
68 _trns_name="grub2_efi_i386_bzr"
69 _bzrtrunk="bzr://bzr.savannah.gnu.org/grub/trunk/grub/"
70 # _bzrtrunk="lp:grub/grub2"
73 grub2-efi-i386-bzr-exp )
74 pkgdesc="The GNU GRand Unified Bootloader version 2 - i386 UEFI - BZR Experimental branch with grub-extras"
76 conflicts+=('grub2-efi-i386')
77 provides=('grub2-efi-i386')
79 _trns_name="grub2_efi_i386_bzr_exp"
80 _bzrtrunk="bzr://bzr.savannah.gnu.org/grub/branches/experimental/"
81 # _bzrtrunk="lp:~the-ridikulus-rat/grub/grub2-bzr-exp"
85 pkgdesc="The GNU GRand Unified Bootloader version 2 for UEFI systems - BZR Development Version with grub-extras - Dummy pkgname - Edit PKGBUILD for actual pkgname"
95 if [[ "${_UEFI_ARCH}" == 'x86_64' ]]; then
96 echo "${pkgname} package can be built only in a x86_64 system. Exiting."
101 if [[ "${_UEFI_ARCH}" == 'i386' ]]; then
102 # makedepends+=('gcc-multilib' 'gcc-libs-multilib' 'binutils-multilib' 'libtool-multilib' 'lib32-glibc')
110 ## grub2-extras bzr repo locations
112 _bzrtrunk_lua="bzr://bzr.savannah.gnu.org/grub-extras/lua/"
113 # _bzrtrunk_lua="lp:~the-ridikulus-rat/grub/grub2-extras-lua"
115 _bzrtrunk_gpxe="bzr://bzr.savannah.gnu.org/grub-extras/gpxe/"
116 # _bzrtrunk_gpxe="lp:~the-ridikulus-rat/grub/grub2-extras-gpxe"
121 msg "Connecting to BZR server..."
123 if [[ -d "${srcdir}/${_bzrmod}" ]]; then
124 cd "${srcdir}/${_bzrmod}"
125 bzr pull "${_bzrtrunk}"
126 msg "GRUB2 BZR Local repository updated."
129 bzr branch "${_bzrtrunk}" "${_bzrmod}"
130 msg "GRUB2 BZR repository cloned."
133 if [[ -d "${srcdir}/${_bzrmod}/grub2-extras" ]]; then
134 cd "${srcdir}/${_bzrmod}/grub2-extras/"
136 if [[ -d "${srcdir}/${_bzrmod}/grub2-extras/lua" ]]; then
137 cd "${srcdir}/${_bzrmod}/grub2-extras/lua"
138 bzr pull "${_bzrtrunk_lua}"
141 bzr branch "${_bzrtrunk_lua}" lua
145 if [[ -d "${srcdir}/${_bzrmod}/grub2-extras/gpxe" ]]; then
146 cd "${srcdir}/${_bzrmod}/grub2-extras/gpxe"
147 bzr pull "${_bzrtrunk_gpxe}"
150 bzr branch "${_bzrtrunk_gpxe}" gpxe
154 mkdir -p "${srcdir}/${_bzrmod}/grub2-extras/"
155 cd "${srcdir}/${_bzrmod}/grub2-extras/"
157 bzr branch "${_bzrtrunk_lua}" lua
159 bzr branch "${_bzrtrunk_gpxe}" gpxe
163 cd "${srcdir}/${_bzrmod}/"
164 rsync -Lrtvz translationproject.org::tp/latest/grub/ "${srcdir}/${_bzrmod}/po"
165 (cd "${srcdir}/${_bzrmod}/po" && ls *.po | cut -d. -f1 | xargs) > "${srcdir}/${_bzrmod}/po/LINGUAS"
172 if [[ "${pkgname}" == "${_pkgname}" ]]; then
173 echo "Please edit the PKGBUILD and uncomment the appropriate pkgname as per your UEFI arch and the grub2 bzr branch you want to compile."
179 rm -rf "${srcdir}/${_bzrmod}_build" || true
181 cp -r "${srcdir}/${_bzrmod}" "${srcdir}/${_bzrmod}_build"
182 cd "${srcdir}/${_bzrmod}_build"
184 patch -Np1 -i "${srcdir}/grub2_automake_1.11.2_pkglib_to_pkgdata.patch"
187 patch -Np1 -i "${srcdir}/grub-mkconfig-Use_outside_GRUB_PREFIX_if_defined.patch"
190 patch -Np1 -i "${srcdir}/archlinux_grub2_mkconfig_fixes.patch"
193 rm -rf "${srcdir}/${_bzrmod}_build/grub2-extras/zfs" || true
195 export GRUB_CONTRIB="${srcdir}/${_bzrmod}_build/grub2-extras/"
197 ## The below step is not required as the script now executes with python3, hence makedepends change from python2 to python pkg
198 ## Seems like python2 is required again - as on 04-JAN-2012 - grub2 bzr mainline rev 3732
199 ## Need to use python2
200 install -D -m0755 "${srcdir}/${_bzrmod}_build/autogen.sh" "${srcdir}/${_bzrmod}_build/autogen_unmodified.sh"
201 sed 's|python |python2 |g' -i "${srcdir}/${_bzrmod}_build/autogen.sh"
204 "${srcdir}/${_bzrmod}_build/autogen.sh"
207 ## fix unifont.bdf location so grub-mkfont can create *.pf2 files
208 sed 's|/usr/share/fonts/unifont|/usr/share/fonts/misc|g' -i "${srcdir}/${_bzrmod}_build/configure"
210 mkdir -p "${srcdir}/${_bzrmod}_build/BUILD_UEFI_${_UEFI_ARCH}"
211 cd "${srcdir}/${_bzrmod}_build/BUILD_UEFI_${_UEFI_ARCH}"
213 CFLAGS="" ../configure \
214 --with-platform="efi" \
215 --target="${_UEFI_ARCH}" \
216 --host="${CARCH}-unknown-linux-gnu" \
217 --program-transform-name="s,grub,${_trns_name}," \
219 --enable-device-mapper \
220 --enable-cache-stats \
221 --enable-grub-mkfont \
222 --enable-grub-mount \
226 --bindir="/usr/bin" \
227 --sbindir="/usr/sbin" \
228 --mandir="/usr/share/man" \
229 --infodir="/usr/share/info" \
230 --datadir="/usr/lib" \
231 --datarootdir="/usr/share" \
232 --sysconfdir="/etc" \
233 --program-prefix="" \
245 cd "${srcdir}/${_bzrmod}_build/BUILD_UEFI_${_UEFI_ARCH}"
246 make DESTDIR="${pkgdir}" install
249 # move grub2 fonts from /usr/lib/${_trns_name} to /usr/share/${_trns_name} - incorrect path due to grub2_automake_1.11.2_pkglib_to_pkgdata.patch
250 mv "${pkgdir}/usr/lib/${_trns_name}"/{ascii,euro,unicode}.pf2 "${pkgdir}/usr/share/${_trns_name}/"
251 mv "${pkgdir}/usr/lib/${_trns_name}"/{ascii,widthspec}.h "${pkgdir}/usr/share/${_trns_name}/"
253 ## install /etc/default/grub
254 install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
256 ## install example grub2 config file
257 install -D -m0644 "${srcdir}/grub.cfg.uefi.example" "${pkgdir}/usr/share/${_trns_name}/grub.cfg.uefi.example"
259 sed "s|^\(_UEFI_ARCH\)=.*|\1=${_UEFI_ARCH}|g" -i "${startdir}/${_pkgname}.install"
260 sed "s|^\(_trns_name\)=.*|\1=${_trns_name}|g" -i "${startdir}/${_pkgname}.install"