From patchwork Sun Jul 26 19:03:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 500138 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 506FA140D57 for ; Mon, 27 Jul 2015 05:03:28 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=x/ZddN3t; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id DE6D694C33; Sun, 26 Jul 2015 19:03:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 42E8vmCm1rbd; Sun, 26 Jul 2015 19:03:26 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 78E60949BE; Sun, 26 Jul 2015 19:03:26 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 6A7201C226E for ; Sun, 26 Jul 2015 19:03:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6536DA2E0A for ; Sun, 26 Jul 2015 19:03:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l9_qk4bJpDMz for ; Sun, 26 Jul 2015 19:03:24 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by fraxinus.osuosl.org (Postfix) with ESMTPS id B00908BD27 for ; Sun, 26 Jul 2015 19:03:23 +0000 (UTC) Received: by wibxm9 with SMTP id xm9so90122490wib.1 for ; Sun, 26 Jul 2015 12:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=Evw9/JuYpH+G8fg5/OxKhBrskdWCu5H9ha0wMWEPBGg=; b=x/ZddN3tHpbu31nAOyGs99QizWuhfN1Jj/VJxUU6lClQO5GVR7gVVemyCNbkPs4gqb 8UUR2C7k1OX6neCnt212DmZdLot//ow/GCtQvcw0XvNF1XUwFX/Uysw7HVvUk9kkGxa8 OPeGF6kUzWm8Gm9O2gsAtpJ8zEpgcBSxq8QKByzkaVJ+BwlobA6pvvTnWIZ3CY68zu7y wqcm1yOWpsz89pcs5gYvEmEFDwD7iLnV8SKkgtSDKyg4Gi35ocQNmcaj40JSUSeOYv7i qUgDdMqHGFNVtFRpqa4fxBtCs0GUeoOQ9iPy0JjsJ509aV1LrSSTzgQM0fMi/cw0arA2 2yEg== X-Received: by 10.194.121.100 with SMTP id lj4mr47396894wjb.104.1437937402388; Sun, 26 Jul 2015 12:03:22 -0700 (PDT) Received: from gourin.bzh.lan (ns304657.ip-46-105-103.eu. [46.105.103.66]) by smtp.gmail.com with ESMTPSA id dl10sm23817234wjb.42.2015.07.26.12.03.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 26 Jul 2015 12:03:21 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Sun, 26 Jul 2015 21:03:16 +0200 Message-Id: <1437937396-23254-1-git-send-email-yann.morin.1998@free.fr> X-Mailer: git-send-email 1.9.1 Cc: Clayton Shotwell , "Yann E. MORIN" Subject: [Buildroot] [PATCH] package/libselinmux: fix build with musl X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" musl does not define glibcisms, so we ar emissing some macros. Define what we need in case the macro is missing. We're using a dumb implementation, which is rather slow, to avoid copying from glibc, to avoid propagating the LGPL to libselinux, which is Public Domain. Fixes a buncha autobuild failures: http://autobuild.buildroot.org/results/d4d/d4d209719d1ce5219f84719ad72fcb6a0c684007/ http://autobuild.buildroot.org/results/1a6/1a65cc3d2c23a3c17c605788be62dbd18cbdaf76/ http://autobuild.buildroot.org/results/0d0/0d0e4713833182d0f634b9b39b2c56f2bc0adcac/ ... Signed-off-by: "Yann E. MORIN" Cc: Clayton Shotwell Reviewed-by: Clayton Shotwell --- package/libselinux/0002-fix-musl-build.patch | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 package/libselinux/0002-fix-musl-build.patch diff --git a/package/libselinux/0002-fix-musl-build.patch b/package/libselinux/0002-fix-musl-build.patch new file mode 100644 index 0000000..9e6b734 --- /dev/null +++ b/package/libselinux/0002-fix-musl-build.patch @@ -0,0 +1,30 @@ +fix undefined macros in musl + +musl does not define glibc-specific macros, so use a simple version of +the macro when it is not defined. + +This is very inefficient, however, but copying the code from glibc is +not really possible because it is LGPL while libselinux in Public +Domain, and we want to avoid license propaation, so this macro is +completely written from scratch, and non-optimal. + +Signed-off-by: "Yann E. MORIN" + +diff -durN libselinux-2.1.13.orig/src/booleans.c libselinux-2.1.13/src/booleans.c +--- libselinux-2.1.13.orig/src/booleans.c 2013-02-06 02:43:22.000000000 +0100 ++++ libselinux-2.1.13/src/booleans.c 2015-07-26 20:40:41.311801914 +0200 +@@ -62,6 +62,14 @@ + goto bad; + } + ++/* Simple (but inefficient) version of _D_ALLOC_NAMLEN when ++ * building with a C library that misses it (e.g. musl). ++ * Note: glibc does a strlen on (d)->d_name, so assume it is safe. ++ */ ++#ifndef _D_ALLOC_NAMLEN ++#define _D_ALLOC_NAMLEN(d) (strlen((d)->d_name)+1) ++#endif ++ + for (i = 0; i < *len; i++) { + n[i] = (char *)malloc(_D_ALLOC_NAMLEN(namelist[i])); + if (!n[i]) {