diff mbox

[1/2] tcl: add support for static builds

Message ID 1425681022-16612-1-git-send-email-Vincent.Riera@imgtec.com
State Superseded
Headers show

Commit Message

Vicente Olivert Riera March 6, 2015, 10:30 p.m. UTC
tcl fails to build statically for two reasons. The first one is because
it tries to build the tclsh binary with dynamic loading support, which
uses dlopen() and friends. This is because the '--enable-load' configure
option is 'on' by default. The second one is because it builds the
'packages' by default. These 'packages' are shared objects which are
intended to be loaded dynamically.

In order to fix this, we add '--disable-load' to the configure options
and avoid building the 'packages' when BR2_STATIC_LIBS is set.

Related upstream mailing list thread:

  http://sourceforge.net/p/tcl/mailman/message/33388034/

Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
---
 package/tcl/tcl.mk |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

Comments

Thomas Petazzoni March 7, 2015, 10:11 a.m. UTC | #1
Dear Vicente Olivert Riera,

On Fri, 6 Mar 2015 22:30:21 +0000, Vicente Olivert Riera wrote:

> +ifeq ($(BR2_STATIC_LIBS),y)
> +# Do not build tclsh with dynamic loading support when building it
> +# statically because it needs dlopen() and friends.
> +TCL_CONF_OPTS += --disable-load
> +HOST_TCL_CONF_OPTS += --disable-load
> +# Also, build only the binaries and libraries and don't build the
> +# 'packages' because they are shared objects which are intended to be
> +# loaded dynamically.
> +TCL_MAKE_OPTS = binaries libraries
> +HOST_TCL_MAKE_OPTS = binaries libraries
> +TCL_INSTALL_STAGING_OPTS = DESTDIR=$(STAGING_DIR) install-binaries install-libraries
> +TCL_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) install-binaries
> +HOST_TCL_INSTALL_OPTS = DESTDIR=$(STAGING_DIR) install-binaries install-libraries
> +endif

BR2_STATIC_LIBS indicates that the *target* packages are built static
only. Host packages continue to be built dynamically. So I believe all
the HOST_* assignments in here are wrong.

Best regards,

Thomas
Vicente Olivert Riera March 7, 2015, 12:20 p.m. UTC | #2
Dear Thomas Petazzoni,

On 07/03/15 11:11, Thomas Petazzoni wrote:
> Dear Vicente Olivert Riera,
> 
> On Fri, 6 Mar 2015 22:30:21 +0000, Vicente Olivert Riera wrote:
> 
>> +ifeq ($(BR2_STATIC_LIBS),y)
>> +# Do not build tclsh with dynamic loading support when building it
>> +# statically because it needs dlopen() and friends.
>> +TCL_CONF_OPTS += --disable-load
>> +HOST_TCL_CONF_OPTS += --disable-load
>> +# Also, build only the binaries and libraries and don't build the
>> +# 'packages' because they are shared objects which are intended to be
>> +# loaded dynamically.
>> +TCL_MAKE_OPTS = binaries libraries
>> +HOST_TCL_MAKE_OPTS = binaries libraries
>> +TCL_INSTALL_STAGING_OPTS = DESTDIR=$(STAGING_DIR) install-binaries install-libraries
>> +TCL_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) install-binaries
>> +HOST_TCL_INSTALL_OPTS = DESTDIR=$(STAGING_DIR) install-binaries install-libraries
>> +endif
> 
> BR2_STATIC_LIBS indicates that the *target* packages are built static
> only. Host packages continue to be built dynamically. So I believe all
> the HOST_* assignments in here are wrong.

Noted. I will fix that in the v2. Thanks!

--
Vincent

> Best regards,
> 
> Thomas
>
diff mbox

Patch

diff --git a/package/tcl/tcl.mk b/package/tcl/tcl.mk
index 1ebba1e..ad76e9b 100644
--- a/package/tcl/tcl.mk
+++ b/package/tcl/tcl.mk
@@ -29,6 +29,21 @@  HOST_TCL_CONF_OPTS = \
 	--disable-langinfo \
 	--disable-framework
 
+ifeq ($(BR2_STATIC_LIBS),y)
+# Do not build tclsh with dynamic loading support when building it
+# statically because it needs dlopen() and friends.
+TCL_CONF_OPTS += --disable-load
+HOST_TCL_CONF_OPTS += --disable-load
+# Also, build only the binaries and libraries and don't build the
+# 'packages' because they are shared objects which are intended to be
+# loaded dynamically.
+TCL_MAKE_OPTS = binaries libraries
+HOST_TCL_MAKE_OPTS = binaries libraries
+TCL_INSTALL_STAGING_OPTS = DESTDIR=$(STAGING_DIR) install-binaries install-libraries
+TCL_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) install-binaries
+HOST_TCL_INSTALL_OPTS = DESTDIR=$(STAGING_DIR) install-binaries install-libraries
+endif
+
 # I haven't found a good way to force pkgs to not build
 # or configure without just removing the entire pkg directory.
 define HOST_TCL_REMOVE_PACKAGES