[2/4] Makerules: Remove lib-version, $(subdir-version)

Message ID 6f0697cc5bf2ed21b74e0e43f2fda120c7993127.1623312996.git.fweimer@redhat.com
State New
Headers show
Series
  • Do not install shared objects under versioned names
Related show

Commit Message

H.J. Lu via Libc-alpha June 10, 2021, 8:23 a.m.
Also clarify that the “versioned” term refers to the soname, not the glibc
version (which also ends up in the installed file name).

I verified on x86_64-linux-gnu that “make install” produces the same
files.
---
 Makerules | 26 ++++----------------------
 1 file changed, 4 insertions(+), 22 deletions(-)

-- 
2.31.1

Comments

H.J. Lu via Libc-alpha June 27, 2021, 9:32 p.m. | #1
On 6/10/21 4:23 AM, Florian Weimer via Libc-alpha wrote:
> Also clarify that the “versioned” term refers to the soname, not the glibc

> version (which also ends up in the installed file name).


Right.

Tested on x86_64 and i686. No regressions. Installed files look good.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

Tested-by: Carlos O'Donell <carlos@redhat.com>

 
> I verified on x86_64-linux-gnu that “make install” produces the same

> files.

> ---

>  Makerules | 26 ++++----------------------

>  1 file changed, 4 insertions(+), 22 deletions(-)

> 

> diff --git a/Makerules b/Makerules

> index ca9885436e..d3f29d0b89 100644

> --- a/Makerules

> +++ b/Makerules

> @@ -982,22 +982,21 @@ install-lib.so := $(filter %.so,$(install-lib:%_pic.a=%.so))

>  install-lib := $(filter-out %.so %_pic.a,$(install-lib))

>  

>  ifeq (yes,$(build-shared))

> -# Find which .so's have versions.

> +# Find which .so's have a version number in their soname.


OK.

>  versioned := $(strip $(foreach so,$(install-lib.so),\

>  			       $(patsubst %,$(so),$($(so)-version))))

>  

>  install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))

>  install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))

>  

> -# For versioned libraries, we install three files:

> +# For libraries whose soname have version numbers, we install three files:


OK. Correct.

>  #	$(inst_libdir)/libfoo.so	-- for linking, symlink or ld script

>  #	$(inst_slibdir)/libfoo.so.NN	-- for loading by SONAME, symlink

>  #	$(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file

> -lib-version := $(firstword $($(subdir)-version) $(version))


OK. Remove.

>  install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \

>  		      $(foreach L,$(install-lib.so-versioned),\

>  				$(inst_libdir)/$L \

> -				$(inst_slibdir)/$(L:.so=)-$(lib-version).so \

> +				$(inst_slibdir)/$(L:.so=)-$(version).so \


OK. This doesn't change anything. Cleanup.

>  				$(inst_slibdir)/$L$($L-version))

>  

>  # Install all the unversioned shared libraries.

> @@ -1125,7 +1124,6 @@ include $(o-iterator)

>  

>  generated += $(foreach o,$(versioned),$o$($o-version))

>  

> -ifeq (,$($(subdir)-version))


OK. Cleanup.

>  define o-iterator-doit

>  $(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \

>  				 $(+force);

> @@ -1140,23 +1138,7 @@ $(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force);

>  endef

>  object-suffixes-left := $(versioned)

>  include $(o-iterator)

> -else

> -define o-iterator-doit

> -$(inst_slibdir)/$o$($o-version): \

> -  $(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so $(+force);

> -	$$(make-shlib-link)

> -endef

> -object-suffixes-left := $(versioned)

> -include $(o-iterator)

> -

> -define o-iterator-doit

> -$(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so: $(objpfx)$o $(+force);

> -	$$(do-install-program)

> -endef

> -object-suffixes-left := $(versioned)

> -include $(o-iterator)

> -endif

> -endif

> +endif # ifneq (,$(versioned))


OK. Not needed.

>  

>  define do-install-so

>  $(do-install-program)

> 



-- 
Cheers,
Carlos.

Patch

diff --git a/Makerules b/Makerules
index ca9885436e..d3f29d0b89 100644
--- a/Makerules
+++ b/Makerules
@@ -982,22 +982,21 @@  install-lib.so := $(filter %.so,$(install-lib:%_pic.a=%.so))
 install-lib := $(filter-out %.so %_pic.a,$(install-lib))
 
 ifeq (yes,$(build-shared))
-# Find which .so's have versions.
+# Find which .so's have a version number in their soname.
 versioned := $(strip $(foreach so,$(install-lib.so),\
 			       $(patsubst %,$(so),$($(so)-version))))
 
 install-lib.so-versioned := $(filter $(versioned), $(install-lib.so))
 install-lib.so-unversioned := $(filter-out $(versioned), $(install-lib.so))
 
-# For versioned libraries, we install three files:
+# For libraries whose soname have version numbers, we install three files:
 #	$(inst_libdir)/libfoo.so	-- for linking, symlink or ld script
 #	$(inst_slibdir)/libfoo.so.NN	-- for loading by SONAME, symlink
 #	$(inst_slibdir)/libfoo-X.Y.Z.so -- the real shared object file
-lib-version := $(firstword $($(subdir)-version) $(version))
 install-lib-nosubdir: $(install-lib.so-unversioned:%=$(inst_slibdir)/%) \
 		      $(foreach L,$(install-lib.so-versioned),\
 				$(inst_libdir)/$L \
-				$(inst_slibdir)/$(L:.so=)-$(lib-version).so \
+				$(inst_slibdir)/$(L:.so=)-$(version).so \
 				$(inst_slibdir)/$L$($L-version))
 
 # Install all the unversioned shared libraries.
@@ -1125,7 +1124,6 @@  include $(o-iterator)
 
 generated += $(foreach o,$(versioned),$o$($o-version))
 
-ifeq (,$($(subdir)-version))
 define o-iterator-doit
 $(inst_slibdir)/$o$($o-version): $(inst_slibdir)/$(o:.so=)-$(version).so \
 				 $(+force);
@@ -1140,23 +1138,7 @@  $(inst_slibdir)/$(o:.so=)-$(version).so: $(objpfx)$o $(+force);
 endef
 object-suffixes-left := $(versioned)
 include $(o-iterator)
-else
-define o-iterator-doit
-$(inst_slibdir)/$o$($o-version): \
-  $(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so $(+force);
-	$$(make-shlib-link)
-endef
-object-suffixes-left := $(versioned)
-include $(o-iterator)
-
-define o-iterator-doit
-$(inst_slibdir)/$(o:.so=)-$($(subdir)-version).so: $(objpfx)$o $(+force);
-	$$(do-install-program)
-endef
-object-suffixes-left := $(versioned)
-include $(o-iterator)
-endif
-endif
+endif # ifneq (,$(versioned))
 
 define do-install-so
 $(do-install-program)