From 5d043a3d856bd40d8b34b8836a561e438d23573b Mon Sep 17 00:00:00 2001 From: Martin Waitz Date: Tue, 1 Aug 2006 21:34:08 +0200 Subject: [PATCH 1/4] gitweb: fill in gitweb configuration by Makefile Generate gitweb/gitweb.cgi to reduce the need to patch gitweb.cgi by the end user. The GIT installation directory is already known by the Makefile, and can be inserted directly into gitweb. All other gitweb configuration parameters can now be specified by providing GITWEB_* variables while building GIT. These are described in gitweb/README. Signed-off-by: Martin Waitz Signed-off-by: Junio C Hamano --- Makefile | 25 +++++++++++++++++++++++-- gitweb/README | 17 +++++++++++++++++ gitweb/{gitweb.cgi => gitweb.perl} | 15 +++++++-------- 3 files changed, 47 insertions(+), 10 deletions(-) rename gitweb/{gitweb.cgi => gitweb.perl} (99%) diff --git a/Makefile b/Makefile index 15864e23bd..fb2b28868a 100644 --- a/Makefile +++ b/Makefile @@ -116,6 +116,13 @@ template_dir = $(prefix)/share/git-core/templates/ GIT_PYTHON_DIR = $(prefix)/share/git-core/python # DESTDIR= +# default configuration for gitweb +GITWEB_SITENAME = +GITWEB_PROJECTROOT = /pub/git +GITWEB_LIST = +GITWEB_HOMETEXT = indextext.html +GITWEB_CSS = gitweb.css + export prefix bindir gitexecdir template_dir GIT_PYTHON_DIR CC = gcc @@ -514,7 +521,7 @@ LIB_OBJS += $(COMPAT_OBJS) export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir ### Build rules -all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk +all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi all: $(MAKE) -C templates @@ -572,6 +579,20 @@ git-status: git-commit cp $< $@+ mv $@+ $@ +gitweb/gitweb.cgi: gitweb/gitweb.perl + rm -f $@ $@+ + sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \ + -e 's|@@GIT_VERSION@@|$(GIT_VERSION)|g' \ + -e 's|@@GIT_BINDIR@@|$(bindir)|g' \ + -e 's|@@GITWEB_SITENAME@@|$(GITWEB_SITENAME)|g' \ + -e 's|@@GITWEB_PROJECTROOT@@|$(GITWEB_PROJECTROOT)|g' \ + -e 's|@@GITWEB_LIST@@|$(GITWEB_LIST)|g' \ + -e 's|@@GITWEB_HOMETEXT@@|$(GITWEB_HOMETEXT)|g' \ + -e 's|@@GITWEB_CSS@@|$(GITWEB_CSS)|g' \ + $< >$@+ + chmod +x $@+ + mv $@+ $@ + git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css rm -f $@ $@+ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ @@ -582,7 +603,7 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css -e '/@@GITWEB_CGI@@/d' \ -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \ -e '/@@GITWEB_CSS@@/d' \ - $@.sh | sed "s|/usr/bin/git|$(bindir)/git|" > $@+ + $@.sh > $@+ chmod +x $@+ mv $@+ $@ diff --git a/gitweb/README b/gitweb/README index 8d672762ea..ed939e2fb5 100644 --- a/gitweb/README +++ b/gitweb/README @@ -5,5 +5,22 @@ The one working on: From the git version 1.4.0 gitweb is bundled with git. + +How to configure gitweb for your local system: + +You can specify the following configuration variables when building GIT: + * GITWEB_SITENAME + Shown in the title of all generated pages, defaults to the servers name. + * GITWEB_PROJECTROOT + The root directory for all projects shown by gitweb. + * GITWEB_LIST + points to a directory to scan for projects (defaults to project root) + or to a file for explicit listing of projects. + * GITWEB_HOMETEXT + points to an .html file which is included on the gitweb project + overview page. + * GITWEB_CSS + Points to the location where you put gitweb.css on your web server. + Any comment/question/concern to: Kay Sievers diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.perl similarity index 99% rename from gitweb/gitweb.cgi rename to gitweb/gitweb.perl index 9448b72798..6e4261d5f2 100755 --- a/gitweb/gitweb.cgi +++ b/gitweb/gitweb.perl @@ -18,18 +18,18 @@ use File::Find qw(); binmode STDOUT, ':utf8'; our $cgi = new CGI; -our $version = "267"; +our $version = "@@GIT_VERSION@@"; our $my_url = $cgi->url(); our $my_uri = $cgi->url(-absolute => 1); our $rss_link = ""; # core git executable to use # this can just be "git" if your webserver has a sensible PATH -our $GIT = "/usr/bin/git"; +our $GIT = "@@GIT_BINDIR@@/git"; # absolute fs-path which will be prepended to the project path #our $projectroot = "/pub/scm"; -our $projectroot = "/home/kay/public_html/pub/scm"; +our $projectroot = "@@GITWEB_PROJECTROOT@@"; # version of the core git binary our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown"; @@ -45,17 +45,16 @@ our $home_link = $my_uri; # name of your site or organization to appear in page titles # replace this with something more descriptive for clearer bookmarks -our $site_name = $ENV{'SERVER_NAME'} || "Untitled"; +our $site_name = "@@GITWEB_SITENAME@@" || $ENV{'SERVER_NAME'} || "Untitled"; # html text to include at home page -our $home_text = "indextext.html"; +our $home_text = "@@GITWEB_HOMETEXT@@"; # URI of default stylesheet -our $stylesheet = "gitweb.css"; +our $stylesheet = "@@GITWEB_CSS@@"; # source of projects list -#our $projects_list = $projectroot; -our $projects_list = "index/index.aux"; +our $projects_list = "@@GITWEB_LIST@@" || "$projectroot"; # default blob_plain mimetype and default charset for text/plain blob our $default_blob_plain_mimetype = 'text/plain'; From 281f2f6b45bf62e5bc81a6b457f1f7d26c426ea3 Mon Sep 17 00:00:00 2001 From: Martin Waitz Date: Mon, 31 Jul 2006 00:38:39 +0200 Subject: [PATCH 2/4] gitweb: use out-of-line GIT logo. Use the normal web server instead of the CGI to provide the git logo, just like the gitweb.css. Signed-off-by: Martin Waitz Signed-off-by: Junio C Hamano --- Makefile | 2 ++ gitweb/README | 2 ++ gitweb/git-logo.png | Bin 0 -> 208 bytes gitweb/gitweb.perl | 29 ++++------------------------- 4 files changed, 8 insertions(+), 25 deletions(-) create mode 100644 gitweb/git-logo.png diff --git a/Makefile b/Makefile index fb2b28868a..ac5db1ef4c 100644 --- a/Makefile +++ b/Makefile @@ -122,6 +122,7 @@ GITWEB_PROJECTROOT = /pub/git GITWEB_LIST = GITWEB_HOMETEXT = indextext.html GITWEB_CSS = gitweb.css +GITWEB_LOGO = git-logo.png export prefix bindir gitexecdir template_dir GIT_PYTHON_DIR @@ -589,6 +590,7 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl -e 's|@@GITWEB_LIST@@|$(GITWEB_LIST)|g' \ -e 's|@@GITWEB_HOMETEXT@@|$(GITWEB_HOMETEXT)|g' \ -e 's|@@GITWEB_CSS@@|$(GITWEB_CSS)|g' \ + -e 's|@@GITWEB_LOGO@@|$(GITWEB_LOGO)|g' \ $< >$@+ chmod +x $@+ mv $@+ $@ diff --git a/gitweb/README b/gitweb/README index ed939e2fb5..1b2180c731 100644 --- a/gitweb/README +++ b/gitweb/README @@ -21,6 +21,8 @@ You can specify the following configuration variables when building GIT: overview page. * GITWEB_CSS Points to the location where you put gitweb.css on your web server. + * GITWEB_LOGO + Points to the location where you put git-logo.png on your web server. Any comment/question/concern to: Kay Sievers diff --git a/gitweb/git-logo.png b/gitweb/git-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..16ae8d5382de5ffe63b54139245143513a87446e GIT binary patch literal 208 zcmeAS@N?(olHy`uVBq!ia0vp^9zZP3!VDyJZ(h*_QW60^A+G=b|4&GW-LQTYLj%LP zv&RoGFuZv2?ECj`Q+bxV1Jx9Jx;TbtoKN;hS77mqk>KLcN(xR?VB+A-bX~J>A)^7$ zJXDx2{a_29 zsY;<{(@cXMleq+Ux^^7wU9iYSkxkvP$)WY2Yo|g1Bf}C~#iK$pv;G0CXYh3Ob6Mw< G&;$VMfkjjR literal 0 HcmV?d00001 diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 6e4261d5f2..1db1414a0a 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -52,6 +52,8 @@ our $home_text = "@@GITWEB_HOMETEXT@@"; # URI of default stylesheet our $stylesheet = "@@GITWEB_CSS@@"; +# URI of GIT logo +our $logo = "@@GITWEB_LOGO@@"; # source of projects list our $projects_list = "@@GITWEB_LIST@@" || "$projectroot"; @@ -71,10 +73,7 @@ if (defined $action) { undef $action; die_error(undef, "Invalid action parameter."); } - if ($action eq "git-logo.png") { - git_logo(); - exit; - } elsif ($action eq "opml") { + if ($action eq "opml") { git_opml(); exit; } @@ -873,7 +872,7 @@ $rss_link EOF print "
\n" . "" . - "\"git\"" . + "\"git\"" . "\n"; print $cgi->a({-href => esc_param($home_link)}, "projects") . " / "; if (defined $project) { @@ -1267,26 +1266,6 @@ sub git_diff_print { ## ====================================================================== ## actions -# git-logo (cached in browser for one day) -sub git_logo { - binmode STDOUT, ':raw'; - print $cgi->header(-type => 'image/png', -expires => '+1d'); - # cat git-logo.png | hexdump -e '16/1 " %02x" "\n"' | sed 's/ /\\x/g' - print "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52" . - "\x00\x00\x00\x48\x00\x00\x00\x1b\x04\x03\x00\x00\x00\x2d\xd9\xd4" . - "\x2d\x00\x00\x00\x18\x50\x4c\x54\x45\xff\xff\xff\x60\x60\x5d\xb0" . - "\xaf\xaa\x00\x80\x00\xce\xcd\xc7\xc0\x00\x00\xe8\xe8\xe6\xf7\xf7" . - "\xf6\x95\x0c\xa7\x47\x00\x00\x00\x73\x49\x44\x41\x54\x28\xcf\x63" . - "\x48\x67\x20\x04\x4a\x5c\x18\x0a\x08\x2a\x62\x53\x61\x20\x02\x08" . - "\x0d\x69\x45\xac\xa1\xa1\x01\x30\x0c\x93\x60\x36\x26\x52\x91\xb1" . - "\x01\x11\xd6\xe1\x55\x64\x6c\x6c\xcc\x6c\x6c\x0c\xa2\x0c\x70\x2a" . - "\x62\x06\x2a\xc1\x62\x1d\xb3\x01\x02\x53\xa4\x08\xe8\x00\x03\x18" . - "\x26\x56\x11\xd4\xe1\x20\x97\x1b\xe0\xb4\x0e\x35\x24\x71\x29\x82" . - "\x99\x30\xb8\x93\x0a\x11\xb9\x45\x88\xc1\x8d\xa0\xa2\x44\x21\x06" . - "\x27\x41\x82\x40\x85\xc1\x45\x89\x20\x70\x01\x00\xa4\x3d\x21\xc5" . - "\x12\x1c\x9a\xfe\x00\x00\x00\x00\x49\x45\x4e\x44\xae\x42\x60\x82"; -} - sub git_project_list { my $order = $cgi->param('o'); if (defined $order && $order !~ m/project|descr|owner|age/) { From ee0d3234b1e4e69819635d4fc9e9c37933c0ea82 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 1 Aug 2006 15:56:28 -0700 Subject: [PATCH 3/4] gitweb/README: do not bug Kay with gitweb questions anymore Signed-off-by: Junio C Hamano --- gitweb/README | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gitweb/README b/gitweb/README index 1b2180c731..b91d42a909 100644 --- a/gitweb/README +++ b/gitweb/README @@ -24,5 +24,9 @@ You can specify the following configuration variables when building GIT: * GITWEB_LOGO Points to the location where you put git-logo.png on your web server. -Any comment/question/concern to: +Originally written by: Kay Sievers + +Any comment/question/concern to: + Git mailing list + From 22987ae0bc354bb2277c068ce15e9887f7cf0626 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 1 Aug 2006 16:23:47 -0700 Subject: [PATCH 4/4] Makefile: gitweb/gitweb.cgi is now generated. Signed-off-by: Junio C Hamano --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index ac5db1ef4c..6624c7501e 100644 --- a/Makefile +++ b/Makefile @@ -804,6 +804,7 @@ clean: rm -rf $(GIT_TARNAME) .doc-tmp-dir rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz rm -f $(htmldocs).tar.gz $(manpages).tar.gz + rm -f gitweb/gitweb.cgi $(MAKE) -C Documentation/ clean $(MAKE) -C templates clean $(MAKE) -C t/ clean