diff mbox series

[2/2] libada: Respect `--enable-version-specific-runtime-libs'

Message ID alpine.LFD.2.21.1909252004290.28360@redsun52.ssa.fujisawa.hgst.com
State Accepted
Headers show
Series libada: Installation improvements | expand

Commit Message

Maciej W. Rozycki Sept. 25, 2019, 9:23 p.m. UTC
Respect the `--enable-version-specific-runtime-libs' configuration 
option in libada/, so that shared gnatlib libraries will be installed 
in non-version-specific $(toolexeclibdir) if requested.  In a 
cross-compilation environment this helps setting up a consistent 
sysroot, which can then be shared between the host and the target 
system.

Update the settings of $(toolexecdir) and $(toolexeclibdir), unused till 
now, to keep the current arrangement in the version-specific case and 
make the new option to be enabled by default, unlike with the other 
target libraries, so as to keep existing people's build infrastructure 
unaffected.

Of course if someone does use `--disable-version-specific-runtime-libs' 
already, then the installation location of shared gnatlib libraries will 
change, but presumably this is what they do want anyway as the current 
situation where the option is ignored in libada/ only is an anomaly 
really rather than one that is expected or desired.

	gcc/ada/
	* gcc-interface/Makefile.in (ADA_RTL_DSO_DIR): New variable.
	(install-gnatlib): Use it in place of ADA_RTL_OBJ_DIR for shared 
	library installation.

	libada/
	* Makefile.in (toolexecdir, toolexeclibdir): New variables.
	(LIBADA_FLAGS_TO_PASS): Add `toolexeclibdir'.
	* configure.ac: Add `--enable-version-specific-runtime-libs'.
	Update version-specific `toolexecdir' and `toolexeclibdir' from 
	ADA_RTL_OBJ_DIR from gcc/ada/gcc-interface/Makefile.in.
	* configure: Regenerate.
---
 gcc/ada/gcc-interface/Makefile.in |    7 ++++---
 libada/Makefile.in                |    3 +++
 libada/configure                  |   25 ++++++++++++++++++++++---
 libada/configure.ac               |   20 +++++++++++++++++---
 4 files changed, 46 insertions(+), 9 deletions(-)

gcc-install-sysroot-gnatlib.diff

Comments

Arnaud Charlet Sept. 26, 2019, 7:46 a.m. UTC | #1
> Respect the `--enable-version-specific-runtime-libs' configuration 
> option in libada/, so that shared gnatlib libraries will be installed 
> in non-version-specific $(toolexeclibdir) if requested.  In a 
> cross-compilation environment this helps setting up a consistent 
> sysroot, which can then be shared between the host and the target 
> system.
> 
> Update the settings of $(toolexecdir) and $(toolexeclibdir), unused till 
> now, to keep the current arrangement in the version-specific case and 
> make the new option to be enabled by default, unlike with the other 
> target libraries, so as to keep existing people's build infrastructure 
> unaffected.

Can you clarify what will be the value of ADA_RTL_OBJ_DIR and ADA_RTL_DSO_DIR
in the following cases:

- no version-specific-runtime-libs configure switch at all (default)
- use of --enable-version-specific-runtime-libs
- use of --disable-version-specific-runtime-libs

Arno
Maciej W. Rozycki Sept. 26, 2019, 2:08 p.m. UTC | #2
On Thu, 26 Sep 2019, Arnaud Charlet wrote:

> > Respect the `--enable-version-specific-runtime-libs' configuration 
> > option in libada/, so that shared gnatlib libraries will be installed 
> > in non-version-specific $(toolexeclibdir) if requested.  In a 
> > cross-compilation environment this helps setting up a consistent 
> > sysroot, which can then be shared between the host and the target 
> > system.
> > 
> > Update the settings of $(toolexecdir) and $(toolexeclibdir), unused till 
> > now, to keep the current arrangement in the version-specific case and 
> > make the new option to be enabled by default, unlike with the other 
> > target libraries, so as to keep existing people's build infrastructure 
> > unaffected.
> 
> Can you clarify what will be the value of ADA_RTL_OBJ_DIR and ADA_RTL_DSO_DIR
> in the following cases:
> 
> - no version-specific-runtime-libs configure switch at all (default)

ADA_RTL_OBJ_DIR=$(libsubdir)/adalib
ADA_RTL_DSO_DIR=$(libdir)/gcc/$(target_noncanonical)/$(version)$(MULTISUBDIR)/adalib

e.g. (no multilibs):

ADA_RTL_OBJ_DIR=$(prefix)/lib/gcc/x86_64-linux-gnu/10.0.0/adalib
ADA_RTL_DSO_DIR=$(prefix)/lib/gcc/x86_64-linux-gnu/10.0.0/adalib

or (with multilibs):

ADA_RTL_OBJ_DIR=$(prefix)/lib/gcc/riscv64-linux-gnu/10.0.0/lib32/ilp32/adalib
ADA_RTL_DSO_DIR=$(prefix)/lib/gcc/riscv64-linux-gnu/10.0.0/lib32/ilp32/adalib
ADA_RTL_OBJ_DIR=$(prefix)/lib/gcc/riscv64-linux-gnu/10.0.0/lib32/ilp32d/adalib
ADA_RTL_DSO_DIR=$(prefix)/lib/gcc/riscv64-linux-gnu/10.0.0/lib32/ilp32d/adalib
ADA_RTL_OBJ_DIR=$(prefix)/lib/gcc/riscv64-linux-gnu/10.0.0/lib64/lp64/adalib
ADA_RTL_DSO_DIR=$(prefix)/lib/gcc/riscv64-linux-gnu/10.0.0/lib64/lp64/adalib
[...]

> - use of --enable-version-specific-runtime-libs

Same as above.

> - use of --disable-version-specific-runtime-libs

ADA_RTL_OBJ_DIR=$(libsubdir)/adalib

ADA_RTL_DSO_DIR varies in Makefile as the multilib part is now set by 
`configure' as with other target libraries, so with `x86_64-linux-gnu' 
(native) I have:

ADA_RTL_DSO_DIR=$(libdir)/../lib64

and with `riscv64-linux-gnu' (cross) I have e.g.:

ADA_RTL_DSO_DIR=$(exec_prefix)/$(target_alias)/lib/../lib64/lp64d

and then specifically (no multilibs):

ADA_RTL_OBJ_DIR=$(prefix)/lib/gcc/x86_64-linux-gnu/10.0.0/adalib
ADA_RTL_DSO_DIR=$(prefix)/lib64

or (with multilibs):

ADA_RTL_OBJ_DIR=$(prefix)/lib/gcc/riscv64-linux-gnu/10.0.0/lib32/ilp32/adalib
ADA_RTL_DSO_DIR=$(prefix)/riscv64-linux-gnu/lib32/ilp32
ADA_RTL_OBJ_DIR=$(prefix)/lib/gcc/riscv64-linux-gnu/10.0.0/lib32/ilp32d/adalib
ADA_RTL_DSO_DIR=$(prefix)/riscv64-linux-gnu/lib32/ilp32d
ADA_RTL_OBJ_DIR=$(prefix)/lib/gcc/riscv64-linux-gnu/10.0.0/lib64/lp64/adalib
ADA_RTL_DSO_DIR=$(prefix)/riscv64-linux-gnu/lib64/lp64
[...]

Notice that ADA_RTL_OBJ_DIR never changes with/without the use of this 
configuration option (as expected).

 Does it answer your question?

  Maciej
Arnaud Charlet Sept. 26, 2019, 2:14 p.m. UTC | #3
> Notice that ADA_RTL_OBJ_DIR never changes with/without the use of this 
> configuration option (as expected).
> 
>  Does it answer your question?

Yes, that's now very clear, thanks!

The change is OK for me, thanks.

Arno
Maciej W. Rozycki Sept. 27, 2019, 12:40 a.m. UTC | #4
On Thu, 26 Sep 2019, Arnaud Charlet wrote:

> > Notice that ADA_RTL_OBJ_DIR never changes with/without the use of this 
> > configuration option (as expected).
> > 
> >  Does it answer your question?
> 
> Yes, that's now very clear, thanks!

 Sorry not to make the original change description clear enough.

> The change is OK for me, thanks.

 Thanks for your review.

 Shall I amend the change description anyhow then?  I know it has not (as 
yet, as discussed at the GNU Tools Cauldron recently) been enforced for 
the GCC project (unlike with e.g. glibc), however I mean to use it whole 
as the commit message, which is what I have been doing for quite a while 
now, because I recognise the value of change descriptions for future 
repository examination.

  Maciej
Arnaud Charlet Sept. 27, 2019, 7:16 a.m. UTC | #5
>  Shall I amend the change description anyhow then?  I know it has not (as 
> yet, as discussed at the GNU Tools Cauldron recently) been enforced for 
> the GCC project (unlike with e.g. glibc), however I mean to use it whole 
> as the commit message, which is what I have been doing for quite a while 
> now, because I recognise the value of change descriptions for future 
> repository examination.

Sure, add any needed clarification.
Maciej W. Rozycki Oct. 1, 2019, 7:16 p.m. UTC | #6
On Fri, 27 Sep 2019, Arnaud Charlet wrote:

> >  Shall I amend the change description anyhow then?  I know it has not (as 
> > yet, as discussed at the GNU Tools Cauldron recently) been enforced for 
> > the GCC project (unlike with e.g. glibc), however I mean to use it whole 
> > as the commit message, which is what I have been doing for quite a while 
> > now, because I recognise the value of change descriptions for future 
> > repository examination.
> 
> Sure, add any needed clarification.

 I have added this:

This lets one have `libgnarl-10.so' and `libgnat-10.so' installed in say
/usr/lib and /usr/$(target_alias)/lib for a native and a cross-build
respectively, rather than in /usr/lib/gcc/$(target_alias)/10.0.0/adalib.

and committed the change now.

  Maciej
Eric Botcazou Dec. 18, 2019, 11:14 a.m. UTC | #7
> 	gcc/ada/
> 	* gcc-interface/Makefile.in (ADA_RTL_DSO_DIR): New variable.
> 	(install-gnatlib): Use it in place of ADA_RTL_OBJ_DIR for shared
> 	library installation.
> 
> 	libada/
> 	* Makefile.in (toolexecdir, toolexeclibdir): New variables.
> 	(LIBADA_FLAGS_TO_PASS): Add `toolexeclibdir'.
> 	* configure.ac: Add `--enable-version-specific-runtime-libs'.
> 	Update version-specific `toolexecdir' and `toolexeclibdir' from
> 	ADA_RTL_OBJ_DIR from gcc/ada/gcc-interface/Makefile.in.
> 	* configure: Regenerate.

This breaks with --disable-libada because $(toolexeclibdir) is not set.
Maciej W. Rozycki Dec. 18, 2019, 11:23 a.m. UTC | #8
On Wed, 18 Dec 2019, Eric Botcazou wrote:

> > 	gcc/ada/
> > 	* gcc-interface/Makefile.in (ADA_RTL_DSO_DIR): New variable.
> > 	(install-gnatlib): Use it in place of ADA_RTL_OBJ_DIR for shared
> > 	library installation.
> > 
> > 	libada/
> > 	* Makefile.in (toolexecdir, toolexeclibdir): New variables.
> > 	(LIBADA_FLAGS_TO_PASS): Add `toolexeclibdir'.
> > 	* configure.ac: Add `--enable-version-specific-runtime-libs'.
> > 	Update version-specific `toolexecdir' and `toolexeclibdir' from
> > 	ADA_RTL_OBJ_DIR from gcc/ada/gcc-interface/Makefile.in.
> > 	* configure: Regenerate.
> 
> This breaks with --disable-libada because $(toolexeclibdir) is not set.

 Sorry about the breakage, I'll look into it right away.

  Maciej
Maciej W. Rozycki Dec. 19, 2019, 11:32 p.m. UTC | #9
Eric,

On Wed, 18 Dec 2019, Maciej W. Rozycki wrote:

> On Wed, 18 Dec 2019, Eric Botcazou wrote:
> 
> > > 	gcc/ada/
> > > 	* gcc-interface/Makefile.in (ADA_RTL_DSO_DIR): New variable.
> > > 	(install-gnatlib): Use it in place of ADA_RTL_OBJ_DIR for shared
> > > 	library installation.
> > > 
> > > 	libada/
> > > 	* Makefile.in (toolexecdir, toolexeclibdir): New variables.
> > > 	(LIBADA_FLAGS_TO_PASS): Add `toolexeclibdir'.
> > > 	* configure.ac: Add `--enable-version-specific-runtime-libs'.
> > > 	Update version-specific `toolexecdir' and `toolexeclibdir' from
> > > 	ADA_RTL_OBJ_DIR from gcc/ada/gcc-interface/Makefile.in.
> > > 	* configure: Regenerate.
> > 
> > This breaks with --disable-libada because $(toolexeclibdir) is not set.
> 
>  Sorry about the breakage, I'll look into it right away.

 Can you please be a little more specific as to what kind of breakage you 
see and/or specific configuration options and steps required to reproduce 
it?

 I have rebuilt GCC with `--disable-libada' and it didn't cause any 
anomalies I could notice whether `--enable-version-specific-runtime-libs' 
or `--disable-version-specific-runtime-libs' has been used.  I wouldn't 
expect any anyway, as shared libgnat and libgnarl libraries are not built 
in this case, so $(toolexeclibdir) is not supposed to be used.

  Maciej
Eric Botcazou Dec. 20, 2019, 10:08 a.m. UTC | #10
>  Can you please be a little more specific as to what kind of breakage you
> see and/or specific configuration options and steps required to reproduce
> it?

/usr/bin/install: missing destination file operand after 'rts/libgnat-21.so'
Try '/usr/bin/install --help' for more information.
ln: failed to create symbolic link '/libgnat.so': Permission denied
/usr/bin/install: missing destination file operand after 'rts/libgnarl-21.so'
Try '/usr/bin/install --help' for more information.
ln: failed to create symbolic link '/libgnarl.so': Permission denied

>  I have rebuilt GCC with `--disable-libada' and it didn't cause any
> anomalies I could notice whether `--enable-version-specific-runtime-libs'
> or `--disable-version-specific-runtime-libs' has been used.  I wouldn't
> expect any anyway, as shared libgnat and libgnarl libraries are not built
> in this case, so $(toolexeclibdir) is not supposed to be used.

Yes, shared libraries are built with "make -C gcc gnatlib-shared gnattools".
diff mbox series

Patch

Index: gcc/gcc/ada/gcc-interface/Makefile.in
===================================================================
--- gcc.orig/gcc/ada/gcc-interface/Makefile.in
+++ gcc/gcc/ada/gcc-interface/Makefile.in
@@ -534,15 +534,15 @@  install-gnatlib: ../stamp-gnatlib-$(RTSD
 	for file in gnat gnarl; do \
 	   if [ -f $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) ]; then \
 	      $(INSTALL) $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
-			 $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
+			 $(DESTDIR)$(ADA_RTL_DSO_DIR); \
 	   fi; \
 	   if [ -f $(RTSDIR)/lib$${file}$(soext) ]; then \
 	      $(LN_S) lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext) \
-	      $(DESTDIR)$(ADA_RTL_OBJ_DIR)/lib$${file}$(soext); \
+	      $(DESTDIR)$(ADA_RTL_DSO_DIR)/lib$${file}$(soext); \
 	   fi; \
 	   if [ -d $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM ]; then \
 	      $(CP) -r $(RTSDIR)/lib$${file}$(hyphen)$(LIBRARY_VERSION)$(soext).dSYM \
-	        $(DESTDIR)$(ADA_RTL_OBJ_DIR); \
+	        $(DESTDIR)$(ADA_RTL_DSO_DIR); \
 	   fi; \
 	done
 # This copy must be done preserving the date on the original file.
@@ -882,6 +882,7 @@  b_gnatm.o : b_gnatm.adb
 
 ADA_INCLUDE_DIR = $(libsubdir)/adainclude
 ADA_RTL_OBJ_DIR = $(libsubdir)/adalib
+ADA_RTL_DSO_DIR = $(toolexeclibdir)
 
 # Special flags
 
Index: gcc/libada/Makefile.in
===================================================================
--- gcc.orig/libada/Makefile.in
+++ gcc/libada/Makefile.in
@@ -38,6 +38,8 @@  target = @target@
 prefix = @prefix@
 
 # Nonstandard autoconf-set variables.
+toolexecdir = @toolexecdir@
+toolexeclibdir = @toolexeclibdir@
 enable_shared = @enable_shared@
 
 LN_S=@LN_S@
@@ -88,6 +90,7 @@  LIBADA_FLAGS_TO_PASS = \
         "TRACE=$(TRACE)" \
         "MULTISUBDIR=$(MULTISUBDIR)" \
         "libsubdir=$(libsubdir)" \
+        "toolexeclibdir=$(toolexeclibdir)" \
         "objext=$(objext)" \
         "prefix=$(prefix)" \
         "exeext=.exeext.should.not.be.used " \
Index: gcc/libada/configure
===================================================================
--- gcc.orig/libada/configure
+++ gcc/libada/configure
@@ -702,6 +702,7 @@  ac_subst_files=''
 ac_user_opts='
 enable_option_checking
 with_build_libsubdir
+enable_version_specific_runtime_libs
 enable_maintainer_mode
 enable_multilib
 enable_shared
@@ -1325,6 +1326,9 @@  if test -n "$ac_init_help"; then
   --disable-option-checking  ignore unrecognized --enable/--with options
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-version-specific-runtime-libs
+                          specify that runtime libraries should be installed
+                          in a compiler-specific directory
   --enable-maintainer-mode
                           enable make rules and dependencies not useful (and
                           sometimes confusing) to the casual installer
@@ -2215,6 +2219,22 @@  target_subdir=${target_noncanonical}
 
 
 # Command-line options.
+
+# Check whether --enable-version-specific-runtime-libs was given.
+if test "${enable_version_specific_runtime_libs+set}" = set; then :
+  enableval=$enable_version_specific_runtime_libs; case "$enableval" in
+     yes|no)
+       ;;
+     *)
+       as_fn_error $? "--enable-version-specific-runtime-libs must be yes or no" "$LINENO" 5
+       ;;
+   esac
+else
+  enable_version_specific_runtime_libs=yes
+
+fi
+
+
 # Very limited version of AC_MAINTAINER_MODE.
 # Check whether --enable-maintainer-mode was given.
 if test "${enable_maintainer_mode+set}" = set; then :
@@ -2273,8 +2293,8 @@  case ${enable_version_specific_runtime_l
     # Need the gcc compiler version to know where to install libraries
     # and header files if --enable-version-specific-runtime-libs option
     # is selected.
-    toolexecdir='$(libdir)/gcc/$(target_alias)'
-    toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+    toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
+    toolexeclibdir='$(toolexecdir)/$(version)$(MULTISUBDIR)/adalib'
     ;;
   no)
     if test -n "$with_cross_host" &&
@@ -2295,7 +2315,6 @@  case ${enable_version_specific_runtime_l
 esac
 
 
-#TODO: toolexeclibdir is currently disregarded
 
 # Check the compiler.
 # The same as in boehm-gc and libstdc++. Have to borrow it from there.
Index: gcc/libada/configure.ac
===================================================================
--- gcc.orig/libada/configure.ac
+++ gcc/libada/configure.ac
@@ -38,6 +38,21 @@  ACX_NONCANONICAL_TARGET
 GCC_TOPLEV_SUBDIRS
 
 # Command-line options.
+
+AC_ARG_ENABLE(version-specific-runtime-libs,
+  [AS_HELP_STRING([--enable-version-specific-runtime-libs],
+		  [specify that runtime libraries should be
+		   installed in a compiler-specific directory])],
+  [case "$enableval" in
+     yes|no)
+       ;;
+     *)
+       AC_MSG_ERROR([--enable-version-specific-runtime-libs must be yes or no])
+       ;;
+   esac],
+  [enable_version_specific_runtime_libs=yes]
+)
+
 # Very limited version of AC_MAINTAINER_MODE.
 AC_ARG_ENABLE([maintainer-mode],
   [AC_HELP_STRING([--enable-maintainer-mode],
@@ -60,8 +75,8 @@  case ${enable_version_specific_runtime_l
     # Need the gcc compiler version to know where to install libraries
     # and header files if --enable-version-specific-runtime-libs option
     # is selected.
-    toolexecdir='$(libdir)/gcc/$(target_alias)'
-    toolexeclibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+    toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
+    toolexeclibdir='$(toolexecdir)/$(version)$(MULTISUBDIR)/adalib'
     ;;
   no)
     if test -n "$with_cross_host" &&
@@ -82,7 +97,6 @@  case ${enable_version_specific_runtime_l
 esac
 AC_SUBST(toolexecdir)
 AC_SUBST(toolexeclibdir)
-#TODO: toolexeclibdir is currently disregarded
 
 # Check the compiler.
 # The same as in boehm-gc and libstdc++. Have to borrow it from there.