summaryrefslogtreecommitdiff
path: root/extra/gnu-efi-libs/PKGBUILD
blob: 2799ac0d951b2b105d045333d762756f24e3d1e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# $Id: PKGBUILD 168460 2012-10-12 06:35:15Z tpowa $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Maintainer : Keshav P R <(the.ridikulus.rat) (aatt) (gemmaeiil) (ddoott) (ccoomm)>
# Contributor: Alessio 'mOLOk' Bolognino <themolok@gmail.com>

_pkgver="3.0"
pkgname="gnu-efi-libs"
pkgver="${_pkgver}r"
pkgrel="1"
pkgdesc="Library for building x86_64 and i386 UEFI Applications using GNU toolchain"
url="http://sourceforge.net/projects/gnu-efi/"
license=('GPL')
arch=('i686' 'x86_64')
makedepends=('pciutils')
if [[ "${CARCH}" == "x86_64" ]]; then
	makedepends+=('lib32-glibc')
fi
conflicts=('gnu-efi')
provides=('gnu-efi')
replaces=('gnu-efi')
options=('!strip' '!makeflags')
source=("http://download.sourceforge.net/gnu-efi/gnu-efi_${pkgver}.orig.tar.gz"         gnu-efi-libs-x86_64-call-fix.patch)

_build_gnu-efi-libs-x86_64() {	
	cp -r "${srcdir}/gnu-efi-${_pkgver}" "${srcdir}/gnu-efi-${_pkgver}-x86_64"
	cd "${srcdir}/gnu-efi-${_pkgver}-x86_64/"
	ARCH="x86_64" make
	ARCH="x86_64" make -C apps all	
}

_build_gnu-efi-libs-i386() {
	cp -r "${srcdir}/gnu-efi-${_pkgver}" "${srcdir}/gnu-efi-${_pkgver}-i386"
	cd "${srcdir}/gnu-efi-${_pkgver}-i386/"	
	ARCH="ia32" make
	ARCH="ia32" make -C apps all	
}

build() {
        cd ${srcdir}/gnu-efi-${_pkgver}
        # fix http://sourceforge.net/tracker/?func=detail&aid=3576537&group_id=163609&atid=828423
        patch -Np1 -i ../gnu-efi-libs-x86_64-call-fix.patch	
	## Fix Makefiles to enable compile for both UEFI arch
	sed 's|INSTALLROOT=/usr/local|INSTALLROOT ?= /usr/lib|g' -i Make.defaults
	sed 's|LIBDIR=lib|LIBDIR ?= lib|g' -i Make.defaults
	sed 's|ARCH	   :=|ARCH	   ?=|g' -i Make.defaults
	sed 's|-fno-strict-aliasing|-fno-strict-aliasing -fno-stack-protector|g' -i Make.defaults
	if [[ "${CARCH}" == "x86_64" ]]; then
		_build_gnu-efi-libs-x86_64
	fi
	_build_gnu-efi-libs-i386	
}

_package_gnu-efi-libs-x86_64() {
	cd "${srcdir}/gnu-efi-${_pkgver}-x86_64/"	
	make ARCH="x86_64" INSTALLROOT="${pkgdir}/usr/" LIBDIR="lib" install
	install -d "${pkgdir}/usr/share/gnu-efi/x86_64/"
	install -D -m0644 "${srcdir}/gnu-efi-${_pkgver}-x86_64/apps"/*.efi "${pkgdir}/usr/share/gnu-efi/x86_64/"
}

_package_gnu-efi-libs-i386() {	
	cd "${srcdir}/gnu-efi-${_pkgver}-i386/"
	make ARCH="ia32" INSTALLROOT="${pkgdir}/usr/" LIBDIR="${_LIBDIR32}" install
	install -d "${pkgdir}/usr/share/gnu-efi/i386/"
	install -D -m0644 "${srcdir}/gnu-efi-${_pkgver}-i386/apps"/*.efi "${pkgdir}/usr/share/gnu-efi/i386/"	
}

package() {
	if [[ "${CARCH}" == "x86_64" ]]; then
		_package_gnu-efi-libs-x86_64
		
		_LIBDIR32="lib32"
		_package_gnu-efi-libs-i386
	else
		_LIBDIR32="lib"
		_package_gnu-efi-libs-i386
	fi	
}
md5sums=('c5081850414bec34d3e254e8e970811b'
         '4b5428c51af1981d3eb158d924d6bf85')