From patchwork Tue Jan 16 08:22:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcus Folkesson X-Patchwork-Id: 861324 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.137; helo=fraxinus.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="DnZQLNLZ"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zLNWY1vZTz9ryr for ; Tue, 16 Jan 2018 19:22:49 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B429F86B51; Tue, 16 Jan 2018 08:22:46 +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 KIYqQx4WnbIZ; Tue, 16 Jan 2018 08:22:45 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 8A57986FD6; Tue, 16 Jan 2018 08:22:45 +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 BA84F1C0A2B for ; Tue, 16 Jan 2018 08:22:44 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id B6A2A86FD6 for ; Tue, 16 Jan 2018 08:22:44 +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 zfy47Pe-6EdV for ; Tue, 16 Jan 2018 08:22:44 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 7889B86B51 for ; Tue, 16 Jan 2018 08:22:43 +0000 (UTC) Received: by mail-lf0-f66.google.com with SMTP id y71so16284581lfd.12 for ; Tue, 16 Jan 2018 00:22:43 -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=kC9qFrRzghZccE86WWksaj0q7L9JRyWf/BWkkRwKg4g=; b=DnZQLNLZiVM62MHRHxSNLifn5itrO71XvxuLtEpwEJpiBnF/XK4y8MSX8h2m9P5eg/ zrHZ+SWZ4L8HLU2LdHUk2F7NV6q1d4/hE/Jc2WQTeiGymDOCJVQLZd1QZ89AKBT3Dcrm 8jAig9Xxy+LO2YyCMlD/2JPd1AVvR3TWF9C1hQkf3TbMFtS0Q1lXGjdJe5diZCXMxTQX DW2hwrlXhndmYYxIy1IYM0fVqF9Hh7m3AJWJB6tTy21Ns3Q7sKm9yALP0T1mS6WxYK+q W0sTbbpkjbp0UfE9NQIjhreLl62WSQUecP/LB9Z4N3wcDlFR+IESOASYLGZRiiKc+Cdo K2Bw== 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=kC9qFrRzghZccE86WWksaj0q7L9JRyWf/BWkkRwKg4g=; b=SrC/gUuDLY/GnYXxhDxx2n2q+BJ6+w4/i1YvTKmGFzIhysD/a479cKFbw8Wur9jUKf rVUfrpbxhfW+mTrTups3IUzB/M56qM5NXUzkBN3vHIsjAZJib4KZY7fjkGPTwrRPN+W+ pwV4ZGLdiuoq01x4zJlgMPI8h51ir7qRsssJK9ORZe/pmJW7yonec3zs418djnPHxFt8 yLkpIQB32mParL9Hn5HCeoMyh0hvXTaeGsUGWEp6p92ecw4BaASLKTLrI+B2is5iR9MO xZPd6mQSkPKU0G/AZpFbj9hoW/22EJ2zt8O190ee7l66CbNIWpEfBsQ8QHubo2jkI1cj kptw== X-Gm-Message-State: AKwxytfcasJ0tvueUfDCenGJApVEbRkQnC5d+EDdWgpUzkayKLi2P4LO q5vWSeGpiksM1EXJdf6Wn43HigFEXl8= X-Google-Smtp-Source: ACJfBotZe1UljKDweE+mRmJOzg9YUHyd8NWXL25XMFk3XngImyK64qK5TKY2qr0o3eAC492gscovZw== X-Received: by 10.25.83.198 with SMTP id h67mr17249515lfl.135.1516090961422; Tue, 16 Jan 2018 00:22:41 -0800 (PST) Received: from localhost.localdomain (c-5eea3743-74736162.cust.telenor.se. [94.234.55.67]) by smtp.gmail.com with ESMTPSA id s190sm255306lfe.89.2018.01.16.00.22.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 00:22:40 -0800 (PST) From: Marcus Folkesson To: buildroot@buildroot.org Date: Tue, 16 Jan 2018 09:22:33 +0100 Message-Id: <20180116082233.8639-1-marcus.folkesson@gmail.com> X-Mailer: git-send-email 2.15.1 Subject: [Buildroot] [PATCH] libsemanage: 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 libsemanage.mk and generate proper pkg-config files. Signed-off-by: Marcus Folkesson --- ...build-follow-standard-semantics-for-DESTD.patch | 118 +++++++++++++++++++++ package/libsemanage/libsemanage.mk | 6 +- 2 files changed, 119 insertions(+), 5 deletions(-) create mode 100644 package/libsemanage/0002-libsemanage-build-follow-standard-semantics-for-DESTD.patch diff --git a/package/libsemanage/0002-libsemanage-build-follow-standard-semantics-for-DESTD.patch b/package/libsemanage/0002-libsemanage-build-follow-standard-semantics-for-DESTD.patch new file mode 100644 index 0000000000..47ac6bded5 --- /dev/null +++ b/package/libsemanage/0002-libsemanage-build-follow-standard-semantics-for-DESTD.patch @@ -0,0 +1,118 @@ +libsemanage: build: follow standard semantics for DESTDIR and PREFIX + +This patch solves the following issues: +- 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 libsemanage.orig/include/Makefile libsemanage/include/Makefile +--- libsemanage.orig/include/Makefile 2018-01-12 12:42:30.915376458 +0100 ++++ libsemanage/include/Makefile 2018-01-12 10:04:18.632144240 +0100 +@@ -1,6 +1,6 @@ + # Installation directories. +-PREFIX ?= $(DESTDIR)/usr +-INCDIR ?= $(PREFIX)/include/semanage ++PREFIX ?= /usr ++INCDIR ?= $(DESTDIR)$(PREFIX)/include/semanage + + all: + +diff -durN libsemanage.orig/man/Makefile libsemanage/man/Makefile +--- libsemanage.orig/man/Makefile 2018-01-12 12:42:30.915376458 +0100 ++++ libsemanage/man/Makefile 2018-01-12 10:04:18.632144240 +0100 +@@ -1,6 +1,7 @@ + # Installation directories. +-MAN3DIR ?= $(DESTDIR)/usr/share/man/man3 +-MAN5DIR ?= $(DESTDIR)/usr/share/man/man5 ++PREFIX ?= /usr ++MAN3DIR ?= $(DESTDIR)$(PREFIX)/share/man/man3 ++MAN5DIR ?= $(DESTDIR)$(PREFIX)/share/man/man5 + + all: + +diff -durN libsemanage.orig/src/libsemanage.pc.in libsemanage/src/libsemanage.pc.in +--- libsemanage.orig/src/libsemanage.pc.in 2018-01-12 12:42:30.918709792 +0100 ++++ libsemanage/src/libsemanage.pc.in 2018-01-12 10:04:18.632144240 +0100 +@@ -1,6 +1,6 @@ + prefix=@prefix@ + exec_prefix=${prefix} +-libdir=${exec_prefix}/@libdir@ ++libdir=@libdir@ + includedir=@includedir@ + + Name: libsemanage +diff -durN libsemanage.orig/src/Makefile libsemanage/src/Makefile +--- libsemanage.orig/src/Makefile 2018-01-12 12:42:30.918709792 +0100 ++++ libsemanage/src/Makefile 2018-01-12 10:04:18.632144240 +0100 +@@ -8,10 +8,10 @@ + PKG_CONFIG ?= pkg-config + + # Installation directories. +-PREFIX ?= $(DESTDIR)/usr ++PREFIX ?= /usr + LIBDIR ?= $(PREFIX)/lib +-SHLIBDIR ?= $(DESTDIR)/lib + INCLUDEDIR ?= $(PREFIX)/include ++LIBINSTALL = $(DESTDIR)$(LIBDIR) + PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX)) + PYLIBS ?= $(shell $(PKG_CONFIG) --libs $(PYPREFIX)) + PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])') +@@ -20,8 +20,6 @@ + RUBYLIBS ?= $(shell $(RUBY) -e 'puts "-L" + RbConfig::CONFIG["libdir"] + " -L" + RbConfig::CONFIG["archlibdir"] + " " + RbConfig::CONFIG["LIBRUBYARG_SHARED"]') + RUBYINSTALL ?= $(DESTDIR)$(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]') + +-LIBBASE=$(shell basename $(LIBDIR)) +- + DEFAULT_SEMANAGE_CONF_LOCATION=$(DESTDIR)/etc/selinux/semanage.conf + + ifeq ($(DEBUG),1) +@@ -95,7 +93,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):' < $< > $@ + + semanageswig_python_exception.i: ../include/semanage/semanage.h + bash -e exception.sh > $@ || (rm -f $@ ; false) +@@ -136,13 +134,13 @@ + $(SWIG) $< + + install: all +- test -d $(LIBDIR) || install -m 755 -d $(LIBDIR) +- install -m 644 $(LIBA) $(LIBDIR) +- install -m 755 $(LIBSO) $(LIBDIR) +- 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) ++ install -m 755 $(LIBSO) $(LIBINSTALL) ++ test -d $(LIBINSTALL)/pkgconfig || install -m 755 -d $(LIBINSTALL)/pkgconfig ++ install -m 644 $(LIBPC) $(LIBINSTALL)/pkgconfig + test -f $(DEFAULT_SEMANAGE_CONF_LOCATION) || install -m 644 -D semanage.conf $(DEFAULT_SEMANAGE_CONF_LOCATION) +- cd $(LIBDIR) && ln -sf $(LIBSO) $(TARGET) ++ cd $(LIBINSTALL) && ln -sf $(LIBSO) $(TARGET) + + install-pywrap: pywrap + test -d $(PYSITEDIR) || install -m 755 -d $(PYSITEDIR) +@@ -155,7 +153,7 @@ + install -m 755 $(SWIGRUBYSO) $(RUBYINSTALL)/semanage.so + + relabel: +- /sbin/restorecon $(LIBDIR)/$(LIBSO) ++ /sbin/restorecon $(LIBINSTALL)/$(LIBSO) + + clean: + -rm -f $(LIBPC) $(OBJS) $(LOBJS) $(LIBA) $(LIBSO) $(SWIGLOBJ) $(SWIGSO) $(SWIGRUBYSO) $(TARGET) conf-parse.c conf-parse.h conf-scan.c *.o *.lo *~ +diff -durN libsemanage.orig/tests/Makefile libsemanage/tests/Makefile +--- libsemanage.orig/tests/Makefile 2018-01-12 12:42:30.922043125 +0100 ++++ libsemanage/tests/Makefile 2018-01-12 10:04:18.632144240 +0100 +@@ -1,6 +1,3 @@ +-PREFIX ?= $(DESTDIR)/usr +-LIBDIR ?= $(PREFIX)/lib +- + # Add your test source files here: + SOURCES = $(sort $(wildcard *.c)) + diff --git a/package/libsemanage/libsemanage.mk b/package/libsemanage/libsemanage.mk index 829409f527..5c5f4c88d8 100644 --- a/package/libsemanage/libsemanage.mk +++ b/package/libsemanage/libsemanage.mk @@ -14,9 +14,7 @@ LIBSEMANAGE_INSTALL_STAGING = YES LIBSEMANAGE_MAKE_OPTS = $(TARGET_CONFIGURE_OPTS) define LIBSEMANAGE_BUILD_CMDS - # DESTDIR is needed during the compile to compute library and - # header paths. - $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(LIBSEMANAGE_MAKE_OPTS) DESTDIR=$(STAGING_DIR) all + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(LIBSEMANAGE_MAKE_OPTS) all endef define LIBSEMANAGE_INSTALL_STAGING_CMDS @@ -30,10 +28,8 @@ endef HOST_LIBSEMANAGE_DEPENDENCIES = host-bison host-audit host-libsepol host-libselinux \ host-ustr host-bzip2 host-swig -# DESTDIR is needed during the compile to compute library and header paths. HOST_LIBSEMANAGE_MAKE_OPTS += \ $(HOST_CONFIGURE_OPTS) \ - DESTDIR=$(HOST_DIR) \ PREFIX=$(HOST_DIR) \ SWIG_LIB="$(HOST_DIR)/share/swig/$(SWIG_VERSION)/"