Git fork

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

+254 -102
+1 -1
Documentation/git-instaweb.txt
··· 29 29 The HTTP daemon command-line that will be executed. 30 30 Command-line options may be specified here, and the 31 31 configuration file will be added at the end of the command-line. 32 - Currently apache2, lighttpd, mongoose and webrick are supported. 32 + Currently apache2, lighttpd, mongoose, plackup and webrick are supported. 33 33 (Default: lighttpd) 34 34 35 35 -m::
+13 -17
Makefile
··· 272 272 infodir = share/info 273 273 gitexecdir = libexec/git-core 274 274 sharedir = $(prefix)/share 275 + gitwebdir = $(sharedir)/gitweb 275 276 template_dir = share/git-core/templates 276 277 htmldir = share/doc/git-doc 277 278 ifeq ($(prefix),/usr) ··· 1444 1445 template_dir_SQ = $(subst ','\'',$(template_dir)) 1445 1446 htmldir_SQ = $(subst ','\'',$(htmldir)) 1446 1447 prefix_SQ = $(subst ','\'',$(prefix)) 1448 + gitwebdir_SQ = $(subst ','\'',$(gitwebdir)) 1447 1449 1448 1450 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) 1449 1451 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) ··· 1580 1582 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all 1581 1583 1582 1584 ifdef JSMIN 1583 - GITWEB_PROGRAMS += gitweb/gitweb.min.js 1584 - GITWEB_JS = gitweb/gitweb.min.js 1585 + GITWEB_PROGRAMS += gitweb/static/gitweb.min.js 1586 + GITWEB_JS = gitweb/static/gitweb.min.js 1585 1587 else 1586 - GITWEB_JS = gitweb/gitweb.js 1588 + GITWEB_JS = gitweb/static/gitweb.js 1587 1589 endif 1588 1590 ifdef CSSMIN 1589 - GITWEB_PROGRAMS += gitweb/gitweb.min.css 1590 - GITWEB_CSS = gitweb/gitweb.min.css 1591 + GITWEB_PROGRAMS += gitweb/static/gitweb.min.css 1592 + GITWEB_CSS = gitweb/static/gitweb.min.css 1591 1593 else 1592 - GITWEB_CSS = gitweb/gitweb.css 1594 + GITWEB_CSS = gitweb/static/gitweb.css 1593 1595 endif 1594 1596 OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_PROGRAMS) 1595 1597 gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS) 1596 1598 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) 1597 1599 1598 1600 ifdef JSMIN 1599 - gitweb/gitweb.min.js: gitweb/gitweb.js 1601 + gitweb/static/gitweb.min.js: gitweb/static/gitweb.js 1600 1602 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) 1601 1603 endif # JSMIN 1602 1604 ifdef CSSMIN 1603 - gitweb/gitweb.min.css: gitweb/gitweb.css 1605 + gitweb/static/gitweb.min.css: gitweb/static/gitweb.css 1604 1606 $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@) 1605 1607 endif # CSSMIN 1606 1608 1607 1609 1608 - git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js 1610 + git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/static/gitweb.css gitweb/static/gitweb.js 1609 1611 $(QUIET_GEN)$(RM) $@ $@+ && \ 1610 1612 sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \ 1611 1613 -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ 1612 1614 -e 's/@@NO_CURL@@/$(NO_CURL)/g' \ 1613 - -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \ 1614 - -e '/@@GITWEB_CGI@@/d' \ 1615 - -e '/@@GITWEB_CSS@@/r $(GITWEB_CSS)' \ 1616 - -e '/@@GITWEB_CSS@@/d' \ 1617 - -e '/@@GITWEB_JS@@/r $(GITWEB_JS)' \ 1618 - -e '/@@GITWEB_JS@@/d' \ 1615 + -e 's|@@GITWEBDIR@@|$(gitwebdir_SQ)|g' \ 1619 1616 -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \ 1620 - -e 's|@@GITWEB_CSS_NAME@@|$(GITWEB_CSS)|' \ 1621 - -e 's|@@GITWEB_JS_NAME@@|$(GITWEB_JS)|' \ 1622 1617 $@.sh > $@+ && \ 1623 1618 chmod +x $@+ && \ 1624 1619 mv $@+ $@ ··· 1988 1983 $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install 1989 1984 ifndef NO_PERL 1990 1985 $(MAKE) -C perl prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install 1986 + $(MAKE) -C gitweb gitwebdir=$(gitwebdir_SQ) install 1991 1987 endif 1992 1988 ifndef NO_PYTHON 1993 1989 $(MAKE) -C git_remote_helpers prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' install
+199 -46
git-instaweb.sh
··· 24 24 fqgitdir="$GIT_DIR" 25 25 local="$(git config --bool --get instaweb.local)" 26 26 httpd="$(git config --get instaweb.httpd)" 27 + root="$(git config --get instaweb.gitwebdir)" 27 28 port=$(git config --get instaweb.port) 28 29 module_path="$(git config --get instaweb.modulepath)" 29 30 ··· 33 34 34 35 # if installed, it doesn't need further configuration (module_path) 35 36 test -z "$httpd" && httpd='lighttpd -f' 37 + 38 + # Default is @@GITWEBDIR@@ 39 + test -z "$root" && root='@@GITWEBDIR@@' 36 40 37 41 # any untaken local port will do... 38 42 test -z "$port" && port=1234 ··· 46 50 httpd="$httpd -f" 47 51 fi 48 52 ;; 53 + *plackup*) 54 + # server is started by running via generated gitweb.psgi in $fqgitdir/gitweb 55 + full_httpd="$fqgitdir/gitweb/gitweb.psgi" 56 + httpd_only="${httpd%% *}" # cut on first space 57 + return 58 + ;; 49 59 esac 50 60 51 61 httpd_only="$(echo $httpd | cut -f1 -d' ')" ··· 57 67 # these days and those are not in most users $PATHs 58 68 # in addition, we may have generated a server script 59 69 # in $fqgitdir/gitweb. 60 - for i in /usr/local/sbin /usr/sbin "$fqgitdir/gitweb" 70 + for i in /usr/local/sbin /usr/sbin "$root" "$fqgitdir/gitweb" 61 71 do 62 72 if test -x "$i/$httpd_only" 63 73 then ··· 83 93 84 94 # don't quote $full_httpd, there can be arguments to it (-f) 85 95 case "$httpd" in 86 - *mongoose*) 87 - #The mongoose server doesn't have a daemon mode so we'll have to fork it 96 + *mongoose*|*plackup*) 97 + #These servers don't have a daemon mode so we'll have to fork it 88 98 $full_httpd "$fqgitdir/gitweb/httpd.conf" & 89 99 #Save the pid before doing anything else (we'll print it later) 90 100 pid=$! ··· 110 120 111 121 stop_httpd () { 112 122 test -f "$fqgitdir/pid" && kill $(cat "$fqgitdir/pid") 123 + rm -f "$fqgitdir/pid" 124 + } 125 + 126 + httpd_is_ready () { 127 + "$PERL" -MIO::Socket::INET -e " 128 + local \$| = 1; # turn on autoflush 129 + exit if (IO::Socket::INET->new('127.0.0.1:$port')); 130 + print 'Waiting for \'$httpd\' to start ..'; 131 + do { 132 + print '.'; 133 + sleep(1); 134 + } until (IO::Socket::INET->new('127.0.0.1:$port')); 135 + print qq! (done)\n!; 136 + " 113 137 } 114 138 115 139 while test $# != 0 ··· 159 183 mkdir -p "$GIT_DIR/gitweb/tmp" 160 184 GIT_EXEC_PATH="$(git --exec-path)" 161 185 GIT_DIR="$fqgitdir" 162 - export GIT_EXEC_PATH GIT_DIR 163 - 186 + GITWEB_CONFIG="$fqgitdir/gitweb/gitweb_config.perl" 187 + export GIT_EXEC_PATH GIT_DIR GITWEB_CONFIG 164 188 165 189 webrick_conf () { 166 190 # generate a standalone server script in $fqgitdir/gitweb. ··· 192 216 193 217 cat >"$conf" <<EOF 194 218 :Port: $port 195 - :DocumentRoot: "$fqgitdir/gitweb" 219 + :DocumentRoot: "$root" 196 220 :DirectoryIndex: ["gitweb.cgi"] 197 221 :PidFile: "$fqgitdir/pid" 198 222 EOF ··· 201 225 202 226 lighttpd_conf () { 203 227 cat > "$conf" <<EOF 204 - server.document-root = "$fqgitdir/gitweb" 228 + server.document-root = "$root" 205 229 server.port = $port 206 230 server.modules = ( "mod_setenv", "mod_cgi" ) 207 231 server.indexfiles = ( "gitweb.cgi" ) 208 232 server.pid-file = "$fqgitdir/pid" 209 - server.errorlog = "$fqgitdir/gitweb/error.log" 233 + server.errorlog = "$fqgitdir/gitweb/$httpd_only/error.log" 210 234 211 235 # to enable, add "mod_access", "mod_accesslog" to server.modules 212 236 # variable above and uncomment this 213 - #accesslog.filename = "$fqgitdir/gitweb/access.log" 237 + #accesslog.filename = "$fqgitdir/gitweb/$httpd_only/access.log" 214 238 215 - setenv.add-environment = ( "PATH" => env.PATH ) 239 + setenv.add-environment = ( "PATH" => env.PATH, "GITWEB_CONFIG" => env.GITWEB_CONFIG ) 216 240 217 241 cgi.assign = ( ".cgi" => "" ) 218 242 ··· 277 301 278 302 apache2_conf () { 279 303 test -z "$module_path" && module_path=/usr/lib/apache2/modules 280 - mkdir -p "$GIT_DIR/gitweb/logs" 281 304 bind= 282 305 test x"$local" = xtrue && bind='127.0.0.1:' 283 306 echo 'text/css css' > "$fqgitdir/mime.types" 284 307 cat > "$conf" <<EOF 285 308 ServerName "git-instaweb" 286 - ServerRoot "$fqgitdir/gitweb" 287 - DocumentRoot "$fqgitdir/gitweb" 309 + ServerRoot "$root" 310 + DocumentRoot "$root" 311 + ErrorLog "$fqgitdir/gitweb/$httpd_only/error.log" 312 + CustomLog "$fqgitdir/gitweb/$httpd_only/access.log" combined 288 313 PidFile "$fqgitdir/pid" 289 314 Listen $bind$port 290 315 EOF ··· 303 328 # check to see if Dennis Stosberg's mod_perl compatibility patch 304 329 # (<20060621130708.Gcbc6e5c@leonov.stosberg.net>) has been applied 305 330 if test -f "$module_path/mod_perl.so" && 306 - sane_grep 'MOD_PERL' "$GIT_DIR/gitweb/gitweb.cgi" >/dev/null 331 + sane_grep 'MOD_PERL' "$root/gitweb.cgi" >/dev/null 307 332 then 308 333 # favor mod_perl if available 309 334 cat >> "$conf" <<EOF 310 335 LoadModule perl_module $module_path/mod_perl.so 311 336 PerlPassEnv GIT_DIR 312 337 PerlPassEnv GIT_EXEC_DIR 338 + PerlPassEnv GITWEB_CONFIG 313 339 <Location /gitweb.cgi> 314 340 SetHandler perl-script 315 341 PerlResponseHandler ModPerl::Registry ··· 353 379 # For detailed description of every option, visit 354 380 # http://code.google.com/p/mongoose/wiki/MongooseManual 355 381 356 - root $fqgitdir/gitweb 382 + root $root 357 383 ports $port 358 384 index_files gitweb.cgi 359 385 #ssl_cert $fqgitdir/gitweb/ssl_cert.pem 360 - error_log $fqgitdir/gitweb/error.log 361 - access_log $fqgitdir/gitweb/access.log 386 + error_log $fqgitdir/gitweb/$httpd_only/error.log 387 + access_log $fqgitdir/gitweb/$httpd_only/access.log 362 388 363 389 #cgi setup 364 - cgi_env PATH=$PATH,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH 390 + cgi_env PATH=$PATH,GIT_DIR=$GIT_DIR,GIT_EXEC_PATH=$GIT_EXEC_PATH,GITWEB_CONFIG=$GITWEB_CONFIG 365 391 cgi_interp $PERL 366 392 cgi_ext cgi,pl 367 393 ··· 370 396 EOF 371 397 } 372 398 399 + plackup_conf () { 400 + # generate a standalone 'plackup' server script in $fqgitdir/gitweb 401 + # with embedded configuration; it does not use "$conf" file 402 + cat > "$fqgitdir/gitweb/gitweb.psgi" <<EOF 403 + #!$PERL 373 404 374 - script=' 375 - s#^(my|our) \$projectroot =.*#$1 \$projectroot = "'$(dirname "$fqgitdir")'";#; 376 - s#(my|our) \$gitbin =.*#$1 \$gitbin = "'$GIT_EXEC_PATH'";#; 377 - s#(my|our) \$projects_list =.*#$1 \$projects_list = \$projectroot;#; 378 - s#(my|our) \$git_temp =.*#$1 \$git_temp = "'$fqgitdir/gitweb/tmp'";#;' 405 + # gitweb - simple web interface to track changes in git repositories 406 + # PSGI wrapper and server starter (see http://plackperl.org) 407 + 408 + use strict; 409 + 410 + use IO::Handle; 411 + use Plack::MIME; 412 + use Plack::Builder; 413 + use Plack::App::WrapCGI; 414 + use CGI::Emulate::PSGI 0.07; # minimum version required to work with gitweb 415 + 416 + # mimetype mapping (from lighttpd_conf) 417 + Plack::MIME->add_type( 418 + ".pdf" => "application/pdf", 419 + ".sig" => "application/pgp-signature", 420 + ".spl" => "application/futuresplash", 421 + ".class" => "application/octet-stream", 422 + ".ps" => "application/postscript", 423 + ".torrent" => "application/x-bittorrent", 424 + ".dvi" => "application/x-dvi", 425 + ".gz" => "application/x-gzip", 426 + ".pac" => "application/x-ns-proxy-autoconfig", 427 + ".swf" => "application/x-shockwave-flash", 428 + ".tar.gz" => "application/x-tgz", 429 + ".tgz" => "application/x-tgz", 430 + ".tar" => "application/x-tar", 431 + ".zip" => "application/zip", 432 + ".mp3" => "audio/mpeg", 433 + ".m3u" => "audio/x-mpegurl", 434 + ".wma" => "audio/x-ms-wma", 435 + ".wax" => "audio/x-ms-wax", 436 + ".ogg" => "application/ogg", 437 + ".wav" => "audio/x-wav", 438 + ".gif" => "image/gif", 439 + ".jpg" => "image/jpeg", 440 + ".jpeg" => "image/jpeg", 441 + ".png" => "image/png", 442 + ".xbm" => "image/x-xbitmap", 443 + ".xpm" => "image/x-xpixmap", 444 + ".xwd" => "image/x-xwindowdump", 445 + ".css" => "text/css", 446 + ".html" => "text/html", 447 + ".htm" => "text/html", 448 + ".js" => "text/javascript", 449 + ".asc" => "text/plain", 450 + ".c" => "text/plain", 451 + ".cpp" => "text/plain", 452 + ".log" => "text/plain", 453 + ".conf" => "text/plain", 454 + ".text" => "text/plain", 455 + ".txt" => "text/plain", 456 + ".dtd" => "text/xml", 457 + ".xml" => "text/xml", 458 + ".mpeg" => "video/mpeg", 459 + ".mpg" => "video/mpeg", 460 + ".mov" => "video/quicktime", 461 + ".qt" => "video/quicktime", 462 + ".avi" => "video/x-msvideo", 463 + ".asf" => "video/x-ms-asf", 464 + ".asx" => "video/x-ms-asf", 465 + ".wmv" => "video/x-ms-wmv", 466 + ".bz2" => "application/x-bzip", 467 + ".tbz" => "application/x-bzip-compressed-tar", 468 + ".tar.bz2" => "application/x-bzip-compressed-tar", 469 + "" => "text/plain" 470 + ); 471 + 472 + my \$app = builder { 473 + # to be able to override \$SIG{__WARN__} to log build time warnings 474 + use CGI::Carp; # it sets \$SIG{__WARN__} itself 475 + 476 + my \$logdir = "$fqgitdir/gitweb/$httpd_only"; 477 + open my \$access_log_fh, '>>', "\$logdir/access.log" 478 + or die "Couldn't open access log '\$logdir/access.log': \$!"; 479 + open my \$error_log_fh, '>>', "\$logdir/error.log" 480 + or die "Couldn't open error log '\$logdir/error.log': \$!"; 379 481 380 - gitweb_cgi () { 381 - cat > "$1.tmp" <<\EOFGITWEB 382 - @@GITWEB_CGI@@ 383 - EOFGITWEB 384 - # Use the configured full path to perl to match the generated 385 - # scripts' 'hashpling' line 386 - "$PERL" -p -e "$script" "$1.tmp" > "$1" 387 - chmod +x "$1" 388 - rm -f "$1.tmp" 389 - } 482 + \$access_log_fh->autoflush(1); 483 + \$error_log_fh->autoflush(1); 390 484 391 - gitweb_css () { 392 - cat > "$1" <<\EOFGITWEB 393 - @@GITWEB_CSS@@ 485 + # redirect build time warnings to error.log 486 + \$SIG{'__WARN__'} = sub { 487 + my \$msg = shift; 488 + # timestamp warning like in CGI::Carp::warn 489 + my \$stamp = CGI::Carp::stamp(); 490 + \$msg =~ s/^/\$stamp/gm; 491 + print \$error_log_fh \$msg; 492 + }; 394 493 395 - EOFGITWEB 494 + # write errors to error.log, access to access.log 495 + enable 'AccessLog', 496 + format => "combined", 497 + logger => sub { print \$access_log_fh @_; }; 498 + enable sub { 499 + my \$app = shift; 500 + sub { 501 + my \$env = shift; 502 + \$env->{'psgi.errors'} = \$error_log_fh; 503 + \$app->(\$env); 504 + } 505 + }; 506 + # gitweb currently doesn't work with $SIG{CHLD} set to 'IGNORE', 507 + # because it uses 'close $fd or die...' on piped filehandle $fh 508 + # (which causes the parent process to wait for child to finish). 509 + enable_if { \$SIG{'CHLD'} eq 'IGNORE' } sub { 510 + my \$app = shift; 511 + sub { 512 + my \$env = shift; 513 + local \$SIG{'CHLD'} = 'DEFAULT'; 514 + local \$SIG{'CLD'} = 'DEFAULT'; 515 + \$app->(\$env); 516 + } 517 + }; 518 + # serve static files, i.e. stylesheet, images, script 519 + enable 'Static', 520 + path => sub { m!\.(js|css|png)\$! && s!^/gitweb/!! }, 521 + root => "$root/", 522 + encoding => 'utf-8'; # encoding for 'text/plain' files 523 + # convert CGI application to PSGI app 524 + Plack::App::WrapCGI->new(script => "$root/gitweb.cgi")->to_app; 525 + }; 526 + 527 + # make it runnable as standalone app, 528 + # like it would be run via 'plackup' utility 529 + if (__FILE__ eq \$0) { 530 + require Plack::Runner; 531 + 532 + my \$runner = Plack::Runner->new(); 533 + \$runner->parse_options(qw(--env deployment --port $port), 534 + "$local" ? qw(--host 127.0.0.1) : ()); 535 + \$runner->run(\$app); 396 536 } 537 + __END__ 538 + EOF 397 539 398 - gitweb_js () { 399 - cat > "$1" <<\EOFGITWEB 400 - @@GITWEB_JS@@ 540 + chmod a+x "$fqgitdir/gitweb/gitweb.psgi" 541 + # configuration is embedded in server script file, gitweb.psgi 542 + rm -f "$conf" 543 + } 401 544 402 - EOFGITWEB 545 + gitweb_conf() { 546 + cat > "$fqgitdir/gitweb/gitweb_config.perl" <<EOF 547 + #!/usr/bin/perl 548 + our \$projectroot = "$(dirname "$fqgitdir")"; 549 + our \$git_temp = "$fqgitdir/gitweb/tmp"; 550 + our \$projects_list = \$projectroot; 551 + EOF 403 552 } 404 553 405 - gitweb_cgi "$GIT_DIR/gitweb/gitweb.cgi" 406 - gitweb_css "$GIT_DIR/@@GITWEB_CSS_NAME@@" 407 - gitweb_js "$GIT_DIR/@@GITWEB_JS_NAME@@" 554 + gitweb_conf 555 + 556 + resolve_full_httpd 557 + mkdir -p "$fqgitdir/gitweb/$httpd_only" 408 558 409 559 case "$httpd" in 410 560 *lighttpd*) ··· 419 569 *mongoose*) 420 570 mongoose_conf 421 571 ;; 572 + *plackup*) 573 + plackup_conf 574 + ;; 422 575 *) 423 576 echo "Unknown httpd specified: $httpd" 424 577 exit 1 ··· 429 582 url=http://127.0.0.1:$port 430 583 431 584 if test -n "$browser"; then 432 - git web--browse -b "$browser" $url || echo $url 585 + httpd_is_ready && git web--browse -b "$browser" $url || echo $url 433 586 else 434 - git web--browse -c "instaweb.browser" $url || echo $url 587 + httpd_is_ready && git web--browse -c "instaweb.browser" $url || echo $url 435 588 fi
+9 -10
gitweb/INSTALL
··· 2 2 ======================================= 3 3 4 4 First you have to generate gitweb.cgi from gitweb.perl using 5 - "make gitweb", then copy appropriate files (gitweb.cgi, gitweb.js, 6 - gitweb.css, git-logo.png and git-favicon.png) to their destination. 7 - For example if git was (or is) installed with /usr prefix, you can do 5 + "make gitweb", then "make install-gitweb" appropriate files 6 + (gitweb.cgi, gitweb.js, gitweb.css, git-logo.png and git-favicon.png) 7 + to their destination. For example if git was (or is) installed with 8 + /usr prefix and gitwebdir is /var/www/cgi-bin, you can do 8 9 9 10 $ make prefix=/usr gitweb ;# as yourself 10 11 # make gitwebdir=/var/www/cgi-bin install-gitweb ;# as root ··· 81 82 minifiers, you can do 82 83 83 84 make GITWEB_PROJECTROOT="/home/local/scm" \ 84 - GITWEB_JS="/gitweb/gitweb.js" \ 85 - GITWEB_CSS="/gitweb/gitweb.css" \ 86 - GITWEB_LOGO="/gitweb/git-logo.png" \ 87 - GITWEB_FAVICON="/gitweb/git-favicon.png" \ 85 + GITWEB_JS="gitweb/static/gitweb.js" \ 86 + GITWEB_CSS="gitweb/static/gitweb.css" \ 87 + GITWEB_LOGO="gitweb/static/git-logo.png" \ 88 + GITWEB_FAVICON="gitweb/static/git-favicon.png" \ 88 89 bindir=/usr/local/bin \ 89 90 gitweb 90 91 91 - cp -fv gitweb/gitweb.{cgi,js,css} \ 92 - gitweb/git-{favicon,logo}.png \ 93 - /var/www/cgi-bin/gitweb/ 92 + make gitwebdir=/var/www/cgi-bin/gitweb install-gitweb 94 93 95 94 96 95 Gitweb config file
+21 -19
gitweb/Makefile
··· 4 4 # Define V=1 to have a more verbose compile. 5 5 # 6 6 # Define JSMIN to point to JavaScript minifier that functions as 7 - # a filter to have gitweb.js minified. 7 + # a filter to have static/gitweb.js minified. 8 8 # 9 9 # Define CSSMIN to point to a CSS minifier in order to generate a minified 10 - # version of gitweb.css 10 + # version of static/gitweb.css 11 11 # 12 12 13 13 prefix ?= $(HOME) ··· 29 29 GITWEB_BASE_URL = 30 30 GITWEB_LIST = 31 31 GITWEB_HOMETEXT = indextext.html 32 - GITWEB_CSS = gitweb.css 33 - GITWEB_LOGO = git-logo.png 34 - GITWEB_FAVICON = git-favicon.png 35 - GITWEB_JS = gitweb.js 32 + GITWEB_CSS = static/gitweb.css 33 + GITWEB_LOGO = static/git-logo.png 34 + GITWEB_FAVICON = static/git-favicon.png 35 + GITWEB_JS = static/gitweb.js 36 36 GITWEB_SITE_HEADER = 37 37 GITWEB_SITE_FOOTER = 38 38 ··· 54 54 # Shell quote; 55 55 bindir_SQ = $(subst ','\'',$(bindir))#' 56 56 gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#' 57 + gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#' 57 58 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#' 58 59 PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#' 59 60 DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#' ··· 88 89 GITWEB_PROGRAMS = gitweb.cgi 89 90 90 91 ifdef JSMIN 91 - GITWEB_FILES += gitweb.min.js 92 - GITWEB_JS = gitweb.min.js 93 - all:: gitweb.min.js 94 - gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS 92 + GITWEB_FILES += static/gitweb.min.js 93 + GITWEB_JS = static/gitweb.min.js 94 + all:: static/gitweb.min.js 95 + static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS 95 96 $(QUIET_GEN)$(JSMIN) <$< >$@ 96 97 else 97 - GITWEB_FILES += gitweb.js 98 + GITWEB_FILES += static/gitweb.js 98 99 endif 99 100 100 101 ifdef CSSMIN 101 - GITWEB_FILES += gitweb.min.css 102 - GITWEB_CSS = gitweb.min.css 103 - all:: gitweb.min.css 104 - gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS 102 + GITWEB_FILES += static/gitweb.min.css 103 + GITWEB_CSS = static/gitweb.min.css 104 + all:: static/gitweb.min.css 105 + static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS 105 106 $(QUIET_GEN)$(CSSMIN) <$ >$@ 106 107 else 107 - GITWEB_FILES += gitweb.css 108 + GITWEB_FILES += static/gitweb.css 108 109 endif 109 110 110 - GITWEB_FILES += git-logo.png git-favicon.png 111 + GITWEB_FILES += static/git-logo.png static/git-favicon.png 111 112 112 113 GITWEB_REPLACE = \ 113 114 -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ ··· 147 148 install: all 148 149 $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)' 149 150 $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)' 150 - $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebdir_SQ)' 151 + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' 152 + $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebstaticdir_SQ)' 151 153 152 154 ### Cleaning rules 153 155 154 156 clean: 155 - $(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS 157 + $(RM) gitweb.cgi static/gitweb.min.js static/gitweb.min.css GITWEB-BUILD-OPTIONS 156 158 157 159 .PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE 158 160
+8 -6
gitweb/README
··· 80 80 Points to the location where you put gitweb.css on your web server 81 81 (or to be more generic, the URI of gitweb stylesheet). Relative to the 82 82 base URI of gitweb. Note that you can setup multiple stylesheets from 83 - the gitweb config file. [Default: gitweb.css (or gitweb.min.css if the 84 - CSSMIN variable is defined / CSS minifier is used)] 83 + the gitweb config file. [Default: static/gitweb.css (or 84 + static/gitweb.min.css if the CSSMIN variable is defined / CSS minifier 85 + is used)] 85 86 * GITWEB_LOGO 86 87 Points to the location where you put git-logo.png on your web server 87 88 (or to be more generic URI of logo, 72x27 size, displayed in top right 88 89 corner of each gitweb page, and used as logo for Atom feed). Relative 89 - to base URI of gitweb. [Default: git-logo.png] 90 + to base URI of gitweb. [Default: static/git-logo.png] 90 91 * GITWEB_FAVICON 91 92 Points to the location where you put git-favicon.png on your web server 92 93 (or to be more generic URI of favicon, assumed to be image/png type; 93 94 web browsers that support favicons (website icons) may display them 94 95 in the browser's URL bar and next to site name in bookmarks). Relative 95 - to base URI of gitweb. [Default: git-favicon.png] 96 + to base URI of gitweb. [Default: static/git-favicon.png] 96 97 * GITWEB_JS 97 98 Points to the localtion where you put gitweb.js on your web server 98 99 (or to be more generic URI of JavaScript code used by gitweb). 99 - Relative to base URI of gitweb. [Default: gitweb.js (or gitweb.min.js 100 - if JSMIN build variable is defined / JavaScript minifier is used)] 100 + Relative to base URI of gitweb. [Default: static/gitweb.js (or 101 + static/gitweb.min.js if JSMIN build variable is defined / JavaScript 102 + minifier is used)] 101 103 * GITWEB_CONFIG 102 104 This Perl file will be loaded using 'do' and can be used to override any 103 105 of the options above as well as some other options -- see the "Runtime
gitweb/git-favicon.png gitweb/static/git-favicon.png
gitweb/git-logo.png gitweb/static/git-logo.png
gitweb/gitweb.css gitweb/static/gitweb.css
gitweb/gitweb.js gitweb/static/gitweb.js
+3 -3
t/gitweb-lib.sh
··· 19 19 our \$site_header = ''; 20 20 our \$site_footer = ''; 21 21 our \$home_text = 'indextext.html'; 22 - our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/gitweb.css'); 23 - our \$logo = 'file:///$TEST_DIRECTORY/../gitweb/git-logo.png'; 24 - our \$favicon = 'file:///$TEST_DIRECTORY/../gitweb/git-favicon.png'; 22 + our @stylesheets = ('file:///$TEST_DIRECTORY/../gitweb/static/gitweb.css'); 23 + our \$logo = 'file:///$TEST_DIRECTORY/../gitweb/static/git-logo.png'; 24 + our \$favicon = 'file:///$TEST_DIRECTORY/../gitweb/static/git-favicon.png'; 25 25 our \$projects_list = ''; 26 26 our \$export_ok = ''; 27 27 our \$strict_export = '';