{"thread":{"id":"9089","subject":"[PATCH] Makefile: create an install-symlinks target","startedAt":"2007-07-18T10:41:27Z","lastAt":"2007-07-18T14:45:36Z","messageCount":8,"participants":["David Kastrup","Johannes Schindelin","Alex Riesen","Peter Baumann"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"47729","messageId":"86bqe9lwy8.fsf@lola.quinscape.zz","threadId":"9089","inReplyTo":null,"subject":"[PATCH] Makefile: create an install-symlinks target","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-18T10:41:27Z","receivedAt":"2007-07-18T10:41:27Z","isPatch":true,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"\nUse this, for example, to do\nrm -rf /opt/git\nmake prefix=/opt/git install\nmake symlinkprefix=/usr/local prefix=/opt/git install-symlinks\n---\n Makefile |    9 ++++++++-\n 1 files changed, 8 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 73b487f..df2fe8d 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -142,6 +142,7 @@ ALL_LDFLAGS = $(LDFLAGS)\n STRIP ?= strip\n \n prefix = $(HOME)\n+symlinkprefix = /usr/local\n bindir = $(prefix)/bin\n gitexecdir = $(bindir)\n sharedir = $(prefix)/share\n@@ -996,7 +997,13 @@ install-doc:\n quick-install-doc:\n \t$(MAKE) -C Documentation quick-install\n \n-\n+# The somewhat strange looking lines start with an ignored $(MAKE) in\n+# order to be executed also in make -n calls.\n+install-symlinks:\n+\t@: $(MAKE) && cd '$(prefix_SQ)' && find . -mindepth 1 -type d ! \\( -iname 'git*' -prune -exec echo rm -rf '$(symlinkprefix)/{}' \\; \\) -exec echo $(INSTALL) -m 755 -d '$(symlinkprefix)/{}' \\;\n+\t@cd '$(prefix_SQ)' && find . -mindepth 1 -type d ! \\( -iname 'git*' -prune -exec rm -rf '$(symlinkprefix)/{}' \\; \\) -exec $(INSTALL) -m 755 -d '$(symlinkprefix)/{}' \\;\n+\t@: $(MAKE) && cd '$(prefix_SQ)' && find . -mindepth 1 \\( -type d -iname 'git*' -prune -o ! -type d \\) -exec echo ln -snf '$(prefix_SQ)/{}' '$(symlinkprefix)/{}' \\;\n+\t@cd '$(prefix_SQ)' && find . -mindepth 1 \\( -type d -iname 'git*' -prune -o ! -type d \\) -exec ln -snf '$(prefix_SQ)/{}' '$(symlinkprefix)/{}' \\;\n \n ### Maintainer's dist rules\n \n-- \n1.5.3.rc2.41.gb47b1\n"},{"id":"47738","messageId":"6e14af24a3aa8af7e21e0a3f92c83c82e147202a.1184770193.git.dak@gnu.org","threadId":"9089","inReplyTo":"861wf5iz6o.fsf@lola.quinscape.zz","subject":"[PATCH 1/2] Makefile: create an install-symlinks target","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-18T10:41:27Z","receivedAt":"2007-07-18T10:41:27Z","isPatch":true,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"\nThis target allows you to have git installed in one location,\nand have symbolic links to all of the programs installed in\nanother\tlocation.  For example, if git was installed to /opt/git\nwith\n\n\tmake prefix=/opt/git install\n\nyou can install symbolic links in /usr/local/bin with\n\n\tmake symlinkprefix=/usr/local prefix=/opt/git \\\n\t\tinstall-symlinks\n\nThis makes it reasonably easy to remove such a package, by doing\n\n\trm -rf /opt/git\n\nand then removing stale links with\n\n\tfind /usr/local -xtype l -print0|xargs -0 rm\n\n(be sure to first see whether you indeed get only stale links listed).\n\nThis works by copying the directory hierarchy of $prefix to\n$symlinkprefix (not copying or descending to any directories of the\nname git* matched case-insensitively), then linking all the rest.\n\nSigned-off-by: David Kastrup <dak@gnu.org>\n---\n Makefile |    9 ++++++++-\n 1 files changed, 8 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 73b487f..7e53378 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -142,6 +142,7 @@ ALL_LDFLAGS = $(LDFLAGS)\n STRIP ?= strip\n \n prefix = $(HOME)\n+symlinkprefix = /usr/local\n bindir = $(prefix)/bin\n gitexecdir = $(bindir)\n sharedir = $(prefix)/share\n@@ -996,7 +997,13 @@ install-doc:\n quick-install-doc:\n \t$(MAKE) -C Documentation quick-install\n \n-\n+# The somewhat strange looking lines start with an ignored $(MAKE) in\n+# order to be executed also in make -n calls.\n+install-symlinks:\n+\t@: $(MAKE) && cd '$(prefix_SQ)' && find . -type d ! \\( -iname 'git*' -prune \\) -exec echo $(INSTALL) -m 755 -d '$(symlinkprefix)/{}' \\;\n+\t@cd '$(prefix_SQ)' && find . -type d ! \\( -iname 'git*' -prune \\) -exec $(INSTALL) -m 755 -d '$(symlinkprefix)/{}' \\;\n+\t@: $(MAKE) && cd '$(prefix_SQ)' && find . \\( -type d -iname 'git*' -prune -o ! -type d \\) -exec echo $(RM) -r '$(symlinkprefix)/{}' \\; -exec echo ln -s '$(prefix_SQ)/{}' '$(symlinkprefix)/{}' \\;\n+\t@cd '$(prefix_SQ)' && find . \\( -type d -iname 'git*' -prune -o ! -type d \\) -exec $(RM) -r '$(symlinkprefix)/{}' \\; -exec ln -s '$(prefix_SQ)/{}' '$(symlinkprefix)/{}' \\;\n \n ### Maintainer's dist rules\n \n-- \n1.5.3.rc2.41.gb47b1\n"},{"id":"47731","messageId":"86y7hdkhnu.fsf@lola.quinscape.zz","threadId":"9089","inReplyTo":"86bqe9lwy8.fsf@lola.quinscape.zz","subject":"Re: [PATCH] Makefile: create an install-symlinks target","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-18T12:41:57Z","receivedAt":"2007-07-18T12:41:57Z","isPatch":true,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"David Kastrup <dak@gnu.org> writes:\n\n> Use this, for example, to do\n> rm -rf /opt/git\n> make prefix=/opt/git install\n> make symlinkprefix=/usr/local prefix=/opt/git install-symlinks\n> ---\n>  Makefile |    9 ++++++++-\n>  1 files changed, 8 insertions(+), 1 deletions(-)\n\nOh, by the way: I got _crazy_ when I first committed this, then found\na mistake and corrected it, and then repeatedly did\ngit add config/emacs/Makefile\ngit-commit --amend\n\nand got the\n\n>  Makefile |    9 ++++++++-\n>  1 files changed, 8 insertions(+), 1 deletions(-)\n\nmessage again and again, while nothing at all changed.  Of course,\nthis was because I added the wrong Makefile.\n\nI am not sure how git could be more helpful here.  Just wanted to\nreport it.  Maybe it could have noticed that my \"amendment\" was empty?\nOn the other hand, I might have wanted to amend the commit message.\nSigh.\n\n-- \nDavid Kastrup\n"},{"id":"47730","messageId":"Pine.LNX.4.64.0707181344520.14781@racer.site","threadId":"9089","inReplyTo":"86bqe9lwy8.fsf@lola.quinscape.zz","subject":"Re: [PATCH] Makefile: create an install-symlinks target","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-18T12:48:21Z","receivedAt":"2007-07-18T12:48:21Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 18 Jul 2007, David Kastrup wrote:\n\n> Use this, for example, to do\n> rm -rf /opt/git\n> make prefix=/opt/git install\n> make symlinkprefix=/usr/local prefix=/opt/git install-symlinks\n\nYou mean\n\n\tThis target allows you to have git installed in one location,\n\tand have symbolic links to all of the programs installed in \n\tanother\tlocation.  For example, if git was installed to /opt/git\n\twith\n\n\t\tmake prefix=/opt/git install\n\n\tyou can install symbolic links in /usr/local/bin with\n\n\t\tmake symlinkprefix=/usr/local prefix=/opt/git \\\n\t\t\tinstall-symlinks\n\nHmm.  Why not install it with a proper package manager in the correct \nplace to begin with?  Somehow I find so many symbolic links ugly.\n\nCiao,\nDscho\n"},{"id":"47732","messageId":"81b0412b0707180608j7c22631ak87f3ddd6481bccf2@mail.gmail.com","threadId":"9089","inReplyTo":"86bqe9lwy8.fsf@lola.quinscape.zz","subject":"Re: [PATCH] Makefile: create an install-symlinks target","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-07-18T13:08:14Z","receivedAt":"2007-07-18T13:08:14Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 7/18/07, David Kastrup <dak@gnu.org> wrote:\n> +       @: $(MAKE) && cd '$(prefix_SQ)' && find . -mindepth 1 ...\n\nSometime about now you'll need to define $(FIND) or even $(GNUFIND)\nfor find. There are proprietary systems where find is not available or\ndoes not do what you want it to. There is often a gfind installed somewhere\non these systems.\n"},{"id":"47736","messageId":"861wf5iz6o.fsf@lola.quinscape.zz","threadId":"9089","inReplyTo":"81b0412b0707180608j7c22631ak87f3ddd6481bccf2@mail.gmail.com","subject":"Re: [PATCH] Makefile: create an install-symlinks target","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-18T14:06:23Z","receivedAt":"2007-07-18T14:06:23Z","isPatch":true,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"\"Alex Riesen\" <raa.lkml@gmail.com> writes:\n\n> On 7/18/07, David Kastrup <dak@gnu.org> wrote:\n>> +       @: $(MAKE) && cd '$(prefix_SQ)' && find . -mindepth 1 ...\n>\n> Sometime about now you'll need to define $(FIND) or even $(GNUFIND)\n> for find. There are proprietary systems where find is not available or\n> does not do what you want it to. There is often a gfind installed somewhere\n> on these systems.\n\nI think that the install-symlinks target is rather more specialized\nthan the tags and TAGS targets, yet those use just \"find\".  I think\nI'll be able to throw out the -mindepth, however.  It was necessary in\na version that used find $(prefix), since /opt/git matched\n-type d -name git*\nbut with find . this should not be relevant.\n\nI'll amend that patch and prepare a separate one that uses $(FIND)\neverywhere.\n\n-- \nDavid Kastrup\n"},{"id":"47737","messageId":"20070718143329.GD4815@xp.machine.xx","threadId":"9089","inReplyTo":"Pine.LNX.4.64.0707181344520.14781@racer.site","subject":"Re: [PATCH] Makefile: create an install-symlinks target","fromName":"Peter Baumann","fromEmail":"waste.manager@gmx.de","sentAt":"2007-07-18T14:33:29Z","receivedAt":"2007-07-18T14:33:29Z","isPatch":true,"sender":{"key":"waste.manager@gmx.de","avatar":null},"body":"On Wed, Jul 18, 2007 at 01:48:21PM +0100, Johannes Schindelin wrote:\n> Hi,\n> \n> On Wed, 18 Jul 2007, David Kastrup wrote:\n> \n> > Use this, for example, to do\n> > rm -rf /opt/git\n> > make prefix=/opt/git install\n> > make symlinkprefix=/usr/local prefix=/opt/git install-symlinks\n> \n> You mean\n> \n> \tThis target allows you to have git installed in one location,\n> \tand have symbolic links to all of the programs installed in \n> \tanother\tlocation.  For example, if git was installed to /opt/git\n> \twith\n> \n> \t\tmake prefix=/opt/git install\n> \n> \tyou can install symbolic links in /usr/local/bin with\n> \n> \t\tmake symlinkprefix=/usr/local prefix=/opt/git \\\n> \t\t\tinstall-symlinks\n> \n> Hmm.  Why not install it with a proper package manager in the correct \n> place to begin with?  Somehow I find so many symbolic links ugly.\n> \n\nSeeing this excellent explantion from Dscho, this sound exactly like a\nperfect use case for xstow [1].\n\nIt allows you to install your application into e.g. /usr/local/stow/git\nand by running 'xstow git' in /usr/local/stow it would create all the\nnecessary links in /usr/local/{bin,share,doc} or any other place you\nwant.\n\n-Peter\n\n[1]: http://xstow.sourceforge.net/\n"},{"id":"47739","messageId":"e59329b96603b8ed323b57179608bb7df9b57322.1184770193.git.dak@gnu.org","threadId":"9089","inReplyTo":"6e14af24a3aa8af7e21e0a3f92c83c82e147202a.1184770193.git.dak@gnu.org","subject":"[PATCH 2/2] Makefile: use $(FIND) instead of find","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-07-18T14:45:36Z","receivedAt":"2007-07-18T14:45:36Z","isPatch":true,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"\nSome people might prefer to be able to specify the find utility to\nuse, in particular for the more complicated usage in the\ninstall-symlinks target.\n\nSigned-off-by: David Kastrup <dak@gnu.org>\n---\n Makefile |   13 +++++++------\n 1 files changed, 7 insertions(+), 6 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 7e53378..cf72327 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -178,6 +178,7 @@ AR = ar\n RM = rm -f\n TAR = tar\n INSTALL = install\n+FIND = find\n RPMBUILD = rpmbuild\n TCL_PATH = tclsh\n TCLTK_PATH = wish\n@@ -904,11 +905,11 @@ doc:\n \n TAGS:\n \t$(RM) TAGS\n-\tfind . -name '*.[hcS]' -print | xargs etags -a\n+\t$(FIND) . -name '*.[hcS]' -print | xargs etags -a\n \n tags:\n \t$(RM) tags\n-\tfind . -name '*.[hcS]' -print | xargs ctags -a\n+\t$(FIND) . -name '*.[hcS]' -print | xargs ctags -a\n \n ### Detect prefix changes\n TRACK_CFLAGS = $(subst ','\\'',$(ALL_CFLAGS)):\\\n@@ -1000,10 +1001,10 @@ quick-install-doc:\n # The somewhat strange looking lines start with an ignored $(MAKE) in\n # order to be executed also in make -n calls.\n install-symlinks:\n-\t@: $(MAKE) && cd '$(prefix_SQ)' && find . -type d ! \\( -iname 'git*' -prune \\) -exec echo $(INSTALL) -m 755 -d '$(symlinkprefix)/{}' \\;\n-\t@cd '$(prefix_SQ)' && find . -type d ! \\( -iname 'git*' -prune \\) -exec $(INSTALL) -m 755 -d '$(symlinkprefix)/{}' \\;\n-\t@: $(MAKE) && cd '$(prefix_SQ)' && find . \\( -type d -iname 'git*' -prune -o ! -type d \\) -exec echo $(RM) -r '$(symlinkprefix)/{}' \\; -exec echo ln -s '$(prefix_SQ)/{}' '$(symlinkprefix)/{}' \\;\n-\t@cd '$(prefix_SQ)' && find . \\( -type d -iname 'git*' -prune -o ! -type d \\) -exec $(RM) -r '$(symlinkprefix)/{}' \\; -exec ln -s '$(prefix_SQ)/{}' '$(symlinkprefix)/{}' \\;\n+\t@: $(MAKE) && cd '$(prefix_SQ)' && $(FIND) . -type d ! \\( -iname 'git*' -prune \\) -exec echo $(INSTALL) -m 755 -d '$(symlinkprefix)/{}' \\;\n+\t@cd '$(prefix_SQ)' && $(FIND) . -type d ! \\( -iname 'git*' -prune \\) -exec $(INSTALL) -m 755 -d '$(symlinkprefix)/{}' \\;\n+\t@: $(MAKE) && cd '$(prefix_SQ)' && $(FIND) . \\( -type d -iname 'git*' -prune -o ! -type d \\) -exec echo $(RM) -r '$(symlinkprefix)/{}' \\; -exec echo ln -s '$(prefix_SQ)/{}' '$(symlinkprefix)/{}' \\;\n+\t@cd '$(prefix_SQ)' && $(FIND) . \\( -type d -iname 'git*' -prune -o ! -type d \\) -exec $(RM) -r '$(symlinkprefix)/{}' \\; -exec ln -s '$(prefix_SQ)/{}' '$(symlinkprefix)/{}' \\;\n \n ### Maintainer's dist rules\n \n-- \n1.5.3.rc2.41.gb47b1\n"}]}