commit:     02d2b5c49a36b119da7e66c8c1499d38c1ce3e03
Author:     layman <layman <AT> localhost>
AuthorDate: Fri Mar 20 03:01:03 2015 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Mar 20 18:24:44 2015 +0000
URL:        https://gitweb.gentoo.org/proj/hardened-dev.git/commit/?id=02d2b5c4

sys-libs/efivar: fix compilation against musl

 sys-libs/efivar/efivar-0.15-r99.ebuild             | 28 +++++++++++++++++++++
 .../efivar/files/efivar-0.15-portability.patch     | 29 ++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/sys-libs/efivar/efivar-0.15-r99.ebuild 
b/sys-libs/efivar/efivar-0.15-r99.ebuild
new file mode 100644
index 0000000..f08fe58
--- /dev/null
+++ b/sys-libs/efivar/efivar-0.15-r99.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/efivar/efivar-0.15.ebuild,v 1.5 
2015/02/28 13:25:44 ago Exp $
+
+EAPI=5
+
+inherit multilib toolchain-funcs eutils
+
+DESCRIPTION="Tools and library to manipulate EFI variables"
+HOMEPAGE="https://github.com/vathpela/efivar";
+SRC_URI="https://github.com/vathpela/${PN}/releases/download/${PV}/${P}.tar.bz2";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+
+RDEPEND="dev-libs/popt"
+DEPEND="${RDEPEND}"
+
+src_prepare() {
+       epatch "${FILESDIR}/${PN}-0.15-portability.patch" || die
+}
+
+src_configure() {
+       tc-export CC
+       export libdir="/usr/$(get_libdir)"
+}
+

diff --git a/sys-libs/efivar/files/efivar-0.15-portability.patch 
b/sys-libs/efivar/files/efivar-0.15-portability.patch
new file mode 100644
index 0000000..2c824a0
--- /dev/null
+++ b/sys-libs/efivar/files/efivar-0.15-portability.patch
@@ -0,0 +1,29 @@
+Portability fixes:
+
+- Initialize outbuf with the expected size! fixes a segfault with musl.
+- Really use __builtin_va_arg_pack_len().
+
+--- a/src/efivar.h
++++ b/src/efivar.h
+@@ -85,7 +85,7 @@ efi_set_variable(efi_guid_t guid, const char *name,
+               return -1;
+       }
+ 
+-      if (__va_arg_pack_len() == 0)
++      if (__builtin_va_arg_pack_len() == 0)
+               return _efi_set_variable(guid, name, data, data_size,
+                                        attributes, 0644);
+ 
+diff --git a/src/makeguids.c b/src/makeguids.c
+index 321a7e7..7d68b8a 100644
+--- a/src/makeguids.c
++++ b/src/makeguids.c
+@@ -100,7 +100,7 @@ main(int argc, char *argv[])
+               err(1, "makeguids: could not read \"%s\"", argv[1]);
+ 
+       /* strictly speaking, this *has* to be too large. */
+-      struct guidname *outbuf = calloc(inlen, sizeof (char));
++      struct guidname *outbuf = calloc(inlen, sizeof (struct guidname));
+       if (!outbuf)
+               err(1, "makeguids");
+ 

Reply via email to