Thread: make dist does not work in VPATH

make dist does not work in VPATH

From
Alvaro Herrera
Date:
Hi,

It seems we're neglecting to copy GNUmakefile into the temporary
distdir:

$ pwd
/pgsql/build/83_rel
$ make dist
rm -rf postgresql-8.3.3* =install=
for x in `cd /pgsql/source/83_rel && find . -name CVS -prune -o -print`; do \         file=`expr X$x : 'X\./\(.*\)'`; \
       if test -d "/pgsql/source/83_rel/$file" ; then \           mkdir "postgresql-8.3.3/$file" && chmod 777
"postgresql-8.3.3/$file";      \         else \           ln "/pgsql/source/83_rel/$file" "postgresql-8.3.3/$file"
>/dev/null2>&1 \             || cp "/pgsql/source/83_rel/$file" "postgresql-8.3.3/$file"; \         fi || exit; \
done
make -C postgresql-8.3.3 distprep
make[1]: entrant dans le répertoire « /home/alvherre/Code/CVS/pgsql/build/83_rel/postgresql-8.3.3 »
make[1]: *** Pas de règle pour fabriquer la cible « distprep ». Arrêt.
make[1]: quittant le répertoire « /home/alvherre/Code/CVS/pgsql/build/83_rel/postgresql-8.3.3 »
make: *** [distdir] Erreur 2



-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: make dist does not work in VPATH

From
Tom Lane
Date:
Is it sensible for make dist to work in a VPATH?  Seems like the entire
point of that operation is to modify the source tree.
        regards, tom lane


Re: make dist does not work in VPATH

From
Alvaro Herrera
Date:
Tom Lane wrote:
> Is it sensible for make dist to work in a VPATH?  Seems like the entire
> point of that operation is to modify the source tree.

Actually the point AFAICS is to generate a tarball.  Why wouldn't it
work in a VPATH build?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


Re: make dist does not work in VPATH

From
Peter Eisentraut
Date:
Alvaro Herrera wrote:
> It seems we're neglecting to copy GNUmakefile into the temporary
> distdir:

> make -C postgresql-8.3.3 distprep
> make[1]: entrant dans le répertoire «
> /home/alvherre/Code/CVS/pgsql/build/83_rel/postgresql-8.3.3 » make[1]: ***
> Pas de règle pour fabriquer la cible « distprep ». Arrêt. make[1]: quittant
> le répertoire « /home/alvherre/Code/CVS/pgsql/build/83_rel/postgresql-8.3.3
> » make: *** [distdir] Erreur 2

Hmm.  When you do an in-tree build, the distdir copy contains a configured 
source tree.  When you do an out-of-tree build, the distdir copy only the 
bare source tree, because the configure output files are in the build tree, 
which is not copied.

Fix option 1 would be to copy the build tree as well, if it is different from 
the source tree.  Since the build tree contains a bunch of symlinks back to 
the source tree, this would probably need some careful file handling to not 
overwrite the real files with symlinks or something like that.

Fix option 2 is to rerun configure before make distprep.


Re: make dist does not work in VPATH

From
Alvaro Herrera
Date:
Peter Eisentraut wrote:

> Fix option 1 would be to copy the build tree as well, if it is different from
> the source tree.  Since the build tree contains a bunch of symlinks back to
> the source tree, this would probably need some careful file handling to not
> overwrite the real files with symlinks or something like that.

Thanks, this seems to do the trick.  The only thing I'm missing here is
how to implement the "is the build dir different from the source dir".
Any ideas?

It is a shame that one needs to copy all the .o, .Po, etc files and then
remove them with "make distclean".  It would be possible to skip linking
them by having an exception in the "find" line, but I'm not sure if that
works portably enough (i.e. is the extension common across all archs?)

Note that I skip directories not already existing in distdir.  This is
so that the .deps directories are not included in the tarball, which
would be dumb.  Also, as you note, we need to handle certain symlinks;
in my installation this is only needed for Makefile.port.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

Attachment