@matheusbsbs / matheus-bagliano / commits / 5d043a3d85
Fork 0

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 <tali@admingilde.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Martin Waitz committed Aug 1, 2006 at 21:34 UTC 5d043a3d856bd40d8b34b8836a561e438d23573b
3 files changed +47 -10
Makefile
+23 -2
@@ -116,6 +116,13 @@ template_dir = $(prefix)/share/git-core/templates/
116 GIT_PYTHON_DIR = $(prefix)/share/git-core/python
117 # DESTDIR=
118
119 +# default configuration for gitweb
120 +GITWEB_SITENAME =
121 +GITWEB_PROJECTROOT = /pub/git
122 +GITWEB_LIST =
123 +GITWEB_HOMETEXT = indextext.html
124 +GITWEB_CSS = gitweb.css
125 +
126 export prefix bindir gitexecdir template_dir GIT_PYTHON_DIR
127
128 CC = gcc
@@ -514,7 +521,7 @@ LIB_OBJS += $(COMPAT_OBJS)
521 export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
522 ### Build rules
523
517 -all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk
524 +all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi
525
526 all:
527 $(MAKE) -C templates
@@ -572,6 +579,20 @@ git-status: git-commit
579 cp $< $@+
580 mv $@+ $@
581
582 +gitweb/gitweb.cgi: gitweb/gitweb.perl
583 + rm -f $@ $@+
584 + sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \
585 + -e 's|@@GIT_VERSION@@|$(GIT_VERSION)|g' \
586 + -e 's|@@GIT_BINDIR@@|$(bindir)|g' \
587 + -e 's|@@GITWEB_SITENAME@@|$(GITWEB_SITENAME)|g' \
588 + -e 's|@@GITWEB_PROJECTROOT@@|$(GITWEB_PROJECTROOT)|g' \
589 + -e 's|@@GITWEB_LIST@@|$(GITWEB_LIST)|g' \
590 + -e 's|@@GITWEB_HOMETEXT@@|$(GITWEB_HOMETEXT)|g' \
591 + -e 's|@@GITWEB_CSS@@|$(GITWEB_CSS)|g' \
592 + $< >$@+
593 + chmod +x $@+
594 + mv $@+ $@
595 +
596 git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
597 rm -f $@ $@+
598 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
@@ -582,7 +603,7 @@ git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css
603 -e '/@@GITWEB_CGI@@/d' \
604 -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
605 -e '/@@GITWEB_CSS@@/d' \
585 - $@.sh | sed "s|/usr/bin/git|$(bindir)/git|" > $@+
606 + $@.sh > $@+
607 chmod +x $@+
608 mv $@+ $@
609
gitweb/README
+17
@@ -5,5 +5,22 @@ The one working on:
5
6 From the git version 1.4.0 gitweb is bundled with git.
7
8 +
9 +How to configure gitweb for your local system:
10 +
11 +You can specify the following configuration variables when building GIT:
12 + * GITWEB_SITENAME
13 + Shown in the title of all generated pages, defaults to the servers name.
14 + * GITWEB_PROJECTROOT
15 + The root directory for all projects shown by gitweb.
16 + * GITWEB_LIST
17 + points to a directory to scan for projects (defaults to project root)
18 + or to a file for explicit listing of projects.
19 + * GITWEB_HOMETEXT
20 + points to an .html file which is included on the gitweb project
21 + overview page.
22 + * GITWEB_CSS
23 + Points to the location where you put gitweb.css on your web server.
24 +
25 Any comment/question/concern to:
26 Kay Sievers <kay.sievers@vrfy.org>
gitweb/gitweb.perl renamed
+7 -8
@@ -18,18 +18,18 @@ use File::Find qw();
18 binmode STDOUT, ':utf8';
19
20 our $cgi = new CGI;
21 -our $version = "267";
21 +our $version = "@@GIT_VERSION@@";
22 our $my_url = $cgi->url();
23 our $my_uri = $cgi->url(-absolute => 1);
24 our $rss_link = "";
25
26 # core git executable to use
27 # this can just be "git" if your webserver has a sensible PATH
28 -our $GIT = "/usr/bin/git";
28 +our $GIT = "@@GIT_BINDIR@@/git";
29
30 # absolute fs-path which will be prepended to the project path
31 #our $projectroot = "/pub/scm";
32 -our $projectroot = "/home/kay/public_html/pub/scm";
32 +our $projectroot = "@@GITWEB_PROJECTROOT@@";
33
34 # version of the core git binary
35 our $git_version = qx($GIT --version) =~ m/git version (.*)$/ ? $1 : "unknown";
@@ -45,17 +45,16 @@ our $home_link = $my_uri;
45
46 # name of your site or organization to appear in page titles
47 # replace this with something more descriptive for clearer bookmarks
48 -our $site_name = $ENV{'SERVER_NAME'} || "Untitled";
48 +our $site_name = "@@GITWEB_SITENAME@@" || $ENV{'SERVER_NAME'} || "Untitled";
49
50 # html text to include at home page
51 -our $home_text = "indextext.html";
51 +our $home_text = "@@GITWEB_HOMETEXT@@";
52
53 # URI of default stylesheet
54 -our $stylesheet = "gitweb.css";
54 +our $stylesheet = "@@GITWEB_CSS@@";
55
56 # source of projects list
57 -#our $projects_list = $projectroot;
58 -our $projects_list = "index/index.aux";
57 +our $projects_list = "@@GITWEB_LIST@@" || "$projectroot";
58
59 # default blob_plain mimetype and default charset for text/plain blob
60 our $default_blob_plain_mimetype = 'text/plain';