updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / grub-legacy-fedora-git / PKGBUILD
blob231b1354902c64182f85db71092d92281f697c2f
1 # Maintainer : Keshav P R <(the.ridikulus.rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)>
3 # This PKGBUILD is based on grub.spec at https://pkgs.fedoraproject.org/gitweb/?p=grub.git;a=blob_plain;f=grub.spec;hb=HEAD .
5 # This grub-legacy package includes support for booting from GPT and for reading EXT4 filesystem (/boot can be ext4).
7 _actualname="grub-legacy"
8 _pkgname="${_actualname}-fedora"
9 pkgname="${_pkgname}-git"
11 pkgver=20120109
12 pkgrel=1
13 pkgdesc="Fedora's grub-legacy fork - compiled for BIOS systems"
14 url="https://git.kernel.org/?p=boot/grub-fedora/grub-fedora.git"
15 arch=('i686' 'x86_64')
16 license=('GPL')
17 makedepends=('git' 'ncurses')
18 depends=('ncurses')
19 optdepends=('python2: For /sbin/grub-crypt python2 script')
20 backup=('boot/grub/grub.conf')
21 conflicts=('grub' "${_actualname}")
22 provides=('grub' "${_actualname}")
23 options=(strip !emptydirs zipman !libtool docs !buildflags !makeflags)
25 source=('grub.conf')
26 sha256sums=('f2d7bea7b2f3e54ca96e1637ae88f73a0f409a04563038d36d25190169339898')
28 install="${pkgname}.install"
30 ## TODO: Need to check whether multilib is really needed for x86_64.
31 if [[ "${CARCH}" == 'x86_64' ]]; then
32         makedepends+=('gcc-multilib' 'gcc-libs-multilib' 'lib32-glibc' 'binutils-multilib' 'libtool-multilib')
33         echo
36 _gitroot="git://github.com/vathpela/grub-fedora.git"
38 _gitname="grub-legacy-fedora"
39 _gitbranch="master"
40 # _gitbranch="fedora-16"
42 _update_git() {
43         
44         cd "${srcdir}/"
45         
46         msg "Connecting to GIT server...."
47         
48         if [[ -d "${srcdir}/${_gitname}/" ]]; then
49                 cd "${srcdir}/${_gitname}/"
50                 git reset --hard
51                 
52                 git remote rm origin
53                 git remote add origin "${_gitroot}"
54                 
55                 git fetch
56                 git checkout "${_gitbranch}"
57                 git merge "remotes/origin/${_gitbranch}"
58                 msg "The local GIT repo has been updated."
59         else
60                 git clone "${_gitroot}" "${_gitname}"
61                 cd "${srcdir}/${_gitname}/"
62                 git checkout "${_gitbranch}"
63                 msg "GIT checkout done or server timeout"
64         fi
65         
66         echo
67         
70 build() {
71         
72         _update_git
73         
74         rm -rf "${srcdir}/${_gitname}_build/" || true
75         cp -r "${srcdir}/${_gitname}" "${srcdir}/${_gitname}_build"
76         
77         cd "${srcdir}/${_gitname}_build/"
78         
79         sed "s|0\.97|0\.97-${pkgver}|" -i "${srcdir}/${_gitname}_build/configure.in" || true
80         # sed "s|0\.97|0\.97-${pkgver}|" -i "${srcdir}/${_gitname}_build/configure.ac" || true
81         echo
82         
83         unset CFLAGS
84         unset CXXFLAGS
85         
86         autoreconf
87         echo
88         autoconf
89         echo
90         
91         __CFLAGS="-Os -g -fno-strict-aliasing -fno-stack-protector -Wall -Wno-error -Wno-shadow -Wno-unused -Wno-pointer-sign -m32"
92         
93         if [[ "${CARCH}" == 'x86_64' ]]; then
94                 _CFLAGS="${__CFLAGS} -static"
95         else
96                 _CFLAGS="${__CFLAGS}"
97         fi
98         
99         CFLAGS="${_CFLAGS}" ./configure \
100                 --with-platform="pc" \
101                 --host=i386-pc-linux-gnu \
102                 --disable-auto-linux-mem-opt \
103                 --without-curses \
104                 --prefix="/usr" \
105                 --bindir="/bin" \
106                 --sbindir="/sbin" \
107                 --mandir="/usr/share/man" \
108                 --infodir="/usr/share/info" \
109                 --libdir="/usr/lib" \
110                 --datarootdir="/usr/lib"
111         echo
112         
113         CFLAGS="${_CFLAGS}" make
114         echo
115         
119 package() {
120         
121         cd "${srcdir}/${_gitname}_build/"
122         
123         make DESTDIR="${pkgdir}" install
124         
125         install -D -m0644 "${srcdir}/grub.conf" "${pkgdir}/boot/grub/grub.conf"
126         
127         sed 's|#! /usr/bin/python|#!/usr/bin/env python2|g' -i "${pkgdir}/sbin/grub-crypt"
128