{"thread":{"id":"23640","subject":"[PATCH/RFC] gitweb: Create install target for gitweb in Makefile","startedAt":"2010-04-29T23:58:22Z","lastAt":"2010-05-11T23:49:56Z","messageCount":5,"participants":["Jakub Narebski","Junio C Hamano","Petr Baudis","J.H."],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"140643","messageId":"20100429235046.29606.35311.stgit@localhost.localdomain","threadId":"23640","inReplyTo":null,"subject":"[PATCH/RFC] gitweb: Create install target for gitweb in Makefile","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-04-29T23:58:22Z","receivedAt":"2010-04-29T23:58:22Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Installing gitweb is now as easy as\n  # make gitwebdir=/var/www/cgi-bin gitweb-install  ;# as root\nThe gitweb/INSTALL file was updated accordingly.\n\nFix shell quoting, i.e. setting bindir_SQ etc., in gitweb/Makefile.\nThose variables were not used previously.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nThere is a question whether to rely on correctly set file permissions\nduring build phase, i.e.\n\n\t$(INSTALL) $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n\nor whether to ensure correct file permissions during installl phase\n\n\t$(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n\t$(INSTALL) -m 644 $(GITWEB_FILES)    '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n\nCurrently the first option is used.\n\nNote that install-* targets, including new install-gitweb, are not\nmarked as .PHONY\n\n Makefile        |    3 +++\n gitweb/INSTALL  |   11 ++++-------\n gitweb/Makefile |   31 +++++++++++++++++++++++++++----\n 3 files changed, 34 insertions(+), 11 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 910f471..dab5a14 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2004,6 +2004,9 @@ endif\n \t  done; } && \\\n \t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-add$X\"\n \n+install-gitweb:\n+\t$(MAKE) -C gitweb install\n+\n install-doc:\n \t$(MAKE) -C Documentation install\n \ndiff --git a/gitweb/INSTALL b/gitweb/INSTALL\nindex 1bfd9aa..4447e26 100644\n--- a/gitweb/INSTALL\n+++ b/gitweb/INSTALL\n@@ -6,10 +6,8 @@ First you have to generate gitweb.cgi from gitweb.perl using\n gitweb.css, git-logo.png and git-favicon.png) to their destination.\n For example if git was (or is) installed with /usr prefix, you can do\n \n-\t$ make prefix=/usr gitweb             ;# as yourself\n-\t# cp gitweb/*.cgi gitweb/*.css \\\n-\t     gitweb/*.js  gitweb/*.png \\\n-\t     /var/www/cgi-bin/                ;# as root\n+\t$ make prefix=/usr gitweb                            ;# as yourself\n+\t# make gitwebdir=/var/www/cgi-bin install-gitweb     ;# as root\n \n Alternatively you can use autoconf generated ./configure script to\n set up path to git binaries (via config.mak.autogen), so you can write\n@@ -18,9 +16,8 @@ instead\n \t$ make configure                     ;# as yourself\n \t$ ./configure --prefix=/usr          ;# as yourself\n \t$ make gitweb                        ;# as yourself\n-\t# cp gitweb/*.cgi gitweb/*.css \\\n-\t     gitweb/*.js  gitweb/*.png \\\n-\t     /var/www/cgi-bin/               ;# as root\n+\t# make gitwebdir=/var/www/cgi-bin \\\n+\t       install-gitweb                ;# as root\n \n The above example assumes that your web server is configured to run\n [executable] files in /var/www/cgi-bin/ as server scripts (as CGI\ndiff --git a/gitweb/Makefile b/gitweb/Makefile\nindex f2e1d92..729cf50 100644\n--- a/gitweb/Makefile\n+++ b/gitweb/Makefile\n@@ -12,7 +12,10 @@ all::\n \n prefix ?= $(HOME)\n bindir ?= $(prefix)/bin\n+gitwebdir ?= /var/www/cgi-bin\n+\n RM ?= rm -f\n+INSTALL ?= install\n \n # default configuration for gitweb\n GITWEB_CONFIG = gitweb_config.perl\n@@ -49,9 +52,11 @@ SHELL_PATH ?= $(SHELL)\n PERL_PATH  ?= /usr/bin/perl\n \n # Shell quote;\n-bindir_SQ = $(subst ','\\'',$(bindir))         #'\n-SHELL_PATH_SQ = $(subst ','\\'',$(SHELL_PATH)) #'\n-PERL_PATH_SQ  = $(subst ','\\'',$(PERL_PATH))  #'\n+bindir_SQ = $(subst ','\\'',$(bindir))#'\n+gitwebdir_SQ = $(subst ','\\'',$(gitwebdir))#'\n+SHELL_PATH_SQ = $(subst ','\\'',$(SHELL_PATH))#'\n+PERL_PATH_SQ  = $(subst ','\\'',$(PERL_PATH))#'\n+DESTDIR_SQ    = $(subst ','\\'',$(DESTDIR))#'\n \n # Quiet generation (unless V=1)\n QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir\n@@ -80,20 +85,30 @@ endif\n \n all:: gitweb.cgi\n \n+GITWEB_FILES = gitweb.cgi\n+\n ifdef JSMIN\n+GITWEB_FILES += gitweb.min.js\n GITWEB_JS = gitweb.min.js\n all:: gitweb.min.js\n gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS\n \t$(QUIET_GEN)$(JSMIN) <$< >$@\n+else\n+GITWEB_FILES += gitweb.js\n endif\n \n ifdef CSSMIN\n+GITWEB_FILES += gitweb.min.css\n GITWEB_CSS = gitweb.min.css\n all:: gitweb.min.css\n gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS\n \t$(QUIET_GEN)$(CSSMIN) <$ >$@\n+else\n+GITWEB_FILES += gitweb.css\n endif\n \n+GITWEB_FILES += git-logo.png git-favicon.png\n+\n GITWEB_REPLACE = \\\n \t-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \\\n \t-e 's|++GIT_BINDIR++|$(bindir)|g' \\\n@@ -127,8 +142,16 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS\n \tchmod +x $@+ && \\\n \tmv $@+ $@\n \n+### Installation rules\n+\n+install: all\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n+\t$(INSTALL) $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n+\n+### Cleaning rules\n+\n clean:\n \t$(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS\n \n-.PHONY: all clean .FORCE-GIT-VERSION-FILE FORCE\n+.PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE\n \n"},{"id":"140707","messageId":"7vbpcz4d95.fsf@alter.siamese.dyndns.org","threadId":"23640","inReplyTo":"20100429235046.29606.35311.stgit@localhost.localdomain","subject":"Re: [PATCH/RFC] gitweb: Create install target for gitweb in Makefile","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-05-01T19:45:42Z","receivedAt":"2010-05-01T19:45:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jakub Narebski <jnareb@gmail.com> writes:\n\n> Installing gitweb is now as easy as\n>   # make gitwebdir=/var/www/cgi-bin gitweb-install  ;# as root\n> The gitweb/INSTALL file was updated accordingly.\n\nJust a style, but I prefer a blank line on both sides of an example\ncommand line like this.\n\n> There is a question whether to rely on correctly set file permissions\n> during build phase, i.e.\n>\n> \t$(INSTALL) $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n>\n> or whether to ensure correct file permissions during installl phase\n>\n> \t$(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n> \t$(INSTALL) -m 644 $(GITWEB_FILES)    '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n>\n> Currently the first option is used.\n\nHmm, the reason being?  I do not have a strong preference either way, but\nthe primary Makefile seems to use \"-m mode\".\n\n> Note that install-* targets, including new install-gitweb, are not\n> marked as .PHONY\n\nThe reason being?\n\nMy preference for the standard targets like \"all\", \"clean\", and \"install\"\nis to make them double-colon rules and mark them as phoneys.\n"},{"id":"140713","messageId":"201005012236.16703.jnareb@gmail.com","threadId":"23640","inReplyTo":"7vbpcz4d95.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH/RFC] gitweb: Create install target for gitweb in Makefile","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-01T20:36:15Z","receivedAt":"2010-05-01T20:36:15Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sat, 1 May 2010, Junio C Hamano wrote:\n> Jakub Narebski <jnareb@gmail.com> writes:\n> \n> > Installing gitweb is now as easy as\n> >   # make gitwebdir=/var/www/cgi-bin gitweb-install  ;# as root\n> > The gitweb/INSTALL file was updated accordingly.\n> \n> Just a style, but I prefer a blank line on both sides of an example\n> command line like this.\n\nO.K.\n\n> > There is a question whether to rely on correctly set file permissions\n> > during build phase, i.e.\n> >\n> > \t$(INSTALL) $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n> >\n> > or whether to ensure correct file permissions during installl phase\n> >\n> > \t$(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n> > \t$(INSTALL) -m 644 $(GITWEB_FILES)    '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n> >\n> > Currently the first option is used.\n> \n> Hmm, the reason being?  I do not have a strong preference either way, but\n> the primary Makefile seems to use \"-m mode\".\n\nNo reason, just that this was simpler way (gitweb.cgi is created\nexecutable by its rule).\n\nChanged patch below.\n \n> > Note that install-* targets, including new install-gitweb, are not\n> > marked as .PHONY\n> \n> The reason being?\n> \n> My preference for the standard targets like \"all\", \"clean\", and \"install\"\n> is to make them double-colon rules and mark them as phoneys.\n\nThe reason being that only 'all::' is double-colon rule, and in main\nMakefile while 'all' and 'install' targets are marked .PHONY, other\ninstall targets: install-doc, install-info, install-man etc. are not.\n\nI was following example of 'install-doc' target with new 'install-gitweb'\ntarget in main Makefile.  This can be fixed, but I think it is a matter\nfor a separate commit.\n\n-- >8 --\nSubject: [PATCHv2] gitweb: Create install target for gitweb in Makefile\n\nInstalling gitweb is now as easy as\n\n  # make gitwebdir=/var/www/cgi-bin gitweb-install  ;# as root\n\nThe gitweb/INSTALL file was updated accordingly, to make use of this\nnew target.\n\nFix shell quoting, i.e. setting bindir_SQ etc., in gitweb/Makefile.\nThose variables were not used previously.\n\nSigned-off-by: Jakub Narebski <jnareb@gmail.com>\n---\nHere is the interdiff:\n\n diff --git a/gitweb/Makefile b/gitweb/Makefile\n index 729cf50..935d2d2 100644\n --- a/gitweb/Makefile\n +++ b/gitweb/Makefile\n @@ -85,7 +85,7 @@ endif\n  \n  all:: gitweb.cgi\n  \n -GITWEB_FILES = gitweb.cgi\n +GITWEB_PROGRAMS = gitweb.cgi\n  \n  ifdef JSMIN\n  GITWEB_FILES += gitweb.min.js\n @@ -146,7 +146,8 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS\n  \n  install: all\n  \t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n -\t$(INSTALL) $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n +\t$(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n +\t$(INSTALL) -m 644 $(GITWEB_FILES)    '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n  \n  ### Cleaning rules\n  \n\n \n\n Makefile        |    3 +++\n gitweb/INSTALL  |   11 ++++-------\n gitweb/Makefile |   32 ++++++++++++++++++++++++++++----\n 3 files changed, 35 insertions(+), 11 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 910f471..dab5a14 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2004,6 +2004,9 @@ endif\n \t  done; } && \\\n \t./check_bindir \"z$$bindir\" \"z$$execdir\" \"$$bindir/git-add$X\"\n \n+install-gitweb:\n+\t$(MAKE) -C gitweb install\n+\n install-doc:\n \t$(MAKE) -C Documentation install\n \ndiff --git a/gitweb/INSTALL b/gitweb/INSTALL\nindex 1bfd9aa..4447e26 100644\n--- a/gitweb/INSTALL\n+++ b/gitweb/INSTALL\n@@ -6,10 +6,8 @@ First you have to generate gitweb.cgi from gitweb.perl using\n gitweb.css, git-logo.png and git-favicon.png) to their destination.\n For example if git was (or is) installed with /usr prefix, you can do\n \n-\t$ make prefix=/usr gitweb             ;# as yourself\n-\t# cp gitweb/*.cgi gitweb/*.css \\\n-\t     gitweb/*.js  gitweb/*.png \\\n-\t     /var/www/cgi-bin/                ;# as root\n+\t$ make prefix=/usr gitweb                            ;# as yourself\n+\t# make gitwebdir=/var/www/cgi-bin install-gitweb     ;# as root\n \n Alternatively you can use autoconf generated ./configure script to\n set up path to git binaries (via config.mak.autogen), so you can write\n@@ -18,9 +16,8 @@ instead\n \t$ make configure                     ;# as yourself\n \t$ ./configure --prefix=/usr          ;# as yourself\n \t$ make gitweb                        ;# as yourself\n-\t# cp gitweb/*.cgi gitweb/*.css \\\n-\t     gitweb/*.js  gitweb/*.png \\\n-\t     /var/www/cgi-bin/               ;# as root\n+\t# make gitwebdir=/var/www/cgi-bin \\\n+\t       install-gitweb                ;# as root\n \n The above example assumes that your web server is configured to run\n [executable] files in /var/www/cgi-bin/ as server scripts (as CGI\ndiff --git a/gitweb/Makefile b/gitweb/Makefile\nindex f2e1d92..935d2d2 100644\n--- a/gitweb/Makefile\n+++ b/gitweb/Makefile\n@@ -12,7 +12,10 @@ all::\n \n prefix ?= $(HOME)\n bindir ?= $(prefix)/bin\n+gitwebdir ?= /var/www/cgi-bin\n+\n RM ?= rm -f\n+INSTALL ?= install\n \n # default configuration for gitweb\n GITWEB_CONFIG = gitweb_config.perl\n@@ -49,9 +52,11 @@ SHELL_PATH ?= $(SHELL)\n PERL_PATH  ?= /usr/bin/perl\n \n # Shell quote;\n-bindir_SQ = $(subst ','\\'',$(bindir))         #'\n-SHELL_PATH_SQ = $(subst ','\\'',$(SHELL_PATH)) #'\n-PERL_PATH_SQ  = $(subst ','\\'',$(PERL_PATH))  #'\n+bindir_SQ = $(subst ','\\'',$(bindir))#'\n+gitwebdir_SQ = $(subst ','\\'',$(gitwebdir))#'\n+SHELL_PATH_SQ = $(subst ','\\'',$(SHELL_PATH))#'\n+PERL_PATH_SQ  = $(subst ','\\'',$(PERL_PATH))#'\n+DESTDIR_SQ    = $(subst ','\\'',$(DESTDIR))#'\n \n # Quiet generation (unless V=1)\n QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir\n@@ -80,20 +85,30 @@ endif\n \n all:: gitweb.cgi\n \n+GITWEB_PROGRAMS = gitweb.cgi\n+\n ifdef JSMIN\n+GITWEB_FILES += gitweb.min.js\n GITWEB_JS = gitweb.min.js\n all:: gitweb.min.js\n gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS\n \t$(QUIET_GEN)$(JSMIN) <$< >$@\n+else\n+GITWEB_FILES += gitweb.js\n endif\n \n ifdef CSSMIN\n+GITWEB_FILES += gitweb.min.css\n GITWEB_CSS = gitweb.min.css\n all:: gitweb.min.css\n gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS\n \t$(QUIET_GEN)$(CSSMIN) <$ >$@\n+else\n+GITWEB_FILES += gitweb.css\n endif\n \n+GITWEB_FILES += git-logo.png git-favicon.png\n+\n GITWEB_REPLACE = \\\n \t-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \\\n \t-e 's|++GIT_BINDIR++|$(bindir)|g' \\\n@@ -127,8 +142,17 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS\n \tchmod +x $@+ && \\\n \tmv $@+ $@\n \n+### Installation rules\n+\n+install: all\n+\t$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n+\t$(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n+\t$(INSTALL) -m 644 $(GITWEB_FILES)    '$(DESTDIR_SQ)$(gitwebdir_SQ)'\n+\n+### Cleaning rules\n+\n clean:\n \t$(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS\n \n-.PHONY: all clean .FORCE-GIT-VERSION-FILE FORCE\n+.PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE\n \n-- \n1.7.0.1\n"},{"id":"141497","messageId":"20100511234558.GP3563@machine.or.cz","threadId":"23640","inReplyTo":"201005012236.16703.jnareb@gmail.com","subject":"Re: [PATCH/RFC] gitweb: Create install target for gitweb in Makefile","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2010-05-11T23:45:58Z","receivedAt":"2010-05-11T23:45:58Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Sat, May 01, 2010 at 10:36:15PM +0200, Jakub Narebski wrote:\n> Subject: [PATCHv2] gitweb: Create install target for gitweb in Makefile\n> \n> Installing gitweb is now as easy as\n> \n>   # make gitwebdir=/var/www/cgi-bin gitweb-install  ;# as root\n> \n> The gitweb/INSTALL file was updated accordingly, to make use of this\n> new target.\n> \n> Fix shell quoting, i.e. setting bindir_SQ etc., in gitweb/Makefile.\n> Those variables were not used previously.\n> \n> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n\nAcked-by: Petr Baudis <pasky@suse.cz>\n"},{"id":"141498","messageId":"4BE9ED24.1050400@kernel.org","threadId":"23640","inReplyTo":"20100511234558.GP3563@machine.or.cz","subject":"Re: [PATCH/RFC] gitweb: Create install target for gitweb in Makefile","fromName":"J.H.","fromEmail":"warthog9@kernel.org","sentAt":"2010-05-11T23:49:56Z","receivedAt":"2010-05-11T23:49:56Z","isPatch":true,"sender":{"key":"warthog9@kernel.org","avatar":"https://avatars.githubusercontent.com/u/2334704?v=4"},"body":"On 05/11/2010 04:45 PM, Petr Baudis wrote:\n> On Sat, May 01, 2010 at 10:36:15PM +0200, Jakub Narebski wrote:\n>> Subject: [PATCHv2] gitweb: Create install target for gitweb in Makefile\n>>\n>> Installing gitweb is now as easy as\n>>\n>>   # make gitwebdir=/var/www/cgi-bin gitweb-install  ;# as root\n>>\n>> The gitweb/INSTALL file was updated accordingly, to make use of this\n>> new target.\n>>\n>> Fix shell quoting, i.e. setting bindir_SQ etc., in gitweb/Makefile.\n>> Those variables were not used previously.\n>>\n>> Signed-off-by: Jakub Narebski <jnareb@gmail.com>\n> \n> Acked-by: Petr Baudis <pasky@suse.cz>\n\nMost installations I've seen install gitweb into /var/www/git[web] and\nset it up to be CGI executable.  I'm not sure I've actually seen cgi-bin\nused on most systems in quite a long time.\n\nJust my $0.02\n\n- John 'Warthog9' Hawley\n"}]}