user744629
user744629

Reputation: 2041

Build Git with symbolic link

On GNU/Linux, is there a way to build Git from source using symbolic links instead of hard links?

For example:

./configure
make
make install

yields to:

$PREFIX/bin/git
$PREFIX/libexec/git-core/git-log
$PREFIX/libexec/git-core/git-status
$PREFIX/libexec/git-core/git-commit
...

which are all hard links.

I would like git-log, git-status, git-commit to be symbolic links to git, etc.

Upvotes: 1

Views: 478

Answers (3)

tendonsie
tendonsie

Reputation: 43

I can confirm the method of MadScientist still works with the newest git version.

  wget https://www.kernel.org/pub/software/scm/git/git-2.12.3.tar.gz
  ./configure --prefix=/usr      
  make NO_INSTALL_HARDLINKS=YesPlease -j5
  make NO_INSTALL_HARDLINKS=YesPlease install


  ls -althr /usr/libexec/git-core
  -rwxr-xr-x 1 root root  11M May 11 13:48 git
  lrwxrwxrwx 1 root root    3 May 11 13:48 git-am -> git

Upvotes: 0

MadScientist
MadScientist

Reputation: 100856

You can do this, unless I'm misunderstanding. All you have to do is add NO_INSTALL_HARDLINKS=YesPlease to the make line:

./configure
make NO_INSTALL_HARDLINKS=YesPlease
make NO_INSTALL_HARDLINKS=YesPlease install

If you read the comments at the top of the makefile in the Git source root directory you'll find:

# Define NO_INSTALL_HARDLINKS if you prefer to use either symbolic links or
# copies to install built-in git commands e.g. git-cat-file.

Remember that Git is only partly using autoconf. Much of its configuration can only be selected by adding make options on the command line: read the docs at the top of the Makefile for other things you can do.

Anyway it worked for me.

Upvotes: 3

Ikke
Ikke

Reputation: 101231

There is no built-in way to do this. The Makefile always tries to create hardlinks first, and only if it fails, fall back to symlinks.

What you could try is to alias or shadow ln to by default create symlinks.

Upvotes: 1

Related Questions