On Feb 5, 2015, at 11:51, Jeff King wrote:
On Thu, Feb 05, 2015 at 08:26:08PM +0100, Sebastian Schuberth wrote:
It is not even correct, is it?
When DESTDIR is set to allow you to install into a temporary place
only so that you can "tar" up the resulting filesystem tree, bindir
points at the location we need to "cp" the built programs into, i.e.
inside DESTDIR.
Agreed folks, please disregard this as well as 2/2 of this series.
We would still want an equivalent to 2/2 to set up a relative symlink
for $(ALL_PROGRAMS), though, right?
It's this line here:
ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
But since bindir and execdir can be configured to be arbitrary paths
you must compute the relative path between them in order to create a
relative symlink. In principle you just remove the common directory
prefix, remove the non-directory part from the destination, change any
remaining directories in the destination to '..' and then append
what's left of the source to get the new source.
So if you have
bindir=/usr/local/bin
execdir=/usr/local/libexec/git-core
And the ln line would be:
ln /usr/local/bin/git /usr/local/libexec/git-core/git
1) Strip the common prefix which is /usr/local/
source = bin/git
dest = libexec/git-core/git
2) remove non-directory part of dest (the basename part) and replace
remaining dirs with '..'
source = bin/git
dest = ../../
3) append source to dest and you get
../../bin/git
So the symlink line becomes:
ln -s ../../bin/git /usr/local/libexec/git-core/git
Now, can you do that easily in a Makefile? ;)
And lastly there's the issue of which should be the symlink and which
should be the binary?
Should /usr/local/bin/git be the symlink or the binary?
If it's the binary, then /usr/local/libexec/git-core/git will be a
symlink to it. But we're already installing several other symlinks to
'git' in /usr/local/libexec/git-core so they will need to traverse two
symlinks to get to the binary rather than just the one.
That seems suboptimal.
On the other hand if /usr/local/bin/git becomes the symlink then we
have a user-facing binary that's a symlink. As generally it's the
bindir that ends up in the PATH.
I'm not sure exactly why, but I think:
On Jan 30, 2015, at 13:10, Junio C Hamano wrote:
That would make me feel dirty.
Having a user-facing binary that is actually a symlink can potentially
cause problems on OS X if the binary it refers to locates its
libraries using a relative path. Not sure if that's the case on other
systems or not.
Neither of these is probably a show-stopper (two-symlinks-to-binary or
user-facing-symlink-binary) assuming the magic relative symlink
computation can be worked out.
But it does not surprise me that those items were allowed to skip
making a symlink and just go directly to cp.
-Kyle
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html