summaryrefslogtreecommitdiff
path: root/extra/gnu-efi-libs/PKGBUILD
blob: f6d0c4c42ec3bf204119b2413126a2d59d8213c1 (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 180092 2013-03-16 15:44:29Z 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}t"
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"
        '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 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" PREFIX="" 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" PREFIX="" 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=('95916208cf543699799230ac1ea14272'
         '783755e5f691f4c5c629f94d759b727b')