From c58a93b9b3e42eb3668d9217a35b66d47ac47d50 Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Fri, 24 Feb 2012 20:54:45 -0500 Subject: [PATCH] Fix "make dist" permissions when using a read-only srcdir. Apparently Automake copies permissions from the source directory, so if you run "make dist" in a VPATH build from a read-only srcdir, the resulting distdir will be read-only. Beyond the resulting tarball permissions, this can actually cause dist hooks to fail in some instances. Add another dist hook which makes distdir user-writable. --- Makefile.am | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 1132d5a..535eff8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -166,10 +166,19 @@ src/parse.c src/parse.h: src/parse.stamp # up-to-date timestamps, otherwise make will try to update them in a fresh # VPATH build. dist-hook: update-headers -update-headers: +update-headers: unfuck-distdir touch -c '$(distdir)/src/scan.h' touch -c '$(distdir)/src/parse.h' +# When running "make dist" in a VPATH build with a read-only srcdir, Automake +# will produce a distribution with all files read-only. Moreover, the files +# are read-only in distdir when the dist hooks are run. This hook will +# manually fix up the permissions. All dist hooks that modify files in distdir +# should list unfuck-distdir as a prerequisite. +dist-hook: unfuck-distdir +unfuck-distdir: + find '$(distdir)' -type f -exec chmod u+w {} + + # Supporting rules for bison/flex. BISON_V = $(BISON_V_$(V)) -- 2.43.0