summaryrefslogtreecommitdiff
path: root/extra/gnu-efi-libs/PKGBUILD
blob: 6432177d173fc5384617061a3ef483772c64b358 (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
80
81
82
83
84
# $Id: PKGBUILD 170836 2012-11-12 13:59:20Z 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}s"
pkgrel="2"
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
         disable-ms_abi-flag.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 broken ms_abi flags, causing weird issues with bootloaders
        patch -Np1 -i ../disable-ms_abi-flag.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=('11f63d52071f7382f56c9e81d0aece91'
         '4b5428c51af1981d3eb158d924d6bf85'
         '6295a103438cace5c40606b083c739fd')