From patchwork Tue Jan 16 08:22:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Folkesson X-Patchwork-Id: 861323 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="aKRyzrhK"; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zLNWQ5GN6z9ryr for ; Tue, 16 Jan 2018 19:22:42 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id B535287AD6; Tue, 16 Jan 2018 08:22:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id F7LKlLZs+vsi; Tue, 16 Jan 2018 08:22:37 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id A41DF87AE0; Tue, 16 Jan 2018 08:22:37 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 648DB1C0A2B for ; Tue, 16 Jan 2018 08:22:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 5DBBB2F2AF for ; Tue, 16 Jan 2018 08:22:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SIm8keRDxJCe for ; Tue, 16 Jan 2018 08:22:28 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by silver.osuosl.org (Postfix) with ESMTPS id CAE102A249 for ; Tue, 16 Jan 2018 08:22:27 +0000 (UTC) Received: by mail-lf0-f68.google.com with SMTP id y71so16283462lfd.12 for ; Tue, 16 Jan 2018 00:22:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=obupdBi6pJB0pjKbQ6TLW8pFD7l13X7Ycwt5t4eewpM=; b=aKRyzrhKIumnTNoR+Gc6iMvZ64jtry5xlnWXOmYCZY7NuAfgVgzzglk/dBAWrIA0cL T4kjllyNaULigEfu9Gdm1vlqLNTD2los/WP2657Wm7csjxIwS9ea6hoa6fx6SxTcPj0G Bv8KFQCXvdmsarXz603nA9UQwfyjcMD8HfaDgoN7N3o1fGL1SXBC5gBl4zwFfi0gMvCb HPgVsgEHniA5zEbiS/hQOGapexWJkg1KzSsIoGiHSD+mYbA8GZAIwNJQLAsuHMuN72CQ vMYr+oP+2rQmvpqORDKio27SZK6Aryc24+4obqFJnnpJdfy5RWH4shAXDq3bDmZgW/J3 Ic9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=obupdBi6pJB0pjKbQ6TLW8pFD7l13X7Ycwt5t4eewpM=; b=WatDPfnJHKCN8FK54St1BOa6JBPu7om3rY+yBxSxx/mWTxNhtvL9wB4QkVWkUzzT95 h1iRhHINzoE/XqsnehGW3mIS4VMg93M444dLZtArNewZ5QOHEOYw1plShZB+eKyMj0kg CULx3fmSaNk6/9dtHxA85XMm5S8SOjCXfb9NoxDZjATqdiPFaOkBpUtuFFc1iF8rFyDz 6JB/JozZupE5cgT6hEESrcN238yLvytF1WavhKAlN2UhwdrJZHPzt3JQwQzmd9lZgCK7 BaQhlWZ7QVraVfNll29HBTJizCTHiG9kqkEAcfDGziovRHVC1Q8xxFj6aeZnm25jR7i8 PNhQ== X-Gm-Message-State: AKwxytcvHv5vUjo9FzPaRTtQigyjEdaDNQpmkX/LgIGI8Vdtn8dGGtRJ ahxOCVHZDGwPmCLNzGBtguny6YmlbV4= X-Google-Smtp-Source: ACJfBotQ3DnZYi1dQu3dzLqrF+3t9WWnUDh6wFD9WCm04uVu5DrPQHbCTAfQ4UQRkQHuZjtX6xUn3A== X-Received: by 10.46.22.9 with SMTP id w9mr7676370ljd.91.1516090945596; Tue, 16 Jan 2018 00:22:25 -0800 (PST) Received: from localhost.localdomain (c-5eea3743-74736162.cust.telenor.se. [94.234.55.67]) by smtp.gmail.com with ESMTPSA id u10sm293731lju.25.2018.01.16.00.22.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 00:22:24 -0800 (PST) From: Marcus Folkesson To: buildroot@buildroot.org Date: Tue, 16 Jan 2018 09:22:18 +0100 Message-Id: <20180116082218.8546-1-marcus.folkesson@gmail.com> X-Mailer: git-send-email 2.15.1 Subject: [Buildroot] [PATCH] libsepol: add patch to make the build process more standard X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marcus Folkesson , Adam Duskett MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Patch the Makefiles to make PREFIX and DESTDIR follow standard semantics to get rid of DESTDIR during compile time in libsepol.mk and generate proper pkg-config files. Signed-off-by: Marcus Folkesson --- ...build-follow-standard-semantics-for-DESTD.patch | 109 +++++++++++++++++++++ ...c-only.patch => 0003-support-static-only.patch} | 33 +++---- ...elative.patch => 0004-revert-ln-relative.patch} | 25 ++--- package/libsepol/libsepol.mk | 5 +- 4 files changed, 131 insertions(+), 41 deletions(-) create mode 100644 package/libsepol/0001-libsepol-build-follow-standard-semantics-for-DESTD.patch rename package/libsepol/{0001-support-static-only.patch => 0003-support-static-only.patch} (57%) rename package/libsepol/{0003-revert-ln-relative.patch => 0004-revert-ln-relative.patch} (54%) diff --git a/package/libsepol/0001-libsepol-build-follow-standard-semantics-for-DESTD.patch b/package/libsepol/0001-libsepol-build-follow-standard-semantics-for-DESTD.patch new file mode 100644 index 0000000000..1daf7206d3 --- /dev/null +++ b/package/libsepol/0001-libsepol-build-follow-standard-semantics-for-DESTD.patch @@ -0,0 +1,109 @@ +libsepol: build: follow standard semantics for DESTDIR and PREFIX + +This patch solves the following issues: +- The pkg-config files generates odd paths when using DESTDIR without PREFIX +- DESTDIR is needed during compile time to compute library and header paths which it should not. +- Installing with both DESTDIR and PREFIX set gives us odd paths +- Make usage of DESTDIR and PREFIX more standard + +Signed-off-by: Marcus Folkesson + +diff -durN libsepol.orig/include/Makefile libsepol/include/Makefile +--- libsepol.orig/include/Makefile 2018-01-12 12:42:30.908709792 +0100 ++++ libsepol/include/Makefile 2018-01-12 09:58:04.322148228 +0100 +@@ -1,6 +1,6 @@ + # Installation directories. +-PREFIX ?= $(DESTDIR)/usr +-INCDIR ?= $(PREFIX)/include/sepol ++PREFIX ?= /usr ++INCDIR = $(DESTDIR)$(PREFIX)/include/sepol + CILDIR ?= ../cil + + all: +diff -durN libsepol.orig/man/Makefile libsepol/man/Makefile +--- libsepol.orig/man/Makefile 2018-01-12 12:42:30.912043126 +0100 ++++ libsepol/man/Makefile 2018-01-12 09:58:04.322148228 +0100 +@@ -1,6 +1,7 @@ + # Installation directories. +-MAN8DIR ?= $(DESTDIR)/usr/share/man/man8 +-MAN3DIR ?= $(DESTDIR)/usr/share/man/man3 ++PREFIX ?= /usr ++MAN8DIR ?= $(DESTDIR)$(PREFIX)/share/man/man8 ++MAN3DIR ?= $(DESTDIR)$(PREFIX)/share/man/man3 + + all: + +diff -durN libsepol.orig/src/libsepol.pc.in libsepol/src/libsepol.pc.in +--- libsepol.orig/src/libsepol.pc.in 2018-01-12 12:42:30.912043126 +0100 ++++ libsepol/src/libsepol.pc.in 2018-01-12 09:58:04.322148228 +0100 +@@ -1,6 +1,6 @@ + prefix=@prefix@ + exec_prefix=${prefix} +-libdir=${exec_prefix}/@libdir@ ++libdir=@libdir@ + includedir=@includedir@ + + Name: libsepol +diff -durN libsepol.orig/src/Makefile libsepol/src/Makefile +--- libsepol.orig/src/Makefile 2018-01-12 12:42:30.912043126 +0100 ++++ libsepol/src/Makefile 2018-01-12 09:58:04.322148228 +0100 +@@ -1,11 +1,10 @@ + # Installation directories. +-PREFIX ?= $(DESTDIR)/usr ++PREFIX ?= /usr + INCLUDEDIR ?= $(PREFIX)/include + LIBDIR ?= $(PREFIX)/lib +-SHLIBDIR ?= $(DESTDIR)/lib + RANLIB ?= ranlib +-LIBBASE ?= $(shell basename $(LIBDIR)) + CILDIR ?= ../cil ++LIBINSTALL = $(DESTDIR)$(LIBDIR) + + VERSION = $(shell cat ../VERSION) + LIBVERSION = 1 +@@ -52,7 +51,7 @@ + ln -sf $@ $(TARGET) + + $(LIBPC): $(LIBPC).in ../VERSION +- sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@ ++ sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBDIR):; s:@includedir@:$(INCLUDEDIR):' < $< > $@ + + $(LIBMAP): $(LIBMAP).in + ifneq ($(DISABLE_CIL),y) +@@ -80,16 +79,16 @@ + $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $< + + install: all +- test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) +- install -m 644 $(LIBA) $(LIBDIR) +- test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR) +- install -m 755 $(LIBSO) $(SHLIBDIR) +- test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig +- install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig +- $(LN) -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET) ++ test -d $(LIBINSTALL) || install -m 755 -d $(LIBINSTALL) ++ install -m 644 $(LIBA) $(LIBINSTALL) ++ test -d $(LIBINSTALL) || install -m 755 -d $(LIBINSTALL) ++ install -m 755 $(LIBSO) $(LIBINSTALL) ++ test -d $(LIBINSTALL)/pkgconfig || install -m 755 -d $(LIBINSTALL)/pkgconfig ++ install -m 644 $(LIBPC) $(LIBINSTALL)/pkgconfig ++ $(LN) -sf --relative $(LIBINSTALL)/$(LIBSO) $(LIBINSTALL)/$(TARGET) + + relabel: +- /sbin/restorecon $(SHLIBDIR)/$(LIBSO) ++ /sbin/restorecon $(LIBINSTALL)/$(LIBSO) + + clean: + -rm -f $(LIBPC) $(LIBMAP) $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(TARGET) $(CIL_GENERATED) +diff -durN libsepol.orig/utils/Makefile libsepol/utils/Makefile +--- libsepol.orig/utils/Makefile 2018-01-12 12:42:30.915376458 +0100 ++++ libsepol/utils/Makefile 2018-01-12 09:58:04.322148228 +0100 +@@ -1,6 +1,6 @@ + # Installation directories. +-PREFIX ?= $(DESTDIR)/usr +-BINDIR ?= $(PREFIX)/bin ++PREFIX ?= /usr ++BINDIR ?= $(DESTDIR)$(PREFIX)/bin + + CFLAGS ?= -Wall -Werror + override CFLAGS += -I../include diff --git a/package/libsepol/0001-support-static-only.patch b/package/libsepol/0003-support-static-only.patch similarity index 57% rename from package/libsepol/0001-support-static-only.patch rename to package/libsepol/0003-support-static-only.patch index 185a5641de..8cf9a180ff 100644 --- a/package/libsepol/0001-support-static-only.patch +++ b/package/libsepol/0003-support-static-only.patch @@ -15,11 +15,10 @@ Signed-off-by: Adam Duskett src/Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) -diff --git a/src/Makefile b/src/Makefile -index 819d261..040921d 100644 ---- a/src/Makefile -+++ b/src/Makefile -@@ -40,7 +40,12 @@ LDFLAGS += -undefined dynamic_lookup +diff -durNw libsepol-2.7.orig/src/Makefile libsepol-2.7/src/Makefile +--- libsepol-2.7.orig/src/Makefile 2018-01-15 21:07:51.285183415 +0100 ++++ libsepol-2.7/src/Makefile 2018-01-15 21:08:56.515182717 +0100 +@@ -39,7 +39,12 @@ LN=gln endif @@ -33,22 +32,14 @@ index 819d261..040921d 100644 $(LIBA): $(OBJS) -@@ -82,11 +87,13 @@ endif +@@ -81,8 +86,10 @@ install: all - test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) - install -m 644 $(LIBA) $(LIBDIR) -- test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR) -- install -m 755 $(LIBSO) $(SHLIBDIR) - test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig - install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig + test -d $(LIBINSTALL) || install -m 755 -d $(LIBINSTALL) + install -m 644 $(LIBA) $(LIBINSTALL) +ifeq ($(STATIC),) -+ test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR) -+ install -m 755 $(LIBSO) $(SHLIBDIR) - $(LN) -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET) + test -d $(LIBINSTALL) || install -m 755 -d $(LIBINSTALL) + install -m 755 $(LIBSO) $(LIBINSTALL) +endif - - relabel: - /sbin/restorecon $(SHLIBDIR)/$(LIBSO) --- -2.13.6 - + test -d $(LIBINSTALL)/pkgconfig || install -m 755 -d $(LIBINSTALL)/pkgconfig + install -m 644 $(LIBPC) $(LIBINSTALL)/pkgconfig + $(LN) -sf --relative $(LIBINSTALL)/$(LIBSO) $(LIBINSTALL)/$(TARGET) diff --git a/package/libsepol/0003-revert-ln-relative.patch b/package/libsepol/0004-revert-ln-relative.patch similarity index 54% rename from package/libsepol/0003-revert-ln-relative.patch rename to package/libsepol/0004-revert-ln-relative.patch index 488a9abea0..9d1553ed97 100644 --- a/package/libsepol/0003-revert-ln-relative.patch +++ b/package/libsepol/0004-revert-ln-relative.patch @@ -12,23 +12,16 @@ they are maintained (up to 10 years in some cases?). For the sake of Buildroot, revert the upstream patch. Signed-off-by: "Yann E. MORIN" ---- - src/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/src/Makefile b/src/Makefile -index 040921d..e811c9e 100644 ---- a/src/Makefile -+++ b/src/Makefile -@@ -92,7 +92,7 @@ install: all - ifeq ($(STATIC),) - test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR) - install -m 755 $(LIBSO) $(SHLIBDIR) -- $(LN) -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET) -+ cd $(LIBDIR) && ln -sf ../../`basename $(SHLIBDIR)`/$(LIBSO) $(TARGET) +diff -durNw libsepol-2.7.orig/src/Makefile libsepol-2.7/src/Makefile +--- libsepol-2.7.orig/src/Makefile 2018-01-15 21:37:12.821831315 +0100 ++++ libsepol-2.7/src/Makefile 2018-01-15 21:38:03.838497434 +0100 +@@ -92,7 +92,7 @@ endif + test -d $(LIBINSTALL)/pkgconfig || install -m 755 -d $(LIBINSTALL)/pkgconfig + install -m 644 $(LIBPC) $(LIBINSTALL)/pkgconfig +- $(LN) -sf --relative $(LIBINSTALL)/$(LIBSO) $(LIBINSTALL)/$(TARGET) ++ cd $(LIBINSTALL) && ln -sf $(LIBSO) $(TARGET) relabel: --- -2.13.6 - + /sbin/restorecon $(LIBINSTALL)/$(LIBSO) diff --git a/package/libsepol/libsepol.mk b/package/libsepol/libsepol.mk index c54c3bfc42..5932ca1464 100644 --- a/package/libsepol/libsepol.mk +++ b/package/libsepol/libsepol.mk @@ -20,9 +20,7 @@ LIBSEPOL_MAKE_FLAGS += STATIC=1 endif define LIBSEPOL_BUILD_CMDS - # DESTDIR is needed during the compile to compute library and - # header paths. - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(LIBSEPOL_MAKE_FLAGS) DESTDIR=$(STAGING_DIR) + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(LIBSEPOL_MAKE_FLAGS) endef define LIBSEPOL_INSTALL_STAGING_CMDS @@ -35,7 +33,6 @@ endef HOST_LIBSEPOL_MAKE_ENV = \ $(HOST_MAKE_ENV) \ - DESTDIR=$(HOST_DIR) \ PREFIX=$(HOST_DIR) define HOST_LIBSEPOL_BUILD_CMDS