From ca6bc4892318fc0bfb3e8eaae8115c88708b7608 Mon Sep 17 00:00:00 2001 From: layman Date: Thu, 19 Mar 2015 23:01:03 -0400 Subject: [PATCH] sys-libs/efivar: fix compilation against musl --- sys-libs/efivar/Manifest | 3 +++ sys-libs/efivar/efivar-0.15-r99.ebuild | 28 +++++++++++++++++++++ .../efivar/files/efivar-0.15-portability.patch | 29 ++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 sys-libs/efivar/Manifest create mode 100644 sys-libs/efivar/efivar-0.15-r99.ebuild create mode 100644 sys-libs/efivar/files/efivar-0.15-portability.patch diff --git a/sys-libs/efivar/Manifest b/sys-libs/efivar/Manifest new file mode 100644 index 0000000..48532c7 --- /dev/null +++ b/sys-libs/efivar/Manifest @@ -0,0 +1,3 @@ +AUX efivar-0.15-portability.patch 871 SHA256 44cda9a0048fd3d59d44eb54e2439a2fd71e330b0db0d99bad469ccdff69bc7b SHA512 50eceab418dab2f699d17d6d94fd730f156f4d5fba5bc43fbe2eb1b923b2bde12f2e142fce596700798ae16463b9ef069df2538de224ec306bec4beafe54d6a9 WHIRLPOOL db04b8c6407139dcd627c799436a5543bad716b43155bad61530c7f68b767631125eb269c1ea151f429a897829e35cfddb378aa2ef80866013229239955f37c4 +DIST efivar-0.15.tar.bz2 26936 SHA256 08251e10dbee8a5a9851d859b98fc6cb479acfced38695a101bd8ed2a447051e SHA512 f6fbc71fa892366933f11f230f662ff7af515bcee3d4eb0279a3aeb6aa5bf21d86f86db928ff3cb4ed3366f52bd3fb8b959752759277ed4bf368a5fc223d62e9 WHIRLPOOL 8fd6a689b14aed7d8a9ed7d17fe4206416d5bb72d04843dab7de22c513cc0ad639daa8dad0de4c87e60164092d3c31c8d25973be03e20add99018c9a122bb9be +EBUILD efivar-0.15-r99.ebuild 696 SHA256 77ec59c1fb24f114d21a507e88f927acf031e8c002ebdbf74613476bd83ac2b6 SHA512 aa18989c2b1b0a7d5fcad08079628c795f102de309a9c0e187b0d53829c6bc11a1a8511556a30fdc4a1a7a5e5b32f07c669585939dcac5ca1deb892b89ef5e3f WHIRLPOOL e0c54d2522b585228390cb534a2f8ea3e462a539fa7b32b8ffd047dd42600c37f3c1155093b47a9356540e788f74cbee0c1ac12b142d0a452ee45636bf7b05a4 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..2524d74 --- /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 ia64 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"); + -- 2.0.5