kumquat-buildroot/package/hiredis/hiredis.mk
Romain Naour 96daacb720 package/hiredis: fix installation logic of library
While testing minetest with libhiredis library, the game crached due to
missing libhiredis.so.0.13 library.

The hiredis.mk doesn't use "make install" because "make install" depends
on building both the shared and static libraries, which fails in
static-only scenarios.

However, the installation logic in hiredis.mk is bogus: it installs the
library as libhiredis.so, while its SONAME is libhiredis.so.0.13. We fix
this by using the same logic as the one done by the package "make
install" process: install the library as libhiredis.so.0.13, and create
libhiredis.so as a symbolic link to it.

While at it:

 - Install the library 0755, this is more common.

 - Do not create $(TARGET_DIR)/usr/lib, since $(INSTALL) -D will create
   the necessary directories for the destination path.

Signed-off-by: Romain Naour <romain.naour@gmail.com>
Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>
[Thomas: rework to use the same installation logic as the one from
hiredis "make install".]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-04-12 21:34:12 +02:00

53 lines
1.6 KiB
Makefile

################################################################################
#
# hiredis
#
################################################################################
HIREDIS_VERSION_MAJOR = 0.13
HIREDIS_VERSION = v$(HIREDIS_VERSION_MAJOR).3
HIREDIS_SITE = $(call github,redis,hiredis,$(HIREDIS_VERSION))
HIREDIS_LICENSE = BSD-3-Clause
HIREDIS_LICENSE_FILES = COPYING
HIREDIS_INSTALL_STAGING = YES
HIREDIS_MAKE_OPTS = \
$(TARGET_CONFIGURE_OPTS) \
PREFIX=/usr
HIREDIS_TARGETS = hiredis.pc
ifeq ($(BR2_STATIC_LIBS),y)
HIREDIS_TARGETS += static
else ifeq ($(BR2_SHARED_LIBS),y)
HIREDIS_TARGETS += dynamic
else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
HIREDIS_TARGETS += dynamic static
endif
define HIREDIS_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE) $(HIREDIS_MAKE_OPTS) -C $(@D) \
$(HIREDIS_TARGETS)
endef
HIREDIS_INCLUDE_DIR = $(STAGING_DIR)/usr/include/hiredis
# Do not call make install as this target will build shared and static libraries
define HIREDIS_INSTALL_STAGING_CMDS
mkdir -p $(HIREDIS_INCLUDE_DIR)
cp -dpfr $(@D)/hiredis.h $(@D)/async.h $(@D)/read.h $(@D)/sds.h \
$(@D)/adapters $(HIREDIS_INCLUDE_DIR)
$(INSTALL) -D -m 0644 $(@D)/hiredis.pc \
$(STAGING_DIR)/usr/lib/pkgconfig/hiredis.pc
$(INSTALL) -D -m 0755 $(@D)/libhiredis.so \
$(STAGING_DIR)/usr/lib/libhiredis.so.$(HIREDIS_VERSION_MAJOR)
ln -sf libhiredis.so.$(HIREDIS_VERSION_MAJOR) $(STAGING_DIR)/usr/lib/libhiredis.so
endef
define HIREDIS_INSTALL_TARGET_CMDS
$(INSTALL) -D -m 0755 $(@D)/libhiredis.so \
$(TARGET_DIR)/usr/lib/libhiredis.so.$(HIREDIS_VERSION_MAJOR)
ln -sf libhiredis.so.$(HIREDIS_VERSION_MAJOR) $(TARGET_DIR)/usr/lib/libhiredis.so
endef
$(eval $(generic-package))