Merge branch 'jn/gitweb-plackup'

* jn/gitweb-plackup:
  git-instaweb: Add support for running gitweb via 'plackup'
  git-instaweb: Wait for server to start before running web browser
  git-instaweb: Remove pidfile after stopping web server
  git-instaweb: Configure it to work with new gitweb structure
  git-instaweb: Put httpd logs in a "$httpd_only" subdirectory
  gitweb: Set default destination directory for installing gitweb in Makefile
  gitweb: Move static files into seperate subdirectory
This commit is contained in:
Junio C Hamano 2010-06-18 11:16:55 -07:00
commit 7c1b228d26
11 changed files with 256 additions and 104 deletions

View File

@ -29,7 +29,7 @@ OPTIONS
The HTTP daemon command-line that will be executed. The HTTP daemon command-line that will be executed.
Command-line options may be specified here, and the Command-line options may be specified here, and the
configuration file will be added at the end of the command-line. configuration file will be added at the end of the command-line.
Currently apache2, lighttpd, mongoose and webrick are supported. Currently apache2, lighttpd, mongoose, plackup and webrick are supported.
(Default: lighttpd) (Default: lighttpd)
-m:: -m::

View File

@ -272,6 +272,7 @@ mandir = share/man
infodir = share/info infodir = share/info
gitexecdir = libexec/git-core gitexecdir = libexec/git-core
sharedir = $(prefix)/share sharedir = $(prefix)/share
gitwebdir = $(sharedir)/gitweb
template_dir = share/git-core/templates template_dir = share/git-core/templates
htmldir = share/doc/git-doc htmldir = share/doc/git-doc
ifeq ($(prefix),/usr) ifeq ($(prefix),/usr)
@ -1444,6 +1445,7 @@ gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
template_dir_SQ = $(subst ','\'',$(template_dir)) template_dir_SQ = $(subst ','\'',$(template_dir))
htmldir_SQ = $(subst ','\'',$(htmldir)) htmldir_SQ = $(subst ','\'',$(htmldir))
prefix_SQ = $(subst ','\'',$(prefix)) prefix_SQ = $(subst ','\'',$(prefix))
gitwebdir_SQ = $(subst ','\'',$(gitwebdir))
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
@ -1580,45 +1582,38 @@ gitweb:
$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
ifdef JSMIN ifdef JSMIN
GITWEB_PROGRAMS += gitweb/gitweb.min.js GITWEB_PROGRAMS += gitweb/static/gitweb.min.js
GITWEB_JS = gitweb/gitweb.min.js GITWEB_JS = gitweb/static/gitweb.min.js
else else
GITWEB_JS = gitweb/gitweb.js GITWEB_JS = gitweb/static/gitweb.js
endif endif
ifdef CSSMIN ifdef CSSMIN
GITWEB_PROGRAMS += gitweb/gitweb.min.css GITWEB_PROGRAMS += gitweb/static/gitweb.min.css
GITWEB_CSS = gitweb/gitweb.min.css GITWEB_CSS = gitweb/static/gitweb.min.css
else else
GITWEB_CSS = gitweb/gitweb.css GITWEB_CSS = gitweb/static/gitweb.css
endif endif
OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_PROGRAMS) OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_PROGRAMS)
gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS) gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)
$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
ifdef JSMIN ifdef JSMIN
gitweb/gitweb.min.js: gitweb/gitweb.js gitweb/static/gitweb.min.js: gitweb/static/gitweb.js
$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
endif # JSMIN endif # JSMIN
ifdef CSSMIN ifdef CSSMIN
gitweb/gitweb.min.css: gitweb/gitweb.css gitweb/static/gitweb.min.css: gitweb/static/gitweb.css
$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
endif # CSSMIN endif # CSSMIN
git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/static/gitweb.js
$(QUIET_GEN)$(RM) $@ $@+ && \ $(QUIET_GEN)$(RM) $@ $@+ && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
-e 's/@@NO_CURL@@/$(NO_CURL)/g' \ -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
-e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \ -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \
-e '/@@GITWEB_CGI@@/d' \
-e '/@@GITWEB_CSS@@/r $(GITWEB_CSS)' \
-e '/@@GITWEB_CSS@@/d' \
-e '/@@GITWEB_JS@@/r $(GITWEB_JS)' \
-e '/@@GITWEB_JS@@/d' \
-e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
-e 's|@@GITWEB_CSS_NAME@@|$(GITWEB_CSS)|' \
-e 's|@@GITWEB_JS_NAME@@|$(GITWEB_JS)|' \
$@.sh > $@+ && \ $@.sh > $@+ && \
chmod +x $@+ && \ chmod +x $@+ && \
mv $@+ $@ mv $@+ $@
@ -1988,6 +1983,7 @@ install: all
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
ifndef NO_PERL ifndef NO_PERL
$(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
$(MAKE) -C gitweb gitwebdir=$(gitwebdir_SQ) install
endif endif
ifndef NO_PYTHON ifndef NO_PYTHON
$(MAKE) -C git_remote_helpers prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install $(MAKE) -C git_remote_helpers prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install

View File

@ -24,6 +24,7 @@ restart restart the web server
fqgitdir="$GIT_DIR" fqgitdir="$GIT_DIR"
local="$(git config --bool --get instaweb.local)" local="$(git config --bool --get instaweb.local)"
httpd="$(git config --get instaweb.httpd)" httpd="$(git config --get instaweb.httpd)"
root="$(git config --get instaweb.gitwebdir)"
port=$(git config --get instaweb.port) port=$(git config --get instaweb.port)
module_path="$(git config --get instaweb.modulepath)" module_path="$(git config --get instaweb.modulepath)"
@ -34,6 +35,9 @@ conf="$GIT_DIR/gitweb/httpd.conf"
# if installed, it doesn't need further configuration (module_path) # if installed, it doesn't need further configuration (module_path)
test -z "$httpd" && httpd='lighttpd -f' test -z "$httpd" && httpd='lighttpd -f'
# Default is @@GITWEBDIR@@
test -z "$root" && root='@@GITWEBDIR@@'
# any untaken local port will do... # any untaken local port will do...
test -z "$port" && port=1234 test -z "$port" && port=1234
@ -46,6 +50,12 @@ resolve_full_httpd () {
httpd="$httpd -f" httpd="$httpd -f"
fi fi
;; ;;
*plackup*)
# server is started by running via generated gitweb.psgi in $fqgitdir/gitweb
full_httpd="$fqgitdir/gitweb/gitweb.psgi"
httpd_only="${httpd%% *}" # cut on first space
return
;;
esac esac
httpd_only="$(echo $httpd | cut -f1 -d' ')" httpd_only="$(echo $httpd | cut -f1 -d' ')"
@ -57,7 +67,7 @@ resolve_full_httpd () {
# these days and those are not in most users $PATHs # these days and those are not in most users $PATHs
# in addition, we may have generated a server script # in addition, we may have generated a server script
# in $fqgitdir/gitweb. # in $fqgitdir/gitweb.
for i in /usr/local/sbin /usr/sbin "$fqgitdir/gitweb" for i in /usr/local/sbin /usr/sbin "$root" "$fqgitdir/gitweb"
do do
if test -x "$i/$httpd_only" if test -x "$i/$httpd_only"
then then
@ -83,8 +93,8 @@ start_httpd () {
# don't quote $full_httpd, there can be arguments to it (-f) # don't quote $full_httpd, there can be arguments to it (-f)
case "$httpd" in case "$httpd" in
*mongoose*) *mongoose*|*plackup*)
#The mongoose server doesn't have a daemon mode so we'll have to fork it #These servers don't have a daemon mode so we'll have to fork it
$full_httpd "$fqgitdir/gitweb/httpd.conf" & $full_httpd "$fqgitdir/gitweb/httpd.conf" &
#Save the pid before doing anything else (we'll print it later) #Save the pid before doing anything else (we'll print it later)
pid=$! pid=$!
@ -110,6 +120,20 @@ EOF
stop_httpd () { stop_httpd () {
test -f "$fqgitdir/pid" && kill $(cat "$fqgitdir/pid") test -f "$fqgitdir/pid" && kill $(cat "$fqgitdir/pid")
rm -f "$fqgitdir/pid"
}
httpd_is_ready () {
"$PERL" -MIO::Socket::INET -e "
local \$| = 1; # turn on autoflush
exit if (IO::Socket::INET->new('127.0.0.1:$port'));
print 'Waiting for \'$httpd\' to start ..';
do {
print '.';
sleep(1);
} until (IO::Socket::INET->new('127.0.0.1:$port'));
print qq! (done)\n!;
"
} }
while test $# != 0 while test $# != 0
@ -159,8 +183,8 @@ done
mkdir -p "$GIT_DIR/gitweb/tmp" mkdir -p "$GIT_DIR/gitweb/tmp"
GIT_EXEC_PATH="$(git --exec-path)" GIT_EXEC_PATH="$(git --exec-path)"
GIT_DIR="$fqgitdir" GIT_DIR="$fqgitdir"
export GIT_EXEC_PATH GIT_DIR GITWEB_CONFIG="$fqgitdir/gitweb/gitweb_config.perl"
export GIT_EXEC_PATH GIT_DIR GITWEB_CONFIG
webrick_conf () { webrick_conf () {
# generate a standalone server script in $fqgitdir/gitweb. # generate a standalone server script in $fqgitdir/gitweb.
@ -192,7 +216,7 @@ EOF
cat >"$conf" <<EOF cat >"$conf" <<EOF
:Port: $port :Port: $port
:DocumentRoot: "$fqgitdir/gitweb" :DocumentRoot: "$root"
:DirectoryIndex: ["gitweb.cgi"] :DirectoryIndex: ["gitweb.cgi"]
:PidFile: "$fqgitdir/pid" :PidFile: "$fqgitdir/pid"
EOF EOF
@ -201,18 +225,18 @@ EOF
lighttpd_conf () { lighttpd_conf () {
cat > "$conf" <<EOF cat > "$conf" <<EOF
server.document-root = "$fqgitdir/gitweb" server.document-root = "$root"
server.port = $port server.port = $port
server.modules = ( "mod_setenv", "mod_cgi" ) server.modules = ( "mod_setenv", "mod_cgi" )
server.indexfiles = ( "gitweb.cgi" ) server.indexfiles = ( "gitweb.cgi" )
server.pid-file = "$fqgitdir/pid" server.pid-file = "$fqgitdir/pid"
server.errorlog = "$fqgitdir/gitweb/error.log" server.errorlog = "$fqgitdir/gitweb/$httpd_only/error.log"
# to enable, add "mod_access", "mod_accesslog" to server.modules # to enable, add "mod_access", "mod_accesslog" to server.modules
# variable above and uncomment this # variable above and uncomment this
#accesslog.filename = "$fqgitdir/gitweb/access.log" #accesslog.filename = "$fqgitdir/gitweb/$httpd_only/access.log"
setenv.add-environment = ( "PATH" => env.PATH ) setenv.add-environment = ( "PATH" => env.PATH, "GITWEB_CONFIG" => env.GITWEB_CONFIG )
cgi.assign = ( ".cgi" => "" ) cgi.assign = ( ".cgi" => "" )
@ -277,14 +301,15 @@ EOF
apache2_conf () { apache2_conf () {
test -z "$module_path" && module_path=/usr/lib/apache2/modules test -z "$module_path" && module_path=/usr/lib/apache2/modules
mkdir -p "$GIT_DIR/gitweb/logs"
bind= bind=
test x"$local" = xtrue && bind='127.0.0.1:' test x"$local" = xtrue && bind='127.0.0.1:'
echo 'text/css css' > "$fqgitdir/mime.types" echo 'text/css css' > "$fqgitdir/mime.types"
cat > "$conf" <<EOF cat > "$conf" <<EOF
ServerName "git-instaweb" ServerName "git-instaweb"
ServerRoot "$fqgitdir/gitweb" ServerRoot "$root"
DocumentRoot "$fqgitdir/gitweb" DocumentRoot "$root"
ErrorLog "$fqgitdir/gitweb/$httpd_only/error.log"
CustomLog "$fqgitdir/gitweb/$httpd_only/access.log" combined
PidFile "$fqgitdir/pid" PidFile "$fqgitdir/pid"
Listen $bind$port Listen $bind$port
EOF EOF
@ -303,13 +328,14 @@ EOF
# check to see if Dennis Stosberg's mod_perl compatibility patch # check to see if Dennis Stosberg's mod_perl compatibility patch
# (<20060621130708.Gcbc6e5c@leonov.stosberg.net>) has been applied # (<20060621130708.Gcbc6e5c@leonov.stosberg.net>) has been applied
if test -f "$module_path/mod_perl.so" && if test -f "$module_path/mod_perl.so" &&
sane_grep 'MOD_PERL' "$GIT_DIR/gitweb/gitweb.cgi" >/dev/null sane_grep 'MOD_PERL' "$root/gitweb.cgi" >/dev/null
then then
# favor mod_perl if available # favor mod_perl if available
cat >> "$conf" <<EOF cat >> "$conf" <<EOF
LoadModule perl_module $module_path/mod_perl.so LoadModule perl_module $module_path/mod_perl.so
PerlPassEnv GIT_DIR PerlPassEnv GIT_DIR
PerlPassEnv GIT_EXEC_DIR PerlPassEnv GIT_EXEC_DIR
PerlPassEnv GITWEB_CONFIG
<Location /gitweb.cgi> <Location /gitweb.cgi>
SetHandler perl-script SetHandler perl-script
PerlResponseHandler ModPerl::Registry PerlResponseHandler ModPerl::Registry
@ -353,15 +379,15 @@ mongoose_conf() {
# For detailed description of every option, visit # For detailed description of every option, visit
# http://code.google.com/p/mongoose/wiki/MongooseManual # http://code.google.com/p/mongoose/wiki/MongooseManual
root $fqgitdir/gitweb root $root
ports $port ports $port
index_files gitweb.cgi index_files gitweb.cgi
#ssl_cert $fqgitdir/gitweb/ssl_cert.pem #ssl_cert $fqgitdir/gitweb/ssl_cert.pem
error_log $fqgitdir/gitweb/error.log error_log $fqgitdir/gitweb/$httpd_only/error.log
access_log $fqgitdir/gitweb/access.log access_log $fqgitdir/gitweb/$httpd_only/access.log
#cgi setup #cgi setup
cgi_env PATH=$PATH,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH cgi_env PATH=$PATH,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH,GITWEB_CONFIG=$GITWEB_CONFIG
cgi_interp $PERL cgi_interp $PERL
cgi_ext cgi,pl cgi_ext cgi,pl
@ -370,41 +396,165 @@ mime_types .gz=application/x-gzip,.tar.gz=application/x-tgz,.tgz=application/x-t
EOF EOF
} }
plackup_conf () {
# generate a standalone 'plackup' server script in $fqgitdir/gitweb
# with embedded configuration; it does not use "$conf" file
cat > "$fqgitdir/gitweb/gitweb.psgi" <<EOF
#!$PERL
script=' # gitweb - simple web interface to track changes in git repositories
s#^(my|our) \$projectroot =.*#$1 \$projectroot = "'$(dirname "$fqgitdir")'";#; # PSGI wrapper and server starter (see http://plackperl.org)
s#(my|our) \$gitbin =.*#$1 \$gitbin = "'$GIT_EXEC_PATH'";#;
s#(my|our) \$projects_list =.*#$1 \$projects_list = \$projectroot;#;
s#(my|our) \$git_temp =.*#$1 \$git_temp = "'$fqgitdir/gitweb/tmp'";#;'
gitweb_cgi () { use strict;
cat > "$1.tmp" <<\EOFGITWEB
@@GITWEB_CGI@@ use IO::Handle;
EOFGITWEB use Plack::MIME;
# Use the configured full path to perl to match the generated use Plack::Builder;
# scripts' 'hashpling' line use Plack::App::WrapCGI;
"$PERL" -p -e "$script" "$1.tmp" > "$1" use CGI::Emulate::PSGI 0.07; # minimum version required to work with gitweb
chmod +x "$1"
rm -f "$1.tmp" # mimetype mapping (from lighttpd_conf)
Plack::MIME->add_type(
".pdf" => "application/pdf",
".sig" => "application/pgp-signature",
".spl" => "application/futuresplash",
".class" => "application/octet-stream",
".ps" => "application/postscript",
".torrent" => "application/x-bittorrent",
".dvi" => "application/x-dvi",
".gz" => "application/x-gzip",
".pac" => "application/x-ns-proxy-autoconfig",
".swf" => "application/x-shockwave-flash",
".tar.gz" => "application/x-tgz",
".tgz" => "application/x-tgz",
".tar" => "application/x-tar",
".zip" => "application/zip",
".mp3" => "audio/mpeg",
".m3u" => "audio/x-mpegurl",
".wma" => "audio/x-ms-wma",
".wax" => "audio/x-ms-wax",
".ogg" => "application/ogg",
".wav" => "audio/x-wav",
".gif" => "image/gif",
".jpg" => "image/jpeg",
".jpeg" => "image/jpeg",
".png" => "image/png",
".xbm" => "image/x-xbitmap",
".xpm" => "image/x-xpixmap",
".xwd" => "image/x-xwindowdump",
".css" => "text/css",
".html" => "text/html",
".htm" => "text/html",
".js" => "text/javascript",
".asc" => "text/plain",
".c" => "text/plain",
".cpp" => "text/plain",
".log" => "text/plain",
".conf" => "text/plain",
".text" => "text/plain",
".txt" => "text/plain",
".dtd" => "text/xml",
".xml" => "text/xml",
".mpeg" => "video/mpeg",
".mpg" => "video/mpeg",
".mov" => "video/quicktime",
".qt" => "video/quicktime",
".avi" => "video/x-msvideo",
".asf" => "video/x-ms-asf",
".asx" => "video/x-ms-asf",
".wmv" => "video/x-ms-wmv",
".bz2" => "application/x-bzip",
".tbz" => "application/x-bzip-compressed-tar",
".tar.bz2" => "application/x-bzip-compressed-tar",
"" => "text/plain"
);
my \$app = builder {
# to be able to override \$SIG{__WARN__} to log build time warnings
use CGI::Carp; # it sets \$SIG{__WARN__} itself
my \$logdir = "$fqgitdir/gitweb/$httpd_only";
open my \$access_log_fh, '>>', "\$logdir/access.log"
or die "Couldn't open access log '\$logdir/access.log': \$!";
open my \$error_log_fh, '>>', "\$logdir/error.log"
or die "Couldn't open error log '\$logdir/error.log': \$!";
\$access_log_fh->autoflush(1);
\$error_log_fh->autoflush(1);
# redirect build time warnings to error.log
\$SIG{'__WARN__'} = sub {
my \$msg = shift;
# timestamp warning like in CGI::Carp::warn
my \$stamp = CGI::Carp::stamp();
\$msg =~ s/^/\$stamp/gm;
print \$error_log_fh \$msg;
};
# write errors to error.log, access to access.log
enable 'AccessLog',
format => "combined",
logger => sub { print \$access_log_fh @_; };
enable sub {
my \$app = shift;
sub {
my \$env = shift;
\$env->{'psgi.errors'} = \$error_log_fh;
\$app->(\$env);
}
};
# gitweb currently doesn't work with $SIG{CHLD} set to 'IGNORE',
# because it uses 'close $fd or die...' on piped filehandle $fh
# (which causes the parent process to wait for child to finish).
enable_if { \$SIG{'CHLD'} eq 'IGNORE' } sub {
my \$app = shift;
sub {
my \$env = shift;
local \$SIG{'CHLD'} = 'DEFAULT';
local \$SIG{'CLD'} = 'DEFAULT';
\$app->(\$env);
}
};
# serve static files, i.e. stylesheet, images, script
enable 'Static',
path => sub { m!\.(js|css|png)\$! && s!^/gitweb/!! },
root => "$root/",
encoding => 'utf-8'; # encoding for 'text/plain' files
# convert CGI application to PSGI app
Plack::App::WrapCGI->new(script => "$root/gitweb.cgi")->to_app;
};
# make it runnable as standalone app,
# like it would be run via 'plackup' utility
if (__FILE__ eq \$0) {
require Plack::Runner;
my \$runner = Plack::Runner->new();
\$runner->parse_options(qw(--env deployment --port $port),
"$local" ? qw(--host 127.0.0.1) : ());
\$runner->run(\$app);
}
__END__
EOF
chmod a+x "$fqgitdir/gitweb/gitweb.psgi"
# configuration is embedded in server script file, gitweb.psgi
rm -f "$conf"
} }
gitweb_css () { gitweb_conf() {
cat > "$1" <<\EOFGITWEB cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF
@@GITWEB_CSS@@ #!/usr/bin/perl
our \$projectroot = "$(dirname "$fqgitdir")";
EOFGITWEB our \$git_temp = "$fqgitdir/gitweb/tmp";
our \$projects_list = \$projectroot;
EOF
} }
gitweb_js () { gitweb_conf
cat > "$1" <<\EOFGITWEB
@@GITWEB_JS@@
EOFGITWEB resolve_full_httpd
} mkdir -p "$fqgitdir/gitweb/$httpd_only"
gitweb_cgi "$GIT_DIR/gitweb/gitweb.cgi"
gitweb_css "$GIT_DIR/@@GITWEB_CSS_NAME@@"
gitweb_js "$GIT_DIR/@@GITWEB_JS_NAME@@"
case "$httpd" in case "$httpd" in
*lighttpd*) *lighttpd*)
@ -419,6 +569,9 @@ webrick)
*mongoose*) *mongoose*)
mongoose_conf mongoose_conf
;; ;;
*plackup*)
plackup_conf
;;
*) *)
echo "Unknown httpd specified: $httpd" echo "Unknown httpd specified: $httpd"
exit 1 exit 1
@ -429,7 +582,7 @@ start_httpd
url=http://127.0.0.1:$port url=http://127.0.0.1:$port
if test -n "$browser"; then if test -n "$browser"; then
git web--browse -b "$browser" $url || echo $url httpd_is_ready && git web--browse -b "$browser" $url || echo $url
else else
git web--browse -c "instaweb.browser" $url || echo $url httpd_is_ready && git web--browse -c "instaweb.browser" $url || echo $url
fi fi

View File

@ -2,9 +2,10 @@ GIT web Interface (gitweb) Installation
======================================= =======================================
First you have to generate gitweb.cgi from gitweb.perl using First you have to generate gitweb.cgi from gitweb.perl using
"make gitweb", then copy appropriate files (gitweb.cgi, gitweb.js, "make gitweb", then "make install-gitweb" appropriate files
gitweb.css, git-logo.png and git-favicon.png) to their destination. (gitweb.cgi, gitweb.js, gitweb.css, git-logo.png and git-favicon.png)
For example if git was (or is) installed with /usr prefix, you can do to their destination. For example if git was (or is) installed with
/usr prefix and gitwebdir is /var/www/cgi-bin, you can do
$ make prefix=/usr gitweb ;# as yourself $ make prefix=/usr gitweb ;# as yourself
# make gitwebdir=/var/www/cgi-bin install-gitweb ;# as root # make gitwebdir=/var/www/cgi-bin install-gitweb ;# as root
@ -81,16 +82,14 @@ Build example
minifiers, you can do minifiers, you can do
make GITWEB_PROJECTROOT="/home/local/scm" \ make GITWEB_PROJECTROOT="/home/local/scm" \
GITWEB_JS="/gitweb/gitweb.js" \ GITWEB_JS="gitweb/static/gitweb.js" \
GITWEB_CSS="/gitweb/gitweb.css" \ GITWEB_CSS="gitweb/static/gitweb.css" \
GITWEB_LOGO="/gitweb/git-logo.png" \ GITWEB_LOGO="gitweb/static/git-logo.png" \
GITWEB_FAVICON="/gitweb/git-favicon.png" \ GITWEB_FAVICON="gitweb/static/git-favicon.png" \
bindir=/usr/local/bin \ bindir=/usr/local/bin \
gitweb gitweb
cp -fv gitweb/gitweb.{cgi,js,css} \ make gitwebdir=/var/www/cgi-bin/gitweb install-gitweb
gitweb/git-{favicon,logo}.png \
/var/www/cgi-bin/gitweb/
Gitweb config file Gitweb config file

View File

@ -4,10 +4,10 @@ all::
# Define V=1 to have a more verbose compile. # Define V=1 to have a more verbose compile.
# #
# Define JSMIN to point to JavaScript minifier that functions as # Define JSMIN to point to JavaScript minifier that functions as
# a filter to have gitweb.js minified. # a filter to have static/gitweb.js minified.
# #
# Define CSSMIN to point to a CSS minifier in order to generate a minified # Define CSSMIN to point to a CSS minifier in order to generate a minified
# version of gitweb.css # version of static/gitweb.css
# #
prefix ?= $(HOME) prefix ?= $(HOME)
@ -29,10 +29,10 @@ GITWEB_STRICT_EXPORT =
GITWEB_BASE_URL = GITWEB_BASE_URL =
GITWEB_LIST = GITWEB_LIST =
GITWEB_HOMETEXT = indextext.html GITWEB_HOMETEXT = indextext.html
GITWEB_CSS = gitweb.css GITWEB_CSS = static/gitweb.css
GITWEB_LOGO = git-logo.png GITWEB_LOGO = static/git-logo.png
GITWEB_FAVICON = git-favicon.png GITWEB_FAVICON = static/git-favicon.png
GITWEB_JS = gitweb.js GITWEB_JS = static/gitweb.js
GITWEB_SITE_HEADER = GITWEB_SITE_HEADER =
GITWEB_SITE_FOOTER = GITWEB_SITE_FOOTER =
@ -54,6 +54,7 @@ PERL_PATH ?= /usr/bin/perl
# Shell quote; # Shell quote;
bindir_SQ = $(subst ','\'',$(bindir))#' bindir_SQ = $(subst ','\'',$(bindir))#'
gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#' gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#'
gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#'
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#' SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#'
PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#' PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#'
DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#' DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#'
@ -88,26 +89,26 @@ all:: gitweb.cgi
GITWEB_PROGRAMS = gitweb.cgi GITWEB_PROGRAMS = gitweb.cgi
ifdef JSMIN ifdef JSMIN
GITWEB_FILES += gitweb.min.js GITWEB_FILES += static/gitweb.min.js
GITWEB_JS = gitweb.min.js GITWEB_JS = static/gitweb.min.js
all:: gitweb.min.js all:: static/gitweb.min.js
gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS
$(QUIET_GEN)$(JSMIN) <$< >$@ $(QUIET_GEN)$(JSMIN) <$< >$@
else else
GITWEB_FILES += gitweb.js GITWEB_FILES += static/gitweb.js
endif endif
ifdef CSSMIN ifdef CSSMIN
GITWEB_FILES += gitweb.min.css GITWEB_FILES += static/gitweb.min.css
GITWEB_CSS = gitweb.min.css GITWEB_CSS = static/gitweb.min.css
all:: gitweb.min.css all:: static/gitweb.min.css
gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS
$(QUIET_GEN)$(CSSMIN) <$ >$@ $(QUIET_GEN)$(CSSMIN) <$ >$@
else else
GITWEB_FILES += gitweb.css GITWEB_FILES += static/gitweb.css
endif endif
GITWEB_FILES += git-logo.png git-favicon.png GITWEB_FILES += static/git-logo.png static/git-favicon.png
GITWEB_REPLACE = \ GITWEB_REPLACE = \
-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
@ -147,12 +148,13 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS
install: all install: all
$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)' $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'
$(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)' $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'
$(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebdir_SQ)' $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
$(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)'
### Cleaning rules ### Cleaning rules
clean: clean:
$(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS $(RM) gitweb.cgi static/gitweb.min.js static/gitweb.min.css GITWEB-BUILD-OPTIONS
.PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE .PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE

View File

@ -80,24 +80,26 @@ You can specify the following configuration variables when building GIT:
Points to the location where you put gitweb.css on your web server Points to the location where you put gitweb.css on your web server
(or to be more generic, the URI of gitweb stylesheet). Relative to the (or to be more generic, the URI of gitweb stylesheet). Relative to the
base URI of gitweb. Note that you can setup multiple stylesheets from base URI of gitweb. Note that you can setup multiple stylesheets from
the gitweb config file. [Default: gitweb.css (or gitweb.min.css if the the gitweb config file. [Default: static/gitweb.css (or
CSSMIN variable is defined / CSS minifier is used)] static/gitweb.min.css if the CSSMIN variable is defined / CSS minifier
is used)]
* GITWEB_LOGO * GITWEB_LOGO
Points to the location where you put git-logo.png on your web server Points to the location where you put git-logo.png on your web server
(or to be more generic URI of logo, 72x27 size, displayed in top right (or to be more generic URI of logo, 72x27 size, displayed in top right
corner of each gitweb page, and used as logo for Atom feed). Relative corner of each gitweb page, and used as logo for Atom feed). Relative
to base URI of gitweb. [Default: git-logo.png] to base URI of gitweb. [Default: static/git-logo.png]
* GITWEB_FAVICON * GITWEB_FAVICON
Points to the location where you put git-favicon.png on your web server Points to the location where you put git-favicon.png on your web server
(or to be more generic URI of favicon, assumed to be image/png type; (or to be more generic URI of favicon, assumed to be image/png type;
web browsers that support favicons (website icons) may display them web browsers that support favicons (website icons) may display them
in the browser's URL bar and next to site name in bookmarks). Relative in the browser's URL bar and next to site name in bookmarks). Relative
to base URI of gitweb. [Default: git-favicon.png] to base URI of gitweb. [Default: static/git-favicon.png]
* GITWEB_JS * GITWEB_JS
Points to the localtion where you put gitweb.js on your web server Points to the localtion where you put gitweb.js on your web server
(or to be more generic URI of JavaScript code used by gitweb). (or to be more generic URI of JavaScript code used by gitweb).
Relative to base URI of gitweb. [Default: gitweb.js (or gitweb.min.js Relative to base URI of gitweb. [Default: static/gitweb.js (or
if JSMIN build variable is defined / JavaScript minifier is used)] static/gitweb.min.js if JSMIN build variable is defined / JavaScript
minifier is used)]
* GITWEB_CONFIG * GITWEB_CONFIG
This Perl file will be loaded using 'do' and can be used to override any This Perl file will be loaded using 'do' and can be used to override any
of the options above as well as some other options -- see the "Runtime of the options above as well as some other options -- see the "Runtime

View File

Before

Width:  |  Height:  |  Size: 115 B

After

Width:  |  Height:  |  Size: 115 B

View File

Before

Width:  |  Height:  |  Size: 207 B

After

Width:  |  Height:  |  Size: 207 B

View File

@ -19,9 +19,9 @@ our \$site_name = '[localhost]';
our \$site_header = ''; our \$site_header = '';
our \$site_footer = ''; our \$site_footer = '';
our \$home_text = 'indextext.html'; our \$home_text = 'indextext.html';
our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/gitweb.css'); our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/static/gitweb.css');
our \$logo = 'file:///$TEST_DIRECTORY/../gitweb/git-logo.png'; our \$logo = 'file:///$TEST_DIRECTORY/../gitweb/static/git-logo.png';
our \$favicon = 'file:///$TEST_DIRECTORY/../gitweb/git-favicon.png'; our \$favicon = 'file:///$TEST_DIRECTORY/../gitweb/static/git-favicon.png';
our \$projects_list = ''; our \$projects_list = '';
our \$export_ok = ''; our \$export_ok = '';
our \$strict_export = ''; our \$strict_export = '';