Don't build libnsl for new architectures

Message ID mvmbma5mdwk.fsf@suse.de
State New, archived
Headers

Commit Message

Andreas Schwab Aug. 14, 2018, 10:38 a.m. UTC
  This makes it possible to exclude a library depending on the minimum
shlib version.

Andreas.

	* scripts/haveversions.awk: New file.
	* Makerules ($(common-objpfx)Versions.def)
	($(common-objpfx)Versions.all, $(common-objpfx)Versions.v.i)
	($(common-objpfx)sysd-versions, $(common-objpfx)versions.stmp):
	Move rules ...
	* Makeconfig ($(common-objpfx)Versions.def)
	($(common-objpfx)Versions.all, $(common-objpfx)Versions.v.i)
	($(common-objpfx)sysd-versions, $(common-objpfx)versions.stmp):
	... here.
	($(common-objpfx)Versions.mk): New rule.  Include it.
	* nis/Makefile: Bracket all rules with ifdef
	have-libnsl-GLIBC_2.28.
---
 Makeconfig               | 55 ++++++++++++++++++++++++++++++++++++++++
 Makerules                | 50 ------------------------------------
 nis/Makefile             |  4 +++
 scripts/haveversions.awk |  8 ++++++
 4 files changed, 67 insertions(+), 50 deletions(-)
 create mode 100644 scripts/haveversions.awk
  

Comments

Zack Weinberg Aug. 14, 2018, 1:09 p.m. UTC | #1
On Tue, Aug 14, 2018 at 6:38 AM, Andreas Schwab <schwab@suse.de> wrote:
> This makes it possible to exclude a library depending on the minimum
> shlib version.

This seems like a good mechanism to have in general, but for libnsl
specifically, I wonder if we should continue to install a stub library
(an .a library only, containing a single object file that defines no
symbols, would be the safest) for the sake of Makefiles that may have
-lnsl hardcoded.

zw
  
Andreas Schwab Aug. 14, 2018, 1:23 p.m. UTC | #2
On Aug 14 2018, Zack Weinberg <zackw@panix.com> wrote:

> This seems like a good mechanism to have in general, but for libnsl
> specifically, I wonder if we should continue to install a stub library
> (an .a library only, containing a single object file that defines no
> symbols, would be the safest) for the sake of Makefiles that may have
> -lnsl hardcoded.

I don't think this is a problem, since they would already fail today.

Andreas.
  

Patch

diff --git a/Makeconfig b/Makeconfig
index 608ffe648c..5d92dfa86e 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1160,6 +1160,61 @@  $(common-objpfx)dl-tunable-list.stmp: \
 	touch $@
 endif
 
+# Generate version maps, but wait until sysdep-subdirs is known
+ifeq ($(sysd-sorted-done),t)
+ifeq ($(build-shared),yes)
+-include $(common-objpfx)sysd-versions
+-include $(common-objpfx)Versions.mk
+$(addprefix $(common-objpfx),$(version-maps)): $(common-objpfx)sysd-versions
+common-generated += $(version-maps)
+postclean-generated += sysd-versions Versions.all abi-versions.h \
+		       Versions.def Versions.v.i Versions.v Versions.mk
+
+ifndef avoid-generated
+ifneq ($(sysd-versions-subdirs),$(sorted-subdirs) $(config-sysdirs))
+sysd-versions-force = FORCE
+FORCE:
+endif
+
+$(common-objpfx)Versions.def: $(..)scripts/versionlist.awk \
+			      $(common-objpfx)Versions.v
+	LC_ALL=C $(AWK) -f $^ > $@T
+	mv -f $@T $@
+
+$(common-objpfx)Versions.all: $(..)scripts/firstversions.awk \
+			      $(common-objpfx)soversions.i \
+			      $(common-objpfx)Versions.def
+	{ while read which lib version setname; do \
+	    test x"$$which" = xDEFAULT || continue; \
+	    test -z "$$setname" || echo "$$lib : $$setname"; \
+	  done < $(word 2,$^); \
+	  cat $(word 3,$^); \
+	} | LC_ALL=C $(AWK) -f $< > $@T
+	mv -f $@T $@
+$(common-objpfx)Versions.mk: $(..)scripts/haveversions.awk \
+			     $(common-objpfx)Versions.all
+	$(AWK) -f $^ > $@T
+	mv -f $@T $@
+# See %.v/%.v.i implicit rules in Makeconfig.
+$(common-objpfx)Versions.v.i: $(wildcard $(subdirs:%=$(..)%/Versions)) \
+			      $(wildcard $(sysdirs:%=%/Versions)) \
+			      $(sysd-versions-force)
+$(common-objpfx)sysd-versions: $(common-objpfx)versions.stmp
+$(common-objpfx)versions.stmp: $(common-objpfx)Versions.all \
+			       $(common-objpfx)Versions.v \
+			       $(..)scripts/versions.awk
+	( echo 'sysd-versions-subdirs = $(subdirs) $(config-sysdirs)' ; \
+	  cat $(word 2,$^) \
+	  | LC_ALL=C $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \
+			    -v move_if_change='$(move-if-change)' \
+			    -f $(word 3,$^); \
+	) > $(common-objpfx)sysd-versionsT
+	mv -f $(common-objpfx)sysd-versionsT $(common-objpfx)sysd-versions
+	touch $@
+endif # avoid-generated
+endif # $(build-shared) = yes
+endif # sysd-sorted-done
+
 # The name under which the run-time dynamic linker is installed.
 # We are currently going for the convention that `/lib/ld.so.1'
 # names the SVR4/ELF ABI-compliant dynamic linker.
diff --git a/Makerules b/Makerules
index a10a0b4d70..0094c0b48e 100644
--- a/Makerules
+++ b/Makerules
@@ -446,56 +446,6 @@  object-suffixes-left := $(all-object-suffixes)
 include $(o-iterator)
 endif
 
-# Generate version maps, but wait until sysdep-subdirs is known
-ifeq ($(sysd-sorted-done),t)
-ifeq ($(build-shared),yes)
--include $(common-objpfx)sysd-versions
-$(addprefix $(common-objpfx),$(version-maps)): $(common-objpfx)sysd-versions
-common-generated += $(version-maps)
-postclean-generated += sysd-versions Versions.all abi-versions.h \
-		       Versions.def Versions.v.i Versions.v
-
-ifndef avoid-generated
-ifneq ($(sysd-versions-subdirs),$(sorted-subdirs) $(config-sysdirs))
-sysd-versions-force = FORCE
-FORCE:
-endif
-
-$(common-objpfx)Versions.def: $(..)scripts/versionlist.awk \
-			      $(common-objpfx)Versions.v
-	LC_ALL=C $(AWK) -f $^ > $@T
-	mv -f $@T $@
-
-$(common-objpfx)Versions.all: $(..)scripts/firstversions.awk \
-			      $(common-objpfx)soversions.i \
-			      $(common-objpfx)Versions.def
-	{ while read which lib version setname; do \
-	    test x"$$which" = xDEFAULT || continue; \
-	    test -z "$$setname" || echo "$$lib : $$setname"; \
-	  done < $(word 2,$^); \
-	  cat $(word 3,$^); \
-	} | LC_ALL=C $(AWK) -f $< > $@T
-	mv -f $@T $@
-# See %.v/%.v.i implicit rules in Makeconfig.
-$(common-objpfx)Versions.v.i: $(wildcard $(subdirs:%=$(..)%/Versions)) \
-			      $(wildcard $(sysdirs:%=%/Versions)) \
-			      $(sysd-versions-force)
-$(common-objpfx)sysd-versions: $(common-objpfx)versions.stmp
-$(common-objpfx)versions.stmp: $(common-objpfx)Versions.all \
-			       $(common-objpfx)Versions.v \
-			       $(..)scripts/versions.awk
-	( echo 'sysd-versions-subdirs = $(subdirs) $(config-sysdirs)' ; \
-	  cat $(word 2,$^) \
-	  | LC_ALL=C $(AWK) -v buildroot=$(common-objpfx) -v defsfile=$< \
-			    -v move_if_change='$(move-if-change)' \
-			    -f $(word 3,$^); \
-	) > $(common-objpfx)sysd-versionsT
-	mv -f $(common-objpfx)sysd-versionsT $(common-objpfx)sysd-versions
-	touch $@
-endif # avoid-generated
-endif # $(build-shared) = yes
-endif # sysd-sorted-done
-
 # Generate .dT files as we compile.
 compile-mkdep-flags = -MD -MP -MF $@.dt -MT $@
 compile-command.S = $(compile.S) $(OUTPUT_OPTION) $(compile-mkdep-flags)
diff --git a/nis/Makefile b/nis/Makefile
index d77c6e0c8e..4070ea48e6 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -22,6 +22,8 @@  subdir	:= nis
 
 include ../Makeconfig
 
+ifdef have-libnsl-GLIBC_2.28
+
 ifeq ($(build-obsolete-nsl),yes)
 headers			:= $(wildcard rpcsvc/*.[hx])
 
@@ -104,3 +106,5 @@  ifeq ($(build-obsolete-nsl),yes)
 $(others:%=$(objpfx)%): $(objpfx)libnsl.a
 endif
 endif
+
+endif # have-libnsl-GLIBC_2.28
diff --git a/scripts/haveversions.awk b/scripts/haveversions.awk
new file mode 100644
index 0000000000..e0a813b73e
--- /dev/null
+++ b/scripts/haveversions.awk
@@ -0,0 +1,8 @@ 
+# Script to postprocess Versions.all to determine which version each
+# library contains.
+
+$2 == "{" { lib = $1; next }
+$1 == "}" { next }
+NF == 1 {
+  printf "have-%s-%s = 1\n", lib, $1
+}