All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] lksctp-tools: allow building the library without the tools
@ 2016-04-27 15:29 lionel at vanbemten.com
  2016-04-27 20:06 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: lionel at vanbemten.com @ 2016-04-27 15:29 UTC (permalink / raw)
  To: buildroot

 From 6ec58aa8226a212e7b1d7bd7f058f52313f3e0e8 Mon Sep 17 00:00:00 2001
 From: Lionel Van Bemten <lionel@vanbemten.com>
Date: Tue, 26 Apr 2016 18:43:55 +0200
Subject: [PATCH 1/1] lksctp-tools: allow building the library without 
the tools

lksctp-tools provides three things:
   * C language header files (netinet/sctp.h)
   * a user-space library (libsctp)
   * some helper utilities around SCTP (sctp_darn,
     checksctp, sctp_status, withsctp and sctp_test)

This change makes it possible to
   * publish the header file without building the library
     nor the tools (for applications using only system calls)
   * build the library without the tools (typical usecase
     for an embedded application)

Signed-off-by: Lionel Van Bemten <lionel@vanbemten.com>
---
  package/lksctp-tools/Config.in       |   22 ++++++++++++++
  package/lksctp-tools/lksctp-tools.mk |   53 
++++++++++++++++++++++++++++++++++
  2 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/package/lksctp-tools/Config.in 
b/package/lksctp-tools/Config.in
index 9c95ef5..13d86db 100644
--- a/package/lksctp-tools/Config.in
+++ b/package/lksctp-tools/Config.in
@@ -15,3 +15,25 @@ config BR2_PACKAGE_LKSCTP_TOOLS
  comment "lksctp-tools needs a toolchain w/ threads, dynamic library"
         depends on BR2_USE_MMU
         depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
+
+if BR2_PACKAGE_LKSCTP_TOOLS
+
+config BR2_PACKAGE_LKSCTP_TOOLS_LIBSCTP
+       bool "libsctp"
+       default y
+       help
+         Enable this option to compile libsctp and make it available
+         to other packages. Otherwise only the header file
+         netinet/sctp.h is made public.
+
+config BR2_PACKAGE_LKSCTP_TOOLS_TOOLS
+       bool "tools"
+       default y
+       depends on BR2_PACKAGE_LKSCTP_TOOLS_LIBSCTP
+       help
+         Enable this option to compile the utilities provided by
+         lksctp-tools: sctp_darn, checksctp, sctp_status, withsctp
+         and sctp_test.
+
+endif
+
diff --git a/package/lksctp-tools/lksctp-tools.mk 
b/package/lksctp-tools/lksctp-tools.mk
index 91b96a6..1cb25ce 100644
--- a/package/lksctp-tools/lksctp-tools.mk
+++ b/package/lksctp-tools/lksctp-tools.mk
@@ -18,6 +18,59 @@ define LKSCTP_TOOLS_MAKE_M4
  endef
  LKSCTP_TOOLS_POST_PATCH_HOOKS += LKSCTP_TOOLS_MAKE_M4

+# Build and install binaries only when requested
+# Otherwise we only copy header files (netinet/sctp.h) to the staging 
directory
+# Therefore the BUILD and INSTALL_TARGET steps are skipped
+# and INSTALL_STAGING runs "make install" in subdirectory src/include
+
+# If libsctp is not selected
+#   - no compilation
+#   - no installation to target
+#   - only header files are installed to the staging directory
+ifneq ($(BR2_PACKAGE_LKSCTP_TOOLS_LIBSCTP),y)
+
+LKSCTP_TOOLS_INSTALL_TARGET = NO
+
+define LKSCTP_TOOLS_BUILD_CMDS
+       @echo Skip build step because BR2_PACKAGE_LKSCTP_TOOLS_LIBSCTP 
is not set
+endef
+
+define LKSCTP_TOOLS_INSTALL_STAGING_CMDS
+       $(TARGET_MAKE_ENV) $(LKSCTP_TOOLS_MAKE_ENV) $(LKSCTP_TOOLS_MAKE) 
$(LKSCTP_TOOLS_INSTALL_STAGING_OPTS) -C 
$(LKSCTP_TOOLS_SRCDIR)/src/include
+endef
+
+# If libsctp is selected
+else
+
+# If tools are not selected
+#   - compile only libsctp
+#   - install header files and libsctp to staging directory
+#   - install only libsctp to target
+ifneq ($(BR2_PACKAGE_LKSCTP_TOOLS_TOOLS),y)
+
+define LKSCTP_TOOLS_BUILD_CMDS
+       $(TARGET_MAKE_ENV) $(LKSCTP_TOOLS_MAKE_ENV) $(LKSCTP_TOOLS_MAKE) 
$(LKSCTP_TOOLS_MAKE_OPTS) -C $(LKSCTP_TOOLS_SRCDIR)/src/lib
+endef
+
+define LKSCTP_TOOLS_INSTALL_STAGING_CMDS
+       $(TARGET_MAKE_ENV) $(LKSCTP_TOOLS_MAKE_ENV) $(LKSCTP_TOOLS_MAKE) 
$(LKSCTP_TOOLS_INSTALL_STAGING_OPTS) -C 
$(LKSCTP_TOOLS_SRCDIR)/src/include
+       $(TARGET_MAKE_ENV) $(LKSCTP_TOOLS_MAKE_ENV) $(LKSCTP_TOOLS_MAKE) 
$(LKSCTP_TOOLS_INSTALL_STAGING_OPTS) -C $(LKSCTP_TOOLS_SRCDIR)/src/lib
+endef
+
+define LKSCTP_TOOLS_INSTALL_TARGET_CMDS
+       $(TARGET_MAKE_ENV) $(LKSCTP_TOOLS_MAKE_ENV) $(LKSCTP_TOOLS_MAKE) 
$(LKSCTP_TOOLS_INSTALL_TARGET_OPTS) -C $(LKSCTP_TOOLS_SRCDIR)/src/lib
+endef
+
+endif
+
+# If tools are selected
+#   - compile everything
+#   - install everything to target and staging directory
+# This is the default behavior of the autotools-package
+# so we don't need to define anything
+
+endif
+
  # Cleanup installed target source code
  define LKSCTP_TOOLS_CLEANUP_TARGET
         rm -rf $(TARGET_DIR)/usr/share/lksctp-tools
-- 
1.7.1

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

* [Buildroot] [PATCH 1/1] lksctp-tools: allow building the library without the tools
  2016-04-27 15:29 [Buildroot] [PATCH 1/1] lksctp-tools: allow building the library without the tools lionel at vanbemten.com
@ 2016-04-27 20:06 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2016-04-27 20:06 UTC (permalink / raw)
  To: buildroot

Hello,

>  From 6ec58aa8226a212e7b1d7bd7f058f52313f3e0e8 Mon Sep 17 00:00:00
> 2001 From: Lionel Van Bemten <lionel@vanbemten.com>
> Date: Tue, 26 Apr 2016 18:43:55 +0200
> Subject: [PATCH 1/1] lksctp-tools: allow building the library without 
> the tools
> 
> lksctp-tools provides three things:
>    * C language header files (netinet/sctp.h)
>    * a user-space library (libsctp)
>    * some helper utilities around SCTP (sctp_darn,
>      checksctp, sctp_status, withsctp and sctp_test)
> 
> This change makes it possible to
>    * publish the header file without building the library
>      nor the tools (for applications using only system calls)
>    * build the library without the tools (typical usecase
>      for an embedded application)
> 
> Signed-off-by: Lionel Van Bemten <lionel@vanbemten.com>

Thanks for your contribution! However, due to the fact that you sent it
with your webmail, the patch is badly line-wrapped and cannot be
applied. Could you resend it by using "git send-email" (it just
requires a standard SMTP server), which will ensure that the patch is
properly formatted?

Overall regarding the patch, I am wondering if want to go into such
granularity in the installation of this package. The library weights 5
KB, and the total size of the binaries is 84 KB. This really seems very
light, both in build time and in filesystem size consumption. This is
typically the kind of fine-tuning that we generally prefer to do in a
post-build script.

What do you think?

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:[~2016-04-27 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-27 15:29 [Buildroot] [PATCH 1/1] lksctp-tools: allow building the library without the tools lionel at vanbemten.com
2016-04-27 20:06 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.