Don't build libnsl for new ABIs

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

Commit Message

Andreas Schwab Sept. 13, 2018, 8:30 a.m. UTC
  * 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 [!have-GLIBC_2.28]: Don't build any targets.
	Emit error if build-obsolete-nsl = yes.
	* manual/install.texi (Configuring and compiling): Describe
	--enable-obsolete-nsl as unavaiable after version 2.28.
	* INSTALL: Regenerate.
---
 INSTALL                  |  5 +++-
 Makeconfig               | 55 ++++++++++++++++++++++++++++++++++++++++
 Makerules                | 50 ------------------------------------
 manual/install.texi      |  3 +++
 nis/Makefile             | 10 ++++++++
 scripts/haveversions.awk | 11 ++++++++
 6 files changed, 83 insertions(+), 51 deletions(-)
 create mode 100644 scripts/haveversions.awk
  

Comments

Florian Weimer Sept. 21, 2018, 12:12 p.m. UTC | #1
* Andreas Schwab:

> diff --git a/Makeconfig b/Makeconfig
> index a9e50e5b60..fbcf69e7c2 100644
> --- a/Makeconfig
> +++ b/Makeconfig

I don't feel competent to review this changes, but I trust your
expertise.

> diff --git a/scripts/haveversions.awk b/scripts/haveversions.awk
> new file mode 100644
> index 0000000000..aecfcc7eef
> --- /dev/null
> +++ b/scripts/haveversions.awk
> @@ -0,0 +1,11 @@
> +# This Script read the contents of Versions.all and outputs a definition
> +# of variable have-VERSION for each symbol version VERSION which is
> +# defined.

“This script reads”

Could you add something how this is to be used?  I see you used ifndef,
which isn't what we'd use in C sources, but then make doesn't have an
equivalent of -Wundef.  Maybe something like this?

# The have-VERSION variables can be used to check that a port supports a
# particular symbol version in makefiles.  A test for a compatibility
# symbol which was superseded with a GLIBC_2.15 version could be tested
# like this:
#
# ifdef HAVE-GLIBC_2.14
# tests += tst-spawn4-compat
# endif # HAVE-GLIBC_2.14
#
# (NB: GLIBC_2.14 is the symbol version that immediately precedes
# GLIBC_2.15.)

> +
> +NF == 1 && $1 != "}" {
> +  haveversion[$1] = 1
> +}
> +END {
> +  for (i in haveversion)
> +    printf "have-%s = 1\n", i

Should this be:

+    printf "have-%s = yes\n", i

?  I think we use "no" in other places.

Thanks,
Florian
  
Andreas Schwab Sept. 24, 2018, 8:28 a.m. UTC | #2
Thanks, I have incorporated your suggestions and committed it.

Andreas.
  

Patch

diff --git a/INSTALL b/INSTALL
index 4faeac4469..f9c5cbb9a3 100644
--- a/INSTALL
+++ b/INSTALL
@@ -227,7 +227,10 @@  if 'CFLAGS' is specified it must enable optimization.  For example:
      By default, libnsl is only built as shared library for backward
      compatibility and the NSS modules libnss_compat, libnss_nis and
      libnss_nisplus are not built at all.  Use this option to enable
-     libnsl with all depending NSS modules and header files.
+     libnsl with all depending NSS modules and header files.  For
+     architectures and ABIs that have been added after version 2.28 of
+     the GNU C Library this option is not available, and the libnsl
+     compatibility library is not built.
 
 '--disable-crypt'
      Do not install the passphrase-hashing library 'libcrypt' or the
diff --git a/Makeconfig b/Makeconfig
index a9e50e5b60..fbcf69e7c2 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -1157,6 +1157,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 5d6434c74b..07bfe8abcb 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/manual/install.texi b/manual/install.texi
index eab4b0d75a..61178dadcd 100644
--- a/manual/install.texi
+++ b/manual/install.texi
@@ -259,6 +259,9 @@  compatibility and the NSS modules libnss_compat, libnss_nis and
 libnss_nisplus are not built at all.
 Use this option to enable libnsl with all depending NSS modules and
 header files.
+For architectures and ABIs that have been added after version 2.28 of
+@theglibc{} this option is not available, and the libnsl compatibility
+library is not built.
 
 @item --disable-crypt
 Do not install the passphrase-hashing library @file{libcrypt} or the
diff --git a/nis/Makefile b/nis/Makefile
index d77c6e0c8e..7849eb77c3 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -22,6 +22,14 @@  subdir	:= nis
 
 include ../Makeconfig
 
+ifndef have-GLIBC_2.28
+
+ifeq ($(build-obsolete-nsl),yes)
+$(error --enabe-obsolete-nsl is not available)
+endif
+
+else
+
 ifeq ($(build-obsolete-nsl),yes)
 headers			:= $(wildcard rpcsvc/*.[hx])
 
@@ -80,6 +88,8 @@  libnsl-inhibit-o = $(filter-out .os,$(object-suffixes))
 
 endif # not $(build-obsolete-nsl)
 
+endif # have-GLIBC_2.28
+
 include ../Rules
 
 
diff --git a/scripts/haveversions.awk b/scripts/haveversions.awk
new file mode 100644
index 0000000000..aecfcc7eef
--- /dev/null
+++ b/scripts/haveversions.awk
@@ -0,0 +1,11 @@ 
+# This Script read the contents of Versions.all and outputs a definition
+# of variable have-VERSION for each symbol version VERSION which is
+# defined.
+
+NF == 1 && $1 != "}" {
+  haveversion[$1] = 1
+}
+END {
+  for (i in haveversion)
+    printf "have-%s = 1\n", i
+}