Prompted by a known make install failure on Linux/x86_64, I decided to finally rework my ancient patch
http://gcc.gnu.org/ml/gcc-patches/2014-04/msg01669.html along the lines Mike suggested back then, i.e. use cp && touch -r instead of cp -p. This avoids the failures like for file in rts/*.ad[sb]*; do \ cp -p $file /vol/gcc/obj/gcc/gcc-10/vol/gcc/lib/gcc/x86_64-pc-linux-gnu/10.0.0/adainclude; \ done cp: preserving permissions for ‘/vol/gcc/obj/gcc/gcc-10/vol/gcc/lib/gcc/x86_64-pc-linux-gnu/10.0.0/adainclude/a-assert.adb’: Operation not supported when installing e.g. to an NFSv3 destination which doesn't support POSIX ACLs from a local filesystem that does. The fix turned out to be a bit more involved than I initially thought: * I've changed INSTALL_DATA_DATE to use GNU make's $(call) function since the args are now needed twice. * The destination argument now needs to include the filename: while cp can use a directory as destination, touch -r needs the full filename to preserve the timestamps. * In order for $(notdir) to work which operates textually on its args, the loops had to be changed from shell for loops to make $(foreach) loops. * And finally, to avoid exceeding the command line length limit, the individual commands have been separate by newlines, a trick learned from https://stackoverflow.com/questions/7039811/how-do-i-process-extremely-long-lists-of-files-in-a-make-recipe When first testing this, the make install failed trying to install standard.ads.h: while this gave just a warning with the old code cp: cannot stat 'rts/standard.ads.h': No such file or directory it now fails. It turns out this is a dangling symlink $ ls -l gcc/ada/rts/standard.ads.h lrwxrwxrwx 1 ro gcc 50 May 7 18:13 gcc/ada/rts/standard.ads.h -> /vol/gcc/src/hg/trunk/local/gcc/ada/standard.ads.h $ ls -lL gcc/ada/rts/standard.ads.h ls: cannot access 'gcc/ada/rts/standard.ads.h': No such file or directory introduced in r260921. This is only present on mainline and the gcc-9 branch and the file seems never to have existed in tree, so I'm just removing the reference. Tested on x86_64-pc-linux-gnu installing both to a local filesystem and an NFSv3 filesystem. Ok for mainline (and the gcc-9 and gcc-8 branches eventually)? Thanks. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2019-05-04 Rainer Orth <r...@cebitec.uni-bielefeld.de> * Makefile.rtl (LIBGNAT_SRCS): Remove standard.ads.h. * gcc-interface/Makefile.in (INSTALL_DATA_DATE): Replace cp -p with cp && touch -r. (NL): Define. (install-gcc-specs, install-gnatlib): Adapt INSTALL_DATA_DATE uses. Switch to $(foreach). Separate commands by $(NL).
# HG changeset patch # Parent 53354151a0c54f05832420ddfa64adf8e22f6251 Avoid cp -p failures during Ada make install diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@ -2610,7 +2610,7 @@ LIBGNAT_OBJS = adadecode.o adaint.o argv # from ADA_INCLUDE_SRCS. LIBGNAT_SRCS = $(patsubst %.o,%.c,$(LIBGNAT_OBJS)) \ - adadecode.h adaint.h env.h gsocket.h raise.h standard.ads.h \ + adadecode.h adaint.h env.h gsocket.h raise.h \ tb-gcc.c libgnarl/thread.c $(EXTRA_LIBGNAT_SRCS) # memtrack.o is special as not put into libgnat. diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -98,7 +98,7 @@ COMPILER_FLAGS = $(CFLAGS) SHELL = @SHELL@ PWD_COMMAND = $${PWDCMD-pwd} # How to copy preserving the date -INSTALL_DATA_DATE = cp -p +INSTALL_DATA_DATE = cp $(1) $(2) && touch -r $(1) $(2) MAKEINFO = makeinfo TEXI2DVI = texi2dvi TEXI2PDF = texi2pdf @@ -502,26 +502,31 @@ gnatlink-re: ../stamp-tools gnatmake-re true; \ fi +# Used as line separator to avoid overflowing command lines. +define NL + + +endef + install-gcc-specs: # Install all the requested GCC spec files. - $(foreach f,$(GCC_SPEC_FILES), \ - $(INSTALL_DATA_DATE) $(srcdir)/ada/$(f) $(DESTDIR)$(libsubdir)/;) + $(foreach f, $(GCC_SPEC_FILES), \ + $(call INSTALL_DATA_DATE, $(srcdir)/ada/$(f), $(libsubdir))/$(notdir $(f));) install-gnatlib: ../stamp-gnatlib-$(RTSDIR) install-gcc-specs $(RMDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR) $(RMDIR) $(DESTDIR)$(ADA_INCLUDE_DIR) -$(MKDIR) $(DESTDIR)$(ADA_RTL_OBJ_DIR) -$(MKDIR) $(DESTDIR)$(ADA_INCLUDE_DIR) - for file in $(RTSDIR)/*.ali; do \ - $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \ - done + $(foreach file, $(wildcard $(RTSDIR)/*.ali), \ + $(call INSTALL_DATA_DATE, $(file), $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$(notdir $(file)))$(NL)) -cd $(RTSDIR); for file in *$(arext);do \ $(INSTALL_DATA) $$file $(DESTDIR)$(ADA_RTL_OBJ_DIR); \ $(RANLIB_FOR_TARGET) $(DESTDIR)$(ADA_RTL_OBJ_DIR)/$$file; \ done -$(foreach file, $(EXTRA_ADALIB_OBJS), \ - $(INSTALL_DATA_DATE) $(RTSDIR)/$(file) $(DESTDIR)$(ADA_RTL_OBJ_DIR) && \ + $(call INSTALL_DATA_DATE,$(RTSDIR)/$(file),$(DESTDIR)$(ADA_RTL_OBJ_DIR)/$(notdir $(file))$(NL)) && \ ) true # Install the shared libraries, if any, using $(INSTALL) instead # of $(INSTALL_DATA). The latter may force a mode inappropriate @@ -544,9 +549,8 @@ install-gnatlib: ../stamp-gnatlib-$(RTSD fi; \ done # This copy must be done preserving the date on the original file. - for file in $(RTSDIR)/*.ad[sb]*; do \ - $(INSTALL_DATA_DATE) $$file $(DESTDIR)$(ADA_INCLUDE_DIR); \ - done + $(foreach file, $(wildcard $(RTSDIR)/*.ad[sb]*), \ + $(call INSTALL_DATA_DATE, $(file), $(DESTDIR)$(ADA_INCLUDE_DIR)/$(notdir $(file)))$(NL)) cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.adb cd $(DESTDIR)$(ADA_INCLUDE_DIR); $(CHMOD) a-wx *.ads