updated on Thu Jan 12 04:00:44 UTC 2012
[aur-mirror.git] / grub2-bios-bzr / PKGBUILD
blobb334c1de51b83cdc2e1bc843c25a11ee3c442986
1 # Maintainer : Keshav P R <(the.ridikulus.rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)>
3 _pkgname="grub2-bios-bzr"
5 pkgname="${_pkgname}"
6 # pkgname="${_pkgname}-exp"    ## Uncomment for grub2 BZR Experimental Branch
8 pkgver="3732"
9 pkgdesc="The GNU GRand Unified Bootloader - Version 2 - Built for i386 BIOS - BZR Development version with grub-extras"
10 url="http://www.gnu.org/software/grub/"
11 arch=('i686' 'x86_64')
12 license=('GPL3')
14 makedepends=('bzr' 'rsync' 'xz' 'bdf-unifont' 'python2' 'autogen' 'texinfo' 'help2man' 'gettext' 'device-mapper' 'fuse')
15 depends=('xz' 'freetype2' 'device-mapper' 'fuse' 'gettext')
16 optdepends=('libisoburn: provides xorriso for generating grub2 rescue iso using grub-mkrescue'
17             'os-prober: to detect other OSes when generating grub.cfg in BIOS systems')
19 install="${_pkgname}.install"
20 backup=('boot/grub/grub.cfg' 'etc/default/grub' 'etc/grub.d/40_custom')
21 conflicts=('grub2-common' 'grub2-bios')
22 provides=('grub2-common' 'grub2-bios')
23 replaces=()
25 source=('grub.default'
26         'grub.cfg.bios.example'
27         '20_memtest86+'
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=('bbea2d8cbf2920885b88766d5988ddb440b394cda4b8597dc6f4a9e7d236c61b'
33             '8511ceb65169168b2738aa928ccaceb7036589136ed8895ea48da9927fc21248'
34             'ba0f871ee93760d14d7f19709bb875af4a863a758776a23519ca7100a63da295'
35             '54c9c9aef89005157b9f3b0250a5601fff52db782eff3882fa5d278344ade111'
36             'df1780d3bc136cfdbc4f942a12d2d27e03b5fa95c4067766059aa132254c42c5'
37             '1247d438774b98792d1a3f7bde64d0def05743b0bff68cae7614e7a8454b3f8d')
40 case "${pkgname}" in
41         grub2-bios-bzr-exp )
42                 pkgdesc="The GNU GRand Unified Bootloader 2 - Built for i386 BIOS - BZR Experimental Branch with grub-extras"
43                 pkgrel="1"
44                 conflicts+=("${_pkgname}")
45                 _trns_name="grub"
46                 _bzrtrunk="bzr://bzr.savannah.gnu.org/grub/branches/experimental/"
47                 # _bzrtrunk="lp:~the-ridikulus-rat/grub/grub2-bzr-exp"
48                 _bzrmod="grub2_exp"
49         ;;
50         grub2-bios-bzr )
51                 pkgdesc="The GNU GRand Unified Bootloader 2 - Built for i386 BIOS - BZR Main Trunk with grub-extras"
52                 pkgrel="1"
53                 conflicts+=("${_pkgname}-exp")
54                 _trns_name="grub"
55                 _bzrtrunk="bzr://bzr.savannah.gnu.org/grub/trunk/grub/"
56                 # _bzrtrunk="lp:grub/grub2"
57                 _bzrmod="grub2"
58         ;;
59 esac
61 if [[ "${CARCH}" == 'x86_64' ]]; then
62         # makedepends+=('gcc-multilib' 'gcc-libs-multilib' 'lib32-glibc' 'binutils-multilib' 'libtool-multilib')
63         
64         _EFIEMU="--enable-efiemu"
65 else
66         _EFIEMU="--disable-efiemu"
70 ## grub2-extras bzr repo locations
72 _bzrtrunk_lua="bzr://bzr.savannah.gnu.org/grub-extras/lua/"
73 # _bzrtrunk_lua="lp:~the-ridikulus-rat/grub/grub2-extras-lua"
75 _bzrtrunk_ntldr_img="bzr://bzr.savannah.gnu.org/grub-extras/ntldr-img/"
76 # _bzrtrunk_ntldr_img="lp:~the-ridikulus-rat/grub/grub2-extras-ntldr-img"
78 _bzrtrunk_915resolution="bzr://bzr.savannah.gnu.org/grub-extras/915resolution/"
79 # _bzrtrunk_915resolution="lp:~the-ridikulus-rat/grub/grub2-extras-915resolution"
81 _bzrtrunk_gpxe="bzr://bzr.savannah.gnu.org/grub-extras/gpxe/"
82 # _bzrtrunk_gpxe="lp:~the-ridikulus-rat/grub/grub2-extras-gpxe"
85 _update_bzr() {
86         
87         msg "Connecting to BZR server..."
88         
89         if [[ -d "${srcdir}/${_bzrmod}" ]]; then
90                 cd "${srcdir}/${_bzrmod}"
91                 bzr pull "${_bzrtrunk}"
92                 msg "GRUB2 BZR Local repository updated."
93         else
94                 cd "${srcdir}/"
95                 bzr branch "${_bzrtrunk}" "${_bzrmod}"
96                 msg "GRUB2 BZR repository cloned."
97         fi
98         msg "BZR checkout done or server timeout"
99         
100         if [[ -d "${srcdir}/${_bzrmod}/grub2-extras" ]]; then
101                 cd "${srcdir}/${_bzrmod}/grub2-extras/"
102                 
103                 if [[ -d "${srcdir}/${_bzrmod}/grub2-extras/lua" ]]; then
104                         cd "${srcdir}/${_bzrmod}/grub2-extras/lua"
105                         bzr pull "${_bzrtrunk_lua}"
106                         echo
107                 else
108                         bzr branch "${_bzrtrunk_lua}" lua
109                         echo
110                 fi
111                 
112                 if [[ -d "${srcdir}/${_bzrmod}/grub2-extras/ntldr-img" ]]; then
113                         cd "${srcdir}/${_bzrmod}/grub2-extras/ntldr-img"
114                         bzr pull "${_bzrtrunk_ntldr_img}"
115                         echo
116                 else
117                         bzr branch "${_bzrtrunk_ntldr_img}" ntldr-img
118                         echo
119                 fi
120                 
121                 if [[ -d "${srcdir}/${_bzrmod}/grub2-extras/915resolution" ]]; then
122                         cd "${srcdir}/${_bzrmod}/grub2-extras/915resolution"
123                         bzr pull "${_bzrtrunk_915resolution}"
124                         echo
125                 else
126                         bzr branch "${_bzrtrunk_915resolution}" 915resolution
127                         echo
128                 fi
129                 
130                 if [[ -d "${srcdir}/${_bzrmod}/grub2-extras/gpxe" ]]; then
131                         cd "${srcdir}/${_bzrmod}/grub2-extras/gpxe"
132                         bzr pull "${_bzrtrunk_gpxe}"
133                         echo
134                 else
135                         bzr branch "${_bzrtrunk_gpxe}" gpxe
136                         echo
137                 fi
138         else
139                 mkdir -p "${srcdir}/${_bzrmod}/grub2-extras/"
140                 cd "${srcdir}/${_bzrmod}/grub2-extras/"
141                 
142                 bzr branch "${_bzrtrunk_lua}" lua
143                 echo
144                 bzr branch "${_bzrtrunk_ntldr_img}" ntldr-img
145                 echo
146                 bzr branch "${_bzrtrunk_915resolution}" 915resolution
147                 echo
148                 bzr branch "${_bzrtrunk_gpxe}" gpxe
149                 echo
150         fi
151         
152         cd "${srcdir}/${_bzrmod}/"
153         rsync -Lrtvz translationproject.org::tp/latest/grub/ "${srcdir}/${_bzrmod}/po"
154         (cd "${srcdir}/${_bzrmod}/po" && ls *.po | cut -d. -f1 | xargs) > "${srcdir}/${_bzrmod}/po/LINGUAS"
155         
159 build() {
160         
161         _update_bzr
162         
163         rm -rf "${srcdir}/${_bzrmod}_build" || true
164         
165         cp -r "${srcdir}/${_bzrmod}" "${srcdir}/${_bzrmod}_build"
166         cd "${srcdir}/${_bzrmod}_build"
167         
168         patch -Np1 -i "${srcdir}/grub2_automake_1.11.2_pkglib_to_pkgdata.patch"
169         echo
170         
171         patch -Np1 -i "${srcdir}/grub-mkconfig-Use_outside_GRUB_PREFIX_if_defined.patch"
172         echo
173         
174         patch -Np1 -i "${srcdir}/archlinux_grub2_mkconfig_fixes.patch"
175         echo
176         
177         rm -rf "${srcdir}/${_bzrmod}_build/grub2-extras/zfs" || true
178         
179         export GRUB_CONTRIB="${srcdir}/${_bzrmod}_build/grub2-extras/"
180         
181         ## The below step is not required as the script now executes with python3, hence makedepends change from python2 to python pkg
182         ## Seems like python2 is required again - as on 04-JAN-2012 - grub2 bzr mainline rev 3732
183         ## Need to use python2
184         install -D -m0755 "${srcdir}/${_bzrmod}_build/autogen.sh" "${srcdir}/${_bzrmod}_build/autogen_unmodified.sh"
185         sed 's|python |python2 |g' -i "${srcdir}/${_bzrmod}_build/autogen.sh"
186         echo
187         
188         "${srcdir}/${_bzrmod}_build/autogen.sh"
189         echo
190         
191         ## fix unifont.bdf location so grub-mkfont can create *.pf2 files
192         sed 's|/usr/share/fonts/unifont|/usr/share/fonts/misc|g' -i "${srcdir}/${_bzrmod}_build/configure"
193         
194         mkdir -p "${srcdir}/${_bzrmod}_build/BUILD_BIOS"
195         cd "${srcdir}/${_bzrmod}_build/BUILD_BIOS"
196         
197         CFLAGS="" ../configure \
198                 --with-platform="pc" \
199                 --target="i386" \
200                 --host="${CARCH}-pc-linux-gnu" \
201                 --enable-mm-debug \
202                 --enable-device-mapper \
203                 --enable-cache-stats \
204                 --enable-grub-mkfont \
205                 --enable-grub-mount \
206                 --enable-nls \
207                 --prefix="/usr" \
208                 --bindir="/usr/bin" \
209                 --sbindir="/usr/sbin" \
210                 --mandir="/usr/share/man" \
211                 --infodir="/usr/share/info" \
212                 --datadir="/usr/lib" \
213                 --datarootdir="/usr/share" \
214                 --sysconfdir="/etc" \
215                 --program-prefix="" \
216                 --disable-werror
217         echo
218         
219         CFLAGS="" make
220         echo
221         
224 package() {
225         
226         cd "${srcdir}/${_bzrmod}_build/BUILD_BIOS"
227         make DESTDIR="${pkgdir}/" install
228         echo
229         
230         # move grub2 fonts from /usr/lib/grub to /usr/share/grub - incorrect path due to grub2_automake_1.11.2_pkglib_to_pkgdata.patch
231         mv "${pkgdir}/usr/lib/grub"/{ascii,euro,unicode}.pf2 "${pkgdir}/usr/share/grub/"
232         mv "${pkgdir}/usr/lib/grub"/{ascii,widthspec}.h "${pkgdir}/usr/share/grub/"
233         
234         ## install /etc/default/grub
235         install -D -m0644 "${srcdir}/grub.default" "${pkgdir}/etc/default/grub"
236         
237         ## install grub.cfg for /boot/grub/grub.cfg backup
238         install -D -m0644 "${srcdir}/grub.cfg.bios.example" "${pkgdir}/boot/grub/grub.cfg"
239         
240         ## install memtest config detection
241         install -D -m0755 "${srcdir}/20_memtest86+" "${pkgdir}/etc/grub.d/20_memtest86+"
242