Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] libcap: add menu entry to install tools.
@ 2014-04-20 19:30 Eric Le Bihan
  2014-04-21  9:40 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Le Bihan @ 2014-04-20 19:30 UTC (permalink / raw)
  To: buildroot

libcap provides a set of tools to manipulate capabilities, among which
`setcap(8)` and `getcap(8)`. A new menu entry has been added to install them.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 package/libcap/Config.in | 14 ++++++++++++++
 package/libcap/libcap.mk | 13 +++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/package/libcap/Config.in b/package/libcap/Config.in
index 7bf6c58..596da26 100644
--- a/package/libcap/Config.in
+++ b/package/libcap/Config.in
@@ -7,3 +7,17 @@ config BR2_PACKAGE_LIBCAP
 	  privilege into a set of distinct privileges.
 
 	  http://sites.google.com/site/fullycapable/
+
+if BR2_PACKAGE_LIBCAP
+
+config BR2_PACKAGE_LIBCAP_TOOLS
+	bool "install tools"
+	help
+	  Install setcap, getcap, getpcaps and capsh tools.
+
+	  For these tools to run properly, you should enable, in your
+	  kernel configuration, extended file attributes/security labels
+	  support for the file system type used on target system (e.g.
+	  CONFIG_EXT2_FS_XATTR and CONFIG_EXT2_FS_SECURITY for ext2).
+
+endif
diff --git a/package/libcap/libcap.mk b/package/libcap/libcap.mk
index 17e2eb5..4570a62 100644
--- a/package/libcap/libcap.mk
+++ b/package/libcap/libcap.mk
@@ -14,6 +14,7 @@ LIBCAP_LICENSE_FILES = License
 
 LIBCAP_DEPENDENCIES = host-libcap
 LIBCAP_INSTALL_STAGING = YES
+LIBCAP_BINARIES = setcap getcap getpcaps capsh
 
 ifeq ($(BR2_PACKAGE_ATTR),y)
 	LIBCAP_DEPENDENCIES += attr
@@ -34,7 +35,7 @@ LIBCAP_MAKE_INSTALL_TARGET = install
 endif
 
 define LIBCAP_BUILD_CMDS
-	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/libcap \
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
 		LIBATTR=$(LIBCAP_HAVE_LIBATTR) BUILD_CC="$(HOSTCC)" \
 		BUILD_CFLAGS="$(HOST_CFLAGS)" $(LIBCAP_MAKE_TARGET)
 endef
@@ -45,10 +46,18 @@ define LIBCAP_INSTALL_STAGING_CMDS
 endef
 
 define LIBCAP_INSTALL_TARGET_CMDS
-	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/libcap LIBATTR=$(LIBCAP_HAVE_LIBATTR) \
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) LIBATTR=$(LIBCAP_HAVE_LIBATTR) \
+		RAISE_SETFCAP=no \
 		DESTDIR=$(TARGET_DIR) prefix=/usr lib=lib $(LIBCAP_MAKE_INSTALL_TARGET)
 endef
 
+ifeq ($(BR2_PACKAGE_LIBCAP_TOOLS),)
+define LIBCAP_REMOVE_TOOLS
+	rm -f $(addprefix $(TARGET_DIR)/usr/sbin/, $(LIBCAP_BINARIES))
+endef
+LIBCAP_POST_INSTALL_TARGET_HOOKS += LIBCAP_REMOVE_TOOLS
+endif
+
 define HOST_LIBCAP_BUILD_CMDS
 	$(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) -C $(@D) LIBATTR=no
 endef
-- 
1.9.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Buildroot] [PATCH 1/1] libcap: add menu entry to install tools.
  2014-04-20 19:30 [Buildroot] [PATCH 1/1] libcap: add menu entry to install tools Eric Le Bihan
@ 2014-04-21  9:40 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2014-04-21  9:40 UTC (permalink / raw)
  To: buildroot

Dear Eric Le Bihan,

On Sun, 20 Apr 2014 21:30:13 +0200, Eric Le Bihan wrote:
> libcap provides a set of tools to manipulate capabilities, among which
> `setcap(8)` and `getcap(8)`. A new menu entry has been added to install them.
> 
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
>  package/libcap/Config.in | 14 ++++++++++++++
>  package/libcap/libcap.mk | 13 +++++++++++--
>  2 files changed, 25 insertions(+), 2 deletions(-)

I applied this patch, but I had to make heavy changes to it: you didn't
take into account the !MMU case, and the BR2_PREFER_STATIC_LIB case.
The first was easy to solve: programs cannot be built in a !MMU
configuration. The second one required more work, as your original
patch changes to run 'make' at the root of the libcap sources, which
doesn't work to build only the libcap.a library in a static library
context. So I had to revert your solution, and instead to a 'make' in
the libcap/ directory, and another 'make' in the progs/ directory.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-04-21  9:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-20 19:30 [Buildroot] [PATCH 1/1] libcap: add menu entry to install tools Eric Le Bihan
2014-04-21  9:40 ` Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox