install: Fix creation of shared library symbolic links

When installing a shared library, make sure we actually create the symbolic
links for major and minor versions.

Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
This commit is contained in:
Christophe de Dinechin 2021-03-04 08:34:30 +01:00
parent 4a766a276a
commit e5fd9fe039
3 changed files with 11 additions and 13 deletions

View File

@ -122,9 +122,9 @@ PFX.dll= lib
# Shared libraries versioning
#------------------------------------------------------------------------------
MIQ_SOBASE= $(@F:%.install_dll=%)
MIQ_SOBASE= $(@F:%.install.dll=%)
MIQ_SONAME= $(MIQ_SOBASE)$(MIQ_V_MAJOR:%=.%)
MIQ_DLLNAME= $(@:%.install_dll=%)$(PRODUCTS_VERSION:%=.$(MIQ_V_VERSION))
MIQ_DLLNAME= $(@F:%.install.dll=%)$(PRODUCTS_VERSION:%=.$(MIQ_V_VERSION))
# Conversion to libttool input
MIQ_LT_CURRENT= $(shell echo $$(($(MIQ_V_MAJOR) + $(MIQ_V_MINOR))))
@ -135,8 +135,8 @@ MIQ_LT_VERS_OPT=$(PRODUCTS_VERSION:%=-version-info $(MIQ_LT_VERSION))
# Symbolic links for shared libraries
MIQ_SONAME_OPT= $(PRODUCTS_VERSION:%=-Wl,-soname -Wl,$(MIQ_SONAME))
MIQ_SYMLINKS_SO=ln -sf $(notdir $(MIQ_DLLNAME)) $(MIQ_SOBASE) && \
ln -sf $(notdir $(MIQ_DLLNAME)) $(MIQ_SONAME)
MIQ_SYMLINKS_SO=ln -sf $(MIQ_DLLNAME) $(MIQ_SOBASE) && \
ln -sf $(MIQ_DLLNAME) $(MIQ_SONAME)
MIQ_SYMLINKS= $(PRODUCTS_VERSION:%=&& $(MIQ_SYMLINKS_SO))
@ -165,8 +165,7 @@ LINK.lib= $(LINK-lt) $(LD) $(MIQ_LDFLAGS) $(MIQ_LINKARGS) \
-o $@ \
$(MIQ_LT_VERS_OPT)
LINK.dll= $(LINK.lib)
INSTALL.dll= $(LIBTOOL) --silent --mode=install \
$(INSTALL) $(MIQ_DLLNAME) $(PACKAGE_INSTALL.dll)
INSTALL.dll= $(LIBTOOL) --silent --mode=install $(INSTALL)
LINK.exe= $(MIQ_LINK) $(LD) $(MIQ_LINKARGS) $(MIQ_LDFLAGS) -o $@
else
# Non-libtool case: manage manually
@ -176,11 +175,10 @@ COMPILE.cpp= $(CXX) $(MIQ_CXXFLAGS) -c $< -o $@
COMPILE.s= $(CC) $(MIQ_CFLAGS) -c $< -o $@
LINK.lib= $(AR) $@ $^ && $(RANLIB) $@
LINK.dll= $(LD) -shared $(MIQ_LINKARGS) $(MIQ_LDFLAGS) \
-o $(MIQ_DLLNAME) \
-o $(OUTPUT)$(MIQ_DLLNAME) \
$(MIQ_SONAME_OPT) \
&& (cd $(OUTPUT) $(MIQ_SYMLINKS))
INSTALL.dll= $(INSTALL) $(MIQ_DLLNAME) $(PACKAGE_INSTALL.dll) \
&& (cd $(PACKAGE_INSTALL.dll) $(MIQ_SYMLINKS))
INSTALL.dll= (cd $(PACKAGE_INSTALL.dll) $(MIQ_SYMLINKS)) && $(INSTALL)
LINK.exe= $(LD) $(MIQ_LINKARGS) $(MIQ_LDFLAGS) -o $@
endif

View File

@ -46,7 +46,7 @@ TEST_ENV= DYLD_LIBRARY_PATH=$(OUTPUT)
# For macOS, the convention is to put the version number before extension,
# e.g. where Linux would have libfoo.so.1.3.2, macOS has libfoo.1.3.2.dylib
MIQ_DLLBASE= $(@:%.install_dll=%)
MIQ_DLLBASE= $(@F:%.install.dll=%)
MIQ_DLLNAME= $(MIQ_DLLBASE:%$(EXT.dll)=%$(PRODUCTS_VERSION:%=.$(MIQ_V_VERSION))$(EXT.dll))
MIQ_SONAME= $(MIQ_SOBASE:%$(EXT.dll)=%)$(MIQ_V_MAJOR:%=.%)$(EXT.dll)
MIQ_SONAME_OPT= $(PRODUCTS_VERSION:%=-Wl,-install_name -Wl,@rpath/$(MIQ_SONAME))

View File

@ -634,13 +634,13 @@ define install-rules
$2.install.$1: $$(PACKAGE_INSTALL.$1)$(notdir $2)
$$(PACKAGE_INSTALL.$1)$(notdir $2): $$(WARE_DIR.$1)$2 | .install-directories
$$(PRINT_INSTALL) $$(firstword $$(INSTALL.$1) $$(INSTALL)) $$(WARE_DIR.$1)$2 $$(PACKAGE_INSTALL.$1)
$$(PRINT_INSTALL) $$(if $$(INSTALL.$1),$$(INSTALL.$1),$$(INSTALL)) $$(WARE_DIR.$1)$2 $$(PACKAGE_INSTALL.$1)
$2.uninstall.$1:
$$(PRINT_UNINSTALL) $$(firstword $$(UNINSTALL.$1) $$(UNINSTALL)) $$(PACKAGE_INSTALL.$1)$2; $$(UNINSTALL.dir) $$(PACKAGE_INSTALL.$1) $$(UNINSTALL.ok)
$$(PRINT_UNINSTALL) $$(if $$(UNINSTALL.$1),$$(UNINSTALL.$1),$$(UNINSTALL)) $$(PACKAGE_INSTALL.$1)$2; $$(UNINSTALL.dir) $$(PACKAGE_INSTALL.$1) $$(UNINSTALL.ok)
$2.reinstall: $2 $$(PACKAGE_INSTALL.$1).mkdir-only
$$(PRINT_INSTALL) $$(firstword $$(INSTALL.$1) $$(INSTALL)) $2 $$(PACKAGE_INSTALL.$1)
$$(PRINT_INSTALL) $$(if $$(INSTALL.$1),$$(INSTALL.$1),$$(INSTALL)) $$(WARE_DIR.$1)$2 $$(PACKAGE_INSTALL.$1)
.install-directories: $$(PACKAGE_INSTALL.$1).mkdir-only