Re: [PATCH] Makefile: create an install-symlinks target

Previous thread: Re: Empty directories... by David Kastrup on Wednesday, July 18, 2007 - 8:12 am. (1 message)

Next thread: Re: [PATCH] Makefile: create an install-symlinks target by David Kastrup on Wednesday, July 18, 2007 - 8:41 am. (1 message)
To: <git@...>
Date: Wednesday, July 18, 2007 - 6:41 am

Use this, for example, to do
rm -rf /opt/git
make prefix=/opt/git install
make symlinkprefix=/usr/local prefix=/opt/git install-symlinks
---
Makefile | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 73b487f..df2fe8d 100644
--- a/Makefile
+++ b/Makefile
@@ -142,6 +142,7 @@ ALL_LDFLAGS = $(LDFLAGS)
STRIP ?= strip

prefix = $(HOME)
+symlinkprefix = /usr/local
bindir = $(prefix)/bin
gitexecdir = $(bindir)
sharedir = $(prefix)/share
@@ -996,7 +997,13 @@ install-doc:
quick-install-doc:
$(MAKE) -C Documentation quick-install

-
+# The somewhat strange looking lines start with an ignored $(MAKE) in
+# order to be executed also in make -n calls.
+install-symlinks:
+ @: $(MAKE) && cd '$(prefix_SQ)' && find . -mindepth 1 -type d ! \( -iname 'git*' -prune -exec echo rm -rf '$(symlinkprefix)/{}' \; \) -exec echo $(INSTALL) -m 755 -d '$(symlinkprefix)/{}' \;
+ @cd '$(prefix_SQ)' && find . -mindepth 1 -type d ! \( -iname 'git*' -prune -exec rm -rf '$(symlinkprefix)/{}' \; \) -exec $(INSTALL) -m 755 -d '$(symlinkprefix)/{}' \;
+ @: $(MAKE) && cd '$(prefix_SQ)' && find . -mindepth 1 \( -type d -iname 'git*' -prune -o ! -type d \) -exec echo ln -snf '$(prefix_SQ)/{}' '$(symlinkprefix)/{}' \;
+ @cd '$(prefix_SQ)' && find . -mindepth 1 \( -type d -iname 'git*' -prune -o ! -type d \) -exec ln -snf '$(prefix_SQ)/{}' '$(symlinkprefix)/{}' \;

### Maintainer's dist rules

--
1.5.3.rc2.41.gb47b1

-

To: David Kastrup <dak@...>
Cc: <git@...>
Date: Wednesday, July 18, 2007 - 9:08 am

Sometime about now you'll need to define $(FIND) or even $(GNUFIND)
for find. There are proprietary systems where find is not available or
does not do what you want it to. There is often a gfind installed somewhere
on these systems.
-

To: David Kastrup <dak@...>
Cc: <git@...>
Date: Wednesday, July 18, 2007 - 8:48 am

Hi,

You mean

This target allows you to have git installed in one location,
and have symbolic links to all of the programs installed in
another location. For example, if git was installed to /opt/git
with

make prefix=/opt/git install

you can install symbolic links in /usr/local/bin with

make symlinkprefix=/usr/local prefix=/opt/git \
install-symlinks

Hmm. Why not install it with a proper package manager in the correct
place to begin with? Somehow I find so many symbolic links ugly.

Ciao,
Dscho

-

To: Johannes Schindelin <Johannes.Schindelin@...>
Cc: David Kastrup <dak@...>, <git@...>
Date: Wednesday, July 18, 2007 - 10:33 am

Seeing this excellent explantion from Dscho, this sound exactly like a
perfect use case for xstow [1].

It allows you to install your application into e.g. /usr/local/stow/git
and by running 'xstow git' in /usr/local/stow it would create all the
necessary links in /usr/local/{bin,share,doc} or any other place you
want.

-Peter

[1]: http://xstow.sourceforge.net/
-

Previous thread: Re: Empty directories... by David Kastrup on Wednesday, July 18, 2007 - 8:12 am. (1 message)

Next thread: Re: [PATCH] Makefile: create an install-symlinks target by David Kastrup on Wednesday, July 18, 2007 - 8:41 am. (1 message)