On 11/01/2022 00:03, Tom Lane wrote:
Peter Eisentraut <peter.eisentr...@enterprisedb.com> writes:I don't think preserving timestamps should be the default behavior, but I would support organizing things so that additional options can be passed to "install" to make it do whatever the user prefers. But that won't work if some installations don't go through install.
+1. We just bumped into this with Neon, where we have a build script that generates Rust bindings from the PostgreSQL header files. The build script runs "make install", and because that changes the mtime even if there were no changes to the headers, the bindings are also regenerated every time.
So I fear we're optimizing for a case that stopped being mainstream a decade or more back. I could get behind switching the code back to using $(INSTALL) for this, and then offering some way to inject user-selected switches into the $(INSTALL) invocations. That wouldn't need much more than another gmake macro. (Does there need to be a way to inject such switches only into header installations, or is it OK to do it across the board?)
Here's a patch to switch back to $(INSTALL). With that, you can do: ./configure INSTALL="/usr/bin/install -C"
[ wanders away wondering how this'd affect the meson conversion project ]
If anything, I guess this will help, by making the Makefile a bit less special.
- Heikki
From c0305f950e45ed905cc8145879d0b48390c387fa Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas <heikki.linnakan...@iki.fi> Date: Fri, 9 Sep 2022 21:25:26 +0300 Subject: [PATCH 1/1] Use normal install program to install server headers. Commit a7032690f9 replaced $(INSTALL) with plain "cp" for installing the server header files. It sped up "make install" significantly, because the old logic called $(INSTALL) separately for every header file, whereas plain "cp" could copy all the files in one command. However, we have long since made it a requirement that $(INSTALL) can also install multiple files in one command, see commit f1c5247563. Switch back to $(INSTALL). Discussion: https://www.postgresql.org/message-id/200503252305.j2PN52m23610%40candle.pha.pa.us Discussion: https://www.postgresql.org/message-id/2415283.1641852217%40sss.pgh.pa.us --- src/include/Makefile | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/include/Makefile b/src/include/Makefile index 0b4cab9bb1..1e50400617 100644 --- a/src/include/Makefile +++ b/src/include/Makefile @@ -48,22 +48,15 @@ install: all installdirs $(INSTALL_DATA) utils/errcodes.h '$(DESTDIR)$(includedir_server)/utils' $(INSTALL_DATA) utils/fmgroids.h '$(DESTDIR)$(includedir_server)/utils' $(INSTALL_DATA) utils/fmgrprotos.h '$(DESTDIR)$(includedir_server)/utils' -# We don't use INSTALL_DATA for performance reasons --- there are a lot of files -# (in fact, we have to take some pains to avoid overlength shell commands here) - cp $(srcdir)/*.h '$(DESTDIR)$(includedir_server)'/ + $(INSTALL_DATA) $(srcdir)/*.h '$(DESTDIR)$(includedir_server)' for dir in $(SUBDIRS); do \ - cp $(srcdir)/$$dir/*.h '$(DESTDIR)$(includedir_server)'/$$dir/ || exit; \ + $(INSTALL_DATA) $(srcdir)/$$dir/*.h '$(DESTDIR)$(includedir_server)'/$$dir || exit; \ done ifeq ($(vpath_build),yes) for file in catalog/schemapg.h catalog/system_fk_info.h catalog/pg_*_d.h parser/gram.h storage/lwlocknames.h utils/probes.h; do \ - cp $$file '$(DESTDIR)$(includedir_server)'/$$file || exit; \ + $(INSTALL_DATA) $$file '$(DESTDIR)$(includedir_server)'/$$file || exit; \ done endif - cd '$(DESTDIR)$(includedir_server)' && chmod $(INSTALL_DATA_MODE) *.h - for dir in $(SUBDIRS); do \ - cd '$(DESTDIR)$(includedir_server)'/$$dir || exit; \ - chmod $(INSTALL_DATA_MODE) *.h || exit; \ - done installdirs: $(MKDIR_P) '$(DESTDIR)$(includedir)/libpq' '$(DESTDIR)$(includedir_internal)/libpq' -- 2.30.2