buildroot/package/jimtcl/jimtcl.mk
Thomas Petazzoni ef854d14f1 jimtcl: fix installation in BR2_STATIC_LIBS case
As noticed by Yann E. Morin in the review of
http://patchwork.ozlabs.org/patch/429533/, there was something fishy
in the jimtcl installation logic:

  ln -s libjim.$(JIMTCL_LIB) $(STAGING_DIR)/usr/lib/libjim.so

where JIMTCL_LIB has the value 'a' for BR2_STATIC_LIBS=y builds. Which
means we're linking libjim.so to libjim.a. Not great.

This commit therefore reworks the installation logic of the jimtcl.mk
package to install the shared library when BR2_STATIC_LIBS is not set,
and the static library when BR2_STATIC_LIBS is enabled. The macro
JIMTCL_INSTALL_LIB now takes as argument where the library should be
installed, so that it can be used for both the target and staging
installations.

Note that we can only either build the shared library *or* the static
library with the jimtcl build system. There is no possibility of
building both.

Reported-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-04-01 23:14:38 +02:00

67 lines
1.5 KiB
Makefile

################################################################################
#
# jimtcl
#
################################################################################
JIMTCL_VERSION = 0.75
JIMTCL_SITE = http://snapshot.debian.org/archive/debian/20141023T043132Z/pool/main/j/jimtcl
JIMTCL_SOURCE = jimtcl_$(JIMTCL_VERSION).orig.tar.xz
JIMTCL_INSTALL_STAGING = YES
JIMTCL_LICENSE = BSD-2c
JIMTCL_LICENSE_FILES = LICENSE
JIMTCL_HEADERS_TO_INSTALL = \
jim.h \
jim-eventloop.h \
jim-signal.h \
jim-subcmd.h \
jim-win32compat.h \
jim-config.h \
ifeq ($(BR2_PACKAGE_TCL),)
define JIMTCL_LINK_TCLSH
ln -sf jimsh $(TARGET_DIR)/usr/bin/tclsh
endef
endif
ifeq ($(BR2_STATIC_LIBS),y)
define JIMTCL_INSTALL_LIB
$(INSTALL) -m 0644 -D $(@D)/libjim.a $(1)/usr/lib/libjim.a
endef
else
JIMTCL_SHARED = --shared
define JIMTCL_INSTALL_LIB
$(INSTALL) -m 0755 -D $(@D)/libjim.so.$(JIMTCL_VERSION) \
$(1)/usr/lib/libjim.$(JIMTCL_VERSION)
ln -s libjim.$(JIMTCL_VERSION) $(1)/usr/lib/libjim.so
endef
endif
define JIMTCL_CONFIGURE_CMDS
(cd $(@D); \
$(TARGET_CONFIGURE_OPTS) CCACHE=none \
./configure --prefix=/usr \
$(JIMTCL_SHARED) \
)
endef
define JIMTCL_BUILD_CMDS
$(MAKE) -C $(@D)
endef
define JIMTCL_INSTALL_STAGING_CMDS
for i in $(JIMTCL_HEADERS_TO_INSTALL); do \
cp -a $(@D)/$$i $(STAGING_DIR)/usr/include/ || exit 1 ; \
done; \
$(call JIMTCL_INSTALL_LIB,$(STAGING_DIR))
endef
define JIMTCL_INSTALL_TARGET_CMDS
$(INSTALL) -D $(@D)/jimsh $(TARGET_DIR)/usr/bin/jimsh
$(call JIMTCL_INSTALL_LIB,$(TARGET_DIR))
$(JIMTCL_LINK_TCLSH)
endef
$(eval $(generic-package))