From 62331ef1637f8089bc920b3066a2ec48afd6fd26 Mon Sep 17 00:00:00 2001 From: John 'Warthog9' Hawley Date: Sat, 30 Jan 2010 23:30:40 +0100 Subject: gitweb: Makefile improvements Adjust the main Makefile so you can simply run make gitweb which in turn calls gitweb/Makefile. This means that in order to generate gitweb, you can simply run 'make' from gitweb subdirectory: cd gitweb make Targets gitweb/gitweb.cgi and (dependent on JSMIN being defined) gitweb/gitweb.min.js in main Makefile are preserved for backward compatibility. Signed-off-by: John 'Warthog9' Hawley Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/Makefile | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 gitweb/Makefile (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile new file mode 100644 index 0000000000..c9eb1ee667 --- /dev/null +++ b/gitweb/Makefile @@ -0,0 +1,129 @@ +# The default target of this Makefile is... +all:: + +# Define V=1 to have a more verbose compile. +# +# Define JSMIN to point to JavaScript minifier that functions as +# a filter to have gitweb.js minified. +# + +prefix ?= $(HOME) +bindir ?= $(prefix)/bin +RM ?= rm -f + +# JavaScript minifier invocation that can function as filter +JSMIN ?= + +# default configuration for gitweb +GITWEB_CONFIG = gitweb_config.perl +GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf +GITWEB_HOME_LINK_STR = projects +GITWEB_SITENAME = +GITWEB_PROJECTROOT = /pub/git +GITWEB_PROJECT_MAXDEPTH = 2007 +GITWEB_EXPORT_OK = +GITWEB_STRICT_EXPORT = +GITWEB_BASE_URL = +GITWEB_LIST = +GITWEB_HOMETEXT = indextext.html +GITWEB_CSS = gitweb.css +GITWEB_LOGO = git-logo.png +GITWEB_FAVICON = git-favicon.png +ifdef JSMIN +GITWEB_JS = gitweb.min.js +else +GITWEB_JS = gitweb.js +endif +GITWEB_SITE_HEADER = +GITWEB_SITE_FOOTER = + +# include user config +-include ../config.mak.autogen +-include ../config.mak + +# determine version +../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE + $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) GIT-VERSION-FILE + +-include ../GIT-VERSION-FILE + +### Build rules + +SHELL_PATH ?= $(SHELL) +PERL_PATH ?= /usr/bin/perl + +# Shell quote; +bindir_SQ = $(subst ','\'',$(bindir)) #' +SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) #' +PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) #' + +# Quiet generation (unless V=1) +QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir +QUIET_SUBDIR1 = + +ifneq ($(findstring $(MAKEFLAGS),w),w) +PRINT_DIR = --no-print-directory +else # "make -w" +NO_SUBDIR = : +endif + +ifneq ($(findstring $(MAKEFLAGS),s),s) +ifndef V + QUIET = @ + QUIET_GEN = $(QUIET)echo ' ' GEN $@; + QUIET_SUBDIR0 = +@subdir= + QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ + $(MAKE) $(PRINT_DIR) -C $$subdir + export V + export QUIET + export QUIET_GEN + export QUIET_SUBDIR0 + export QUIET_SUBDIR1 +endif +endif + +all:: gitweb.cgi + +ifdef JSMIN +FILES=gitweb.cgi gitweb.min.js +gitweb.cgi: gitweb.perl gitweb.min.js +else # !JSMIN +FILES=gitweb.cgi +gitweb.cgi: gitweb.perl +endif # JSMIN + +gitweb.cgi: + $(QUIET_GEN)$(RM) $@ $@+ && \ + sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \ + -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ + -e 's|++GIT_BINDIR++|$(bindir)|g' \ + -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \ + -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \ + -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \ + -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \ + -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \ + -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \ + -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \ + -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \ + -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \ + -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' \ + -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \ + -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \ + -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \ + -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \ + $< >$@+ && \ + chmod +x $@+ && \ + mv $@+ $@ + +ifdef JSMIN +gitweb.min.js: gitweb.js + $(QUIET_GEN)$(JSMIN) <$< >$@ +endif # JSMIN + +clean: + $(RM) $(FILES) + +.PHONY: all clean .FORCE-GIT-VERSION-FILE -- cgit v1.2.3 From 0e6ce21361c5d8e35cd15327539eec1f627aa0e3 Mon Sep 17 00:00:00 2001 From: Mark Rada Date: Fri, 2 Apr 2010 20:35:05 -0400 Subject: Gitweb: add support for minifying gitweb.css The build system added support minifying gitweb.js through a JavaScript minifier, but most minifiers come with support for minifying CSS files as well, so we should use it if we can. This patch will add the same facilities to gitweb.css that gitweb.js has for minification. That does not mean that they will use the same minifier though, as it is not safe to assume that all JavaScript minifiers will also minify CSS files. This patch also adds the GITWEB_PROGRAMS variable to the Makefile to keep a list of potential gitweb dependencies separate from OTHER_PROGRAMS when we need to know just the gitweb dependencies. Though the bandwidth savings will not be as dramatic as with the JavaScript minifier, every byte saved is important. Signed-off-by: Mark Rada Signed-off-by: Junio C Hamano --- gitweb/Makefile | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index c9eb1ee667..fffe700760 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -6,13 +6,17 @@ all:: # Define JSMIN to point to JavaScript minifier that functions as # a filter to have gitweb.js minified. # +# Define CSSMIN to point to a CSS minifier in order to generate a minified +# version of gitweb.css +# prefix ?= $(HOME) bindir ?= $(prefix)/bin RM ?= rm -f -# JavaScript minifier invocation that can function as filter +# JavaScript/CSS minifier invocation that can function as filter JSMIN ?= +CSSMIN ?= # default configuration for gitweb GITWEB_CONFIG = gitweb_config.perl @@ -26,7 +30,11 @@ GITWEB_STRICT_EXPORT = GITWEB_BASE_URL = GITWEB_LIST = GITWEB_HOMETEXT = indextext.html +ifdef CSSMIN +GITWEB_CSS = gitweb.min.css +else GITWEB_CSS = gitweb.css +endif GITWEB_LOGO = git-logo.png GITWEB_FAVICON = git-favicon.png ifdef JSMIN @@ -84,13 +92,14 @@ endif all:: gitweb.cgi +FILES = gitweb.cgi ifdef JSMIN -FILES=gitweb.cgi gitweb.min.js -gitweb.cgi: gitweb.perl gitweb.min.js -else # !JSMIN -FILES=gitweb.cgi -gitweb.cgi: gitweb.perl -endif # JSMIN +FILES += gitweb.min.js +endif +ifdef CSSMIN +FILES += gitweb.min.css +endif +gitweb.cgi: gitweb.perl $(GITWEB_JS) $(GITWEB_CSS) gitweb.cgi: $(QUIET_GEN)$(RM) $@ $@+ && \ @@ -123,6 +132,11 @@ gitweb.min.js: gitweb.js $(QUIET_GEN)$(JSMIN) <$< >$@ endif # JSMIN +ifdef CSSMIN +gitweb.min.css: gitweb.css + $(QUIET_GEN)$(CSSMIN) <$ >$@ +endif + clean: $(RM) $(FILES) -- cgit v1.2.3 From bb4bbf75829d1a6c021e34943ff4e942f064bb55 Mon Sep 17 00:00:00 2001 From: Mark Rada Date: Fri, 2 Apr 2010 20:35:54 -0400 Subject: Gitweb: add autoconfigure support for minifiers This will allow users to set a JavaScript/CSS minifier when/if they run the autoconfigure script while building git. Signed-off-by: Mark Rada Signed-off-by: Junio C Hamano --- gitweb/Makefile | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index fffe700760..ffee4bd1e3 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -14,10 +14,6 @@ prefix ?= $(HOME) bindir ?= $(prefix)/bin RM ?= rm -f -# JavaScript/CSS minifier invocation that can function as filter -JSMIN ?= -CSSMIN ?= - # default configuration for gitweb GITWEB_CONFIG = gitweb_config.perl GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf @@ -30,18 +26,10 @@ GITWEB_STRICT_EXPORT = GITWEB_BASE_URL = GITWEB_LIST = GITWEB_HOMETEXT = indextext.html -ifdef CSSMIN -GITWEB_CSS = gitweb.min.css -else GITWEB_CSS = gitweb.css -endif GITWEB_LOGO = git-logo.png GITWEB_FAVICON = git-favicon.png -ifdef JSMIN -GITWEB_JS = gitweb.min.js -else GITWEB_JS = gitweb.js -endif GITWEB_SITE_HEADER = GITWEB_SITE_FOOTER = @@ -95,9 +83,11 @@ all:: gitweb.cgi FILES = gitweb.cgi ifdef JSMIN FILES += gitweb.min.js +GITWEB_JS = gitweb.min.js endif ifdef CSSMIN FILES += gitweb.min.css +GITWEB_CSS = gitweb.min.css endif gitweb.cgi: gitweb.perl $(GITWEB_JS) $(GITWEB_CSS) -- cgit v1.2.3 From 8de096b6718048e84ee88e604a94b22937a0758e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 15 Apr 2010 08:57:18 -0400 Subject: gitweb: simplify gitweb.min.* generation and clean-up rules GITWEB_CSS and GITWEB_JS are meant to be "what URI should the installed cgi script use to refer to the stylesheet and JavaScript", never "this is the name of the file we are building". Don't use them to decide what file to build minified versions in. While we are at it, lose FILES that is used only for "clean" target in a misguided way. "make clean" should try to remove all the potential build artifacts regardless of a minor configuration change. Instead of trying to remove only the build product "make clean" would have created if it were run without "clean", explicitly list the three potential build products for removal. Tested-by: Mark Rada Signed-off-by: Junio C Hamano --- gitweb/Makefile | 75 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index ffee4bd1e3..f2e1d92fbb 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -80,54 +80,55 @@ endif all:: gitweb.cgi -FILES = gitweb.cgi ifdef JSMIN -FILES += gitweb.min.js GITWEB_JS = gitweb.min.js +all:: gitweb.min.js +gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS + $(QUIET_GEN)$(JSMIN) <$< >$@ endif + ifdef CSSMIN -FILES += gitweb.min.css GITWEB_CSS = gitweb.min.css +all:: gitweb.min.css +gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS + $(QUIET_GEN)$(CSSMIN) <$ >$@ endif -gitweb.cgi: gitweb.perl $(GITWEB_JS) $(GITWEB_CSS) -gitweb.cgi: +GITWEB_REPLACE = \ + -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ + -e 's|++GIT_BINDIR++|$(bindir)|g' \ + -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \ + -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \ + -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \ + -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \ + -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \ + -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \ + -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \ + -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \ + -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \ + -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' \ + -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \ + -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \ + -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \ + -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' + +GITWEB-BUILD-OPTIONS: FORCE + @rm -f $@+ + @echo "x" '$(PERL_PATH_SQ)' $(GITWEB_REPLACE) "$(JSMIN)|$(CSSMIN)" >$@+ + @cmp -s $@+ $@ && rm -f $@+ || mv -f $@+ $@ + +gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS $(QUIET_GEN)$(RM) $@ $@+ && \ sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \ - -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ - -e 's|++GIT_BINDIR++|$(bindir)|g' \ - -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \ - -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \ - -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \ - -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \ - -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \ - -e 's|"++GITWEB_PROJECT_MAXDEPTH++"|$(GITWEB_PROJECT_MAXDEPTH)|g' \ - -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \ - -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \ - -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \ - -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' \ - -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \ - -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \ - -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \ - -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \ - $< >$@+ && \ + $(GITWEB_REPLACE) $< >$@+ && \ chmod +x $@+ && \ mv $@+ $@ -ifdef JSMIN -gitweb.min.js: gitweb.js - $(QUIET_GEN)$(JSMIN) <$< >$@ -endif # JSMIN - -ifdef CSSMIN -gitweb.min.css: gitweb.css - $(QUIET_GEN)$(CSSMIN) <$ >$@ -endif - clean: - $(RM) $(FILES) + $(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS + +.PHONY: all clean .FORCE-GIT-VERSION-FILE FORCE -.PHONY: all clean .FORCE-GIT-VERSION-FILE -- cgit v1.2.3 From 152d94348f6a38eb7cb5f4af8397f51ba06ddffb Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Sat, 1 May 2010 22:36:15 +0200 Subject: gitweb: Create install target for gitweb in Makefile Installing gitweb is now as easy as # make gitwebdir=/var/www/cgi-bin gitweb-install ;# as root The gitweb/INSTALL file was updated accordingly, to make use of this new target. Fix shell quoting, i.e. setting bindir_SQ etc., in gitweb/Makefile. Those variables were not used previously. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/Makefile | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index f2e1d92fbb..935d2d2e07 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -12,7 +12,10 @@ all:: prefix ?= $(HOME) bindir ?= $(prefix)/bin +gitwebdir ?= /var/www/cgi-bin + RM ?= rm -f +INSTALL ?= install # default configuration for gitweb GITWEB_CONFIG = gitweb_config.perl @@ -49,9 +52,11 @@ SHELL_PATH ?= $(SHELL) PERL_PATH ?= /usr/bin/perl # Shell quote; -bindir_SQ = $(subst ','\'',$(bindir)) #' -SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) #' -PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) #' +bindir_SQ = $(subst ','\'',$(bindir))#' +gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#' +SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#' +PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#' +DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#' # Quiet generation (unless V=1) QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir @@ -80,20 +85,30 @@ endif all:: gitweb.cgi +GITWEB_PROGRAMS = gitweb.cgi + ifdef JSMIN +GITWEB_FILES += gitweb.min.js GITWEB_JS = gitweb.min.js all:: gitweb.min.js gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS $(QUIET_GEN)$(JSMIN) <$< >$@ +else +GITWEB_FILES += gitweb.js endif ifdef CSSMIN +GITWEB_FILES += gitweb.min.css GITWEB_CSS = gitweb.min.css all:: gitweb.min.css gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS $(QUIET_GEN)$(CSSMIN) <$ >$@ +else +GITWEB_FILES += gitweb.css endif +GITWEB_FILES += git-logo.png git-favicon.png + GITWEB_REPLACE = \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ -e 's|++GIT_BINDIR++|$(bindir)|g' \ @@ -127,8 +142,17 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS chmod +x $@+ && \ mv $@+ $@ +### Installation rules + +install: all + $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)' + $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)' + $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebdir_SQ)' + +### Cleaning rules + clean: $(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS -.PHONY: all clean .FORCE-GIT-VERSION-FILE FORCE +.PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE -- cgit v1.2.3 From 18d05328f3333e63bfffa65ac887ea16de60918c Mon Sep 17 00:00:00 2001 From: Pavan Kumar Sunkara Date: Fri, 28 May 2010 11:55:49 +0530 Subject: gitweb: Move static files into seperate subdirectory Create a new subdirectory called 'static' in gitweb/, and move all static files required by gitweb.cgi when running, which means styles, images and Javascript code. This should make gitweb more readable and easier to maintain. Update t/gitweb-lib.sh to reflect this change.The install-gitweb now also include moving of static files into 'static' subdirectory in target directory: update Makefile, gitweb's INSTALL, README and Makefile accordingly. Signed-off-by: Pavan Kumar Sunkara Mentored-by: Christian Couder Mentored-by: Petr Baudis Acked-by: Jakub Narebski Acked-by: Petr Baudis Signed-off-by: Junio C Hamano --- gitweb/Makefile | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index 935d2d2e07..d2584fedd8 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -4,10 +4,10 @@ all:: # Define V=1 to have a more verbose compile. # # 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 -# version of gitweb.css +# version of static/gitweb.css # prefix ?= $(HOME) @@ -29,10 +29,10 @@ GITWEB_STRICT_EXPORT = GITWEB_BASE_URL = GITWEB_LIST = GITWEB_HOMETEXT = indextext.html -GITWEB_CSS = gitweb.css -GITWEB_LOGO = git-logo.png -GITWEB_FAVICON = git-favicon.png -GITWEB_JS = gitweb.js +GITWEB_CSS = static/gitweb.css +GITWEB_LOGO = static/git-logo.png +GITWEB_FAVICON = static/git-favicon.png +GITWEB_JS = static/gitweb.js GITWEB_SITE_HEADER = GITWEB_SITE_FOOTER = @@ -54,6 +54,7 @@ PERL_PATH ?= /usr/bin/perl # Shell quote; bindir_SQ = $(subst ','\'',$(bindir))#' gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#' +gitwebstaticdir_SQ = $(subst ','\'',$(gitwebdir)/static)#' SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#' PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#' DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#' @@ -88,26 +89,26 @@ all:: gitweb.cgi GITWEB_PROGRAMS = gitweb.cgi ifdef JSMIN -GITWEB_FILES += gitweb.min.js -GITWEB_JS = gitweb.min.js -all:: gitweb.min.js -gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS +GITWEB_FILES += static/gitweb.min.js +GITWEB_JS = static/gitweb.min.js +all:: static/gitweb.min.js +static/gitweb.min.js: static/gitweb.js GITWEB-BUILD-OPTIONS $(QUIET_GEN)$(JSMIN) <$< >$@ else -GITWEB_FILES += gitweb.js +GITWEB_FILES += static/gitweb.js endif ifdef CSSMIN -GITWEB_FILES += gitweb.min.css -GITWEB_CSS = gitweb.min.css -all:: gitweb.min.css -gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS +GITWEB_FILES += static/gitweb.min.css +GITWEB_CSS = static/gitweb.min.css +all:: static/gitweb.min.css +static/gitweb.min.css: static/gitweb.css GITWEB-BUILD-OPTIONS $(QUIET_GEN)$(CSSMIN) <$ >$@ else -GITWEB_FILES += gitweb.css +GITWEB_FILES += static/gitweb.css endif -GITWEB_FILES += git-logo.png git-favicon.png +GITWEB_FILES += static/git-logo.png static/git-favicon.png GITWEB_REPLACE = \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ @@ -147,12 +148,13 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS install: all $(INSTALL) -d -m 755 '$(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 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 -- cgit v1.2.3 From 70649945c215b1674611a40eda1d0058118a6d1a Mon Sep 17 00:00:00 2001 From: Jay Soffian Date: Fri, 18 Jun 2010 17:01:25 -0400 Subject: gitweb/Makefile: fix typo in gitweb.min.css rule This typo has been in place since the rule was originally added by 0e6ce21 (Gitweb: add support for minifying gitweb.css). Signed-off-by: Jay Soffian Signed-off-by: Junio C Hamano --- gitweb/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index f2e1d92fbb..e7dd252773 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -91,7 +91,7 @@ ifdef CSSMIN GITWEB_CSS = gitweb.min.css all:: gitweb.min.css gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS - $(QUIET_GEN)$(CSSMIN) <$ >$@ + $(QUIET_GEN)$(CSSMIN) <$< >$@ endif GITWEB_REPLACE = \ -- cgit v1.2.3 From 7ce896b3000a7bd2ea24f02ad3051f43ad351e1f Mon Sep 17 00:00:00 2001 From: Christopher Wilson Date: Tue, 21 Sep 2010 00:25:19 -0700 Subject: Enable highlight executable path as a configuration option Allow build-time/run-time configuration of the highlight executable (must be the one from http://www.andre-simon.de due to assumptions about parameters and output). Defaults to previous behavior which assumes that highlight is available on the server PATH. However, if this is not the case, the path to the highlight executable can be configured at build time as a configuration variable HIGHLIGHT_BIN = /path/to/highlight or at runtime by configuring GITWEB_CONFIG $highlight_bin = /path/to/highlight Signed-off-by: Christopher Wilson Acked-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index 2fb7c2d77b..e32ee76309 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -35,6 +35,7 @@ GITWEB_FAVICON = static/git-favicon.png GITWEB_JS = static/gitweb.js GITWEB_SITE_HEADER = GITWEB_SITE_FOOTER = +HIGHLIGHT_BIN = highlight # include user config -include ../config.mak.autogen @@ -129,7 +130,8 @@ GITWEB_REPLACE = \ -e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \ -e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \ -e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \ - -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' + -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \ + -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g' GITWEB-BUILD-OPTIONS: FORCE @rm -f $@+ -- cgit v1.2.3 From 958a8467216ca607ca6a24059d5c641347927333 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Sun, 26 Sep 2010 15:02:26 +0200 Subject: gitweb/Makefile: Add 'test' and 'test-installed' targets The 'test-installed' target in gitweb/Makefile tests installed gitweb, using the same destination directory that 'install' target uses. The 'test' target is just a convenience wrapper invoking 'gitweb-test' target of t/Makefile. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index 2fb7c2d77b..f2180741fc 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -143,6 +143,15 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS chmod +x $@+ && \ mv $@+ $@ +### Testing rules + +test: + $(MAKE) -C ../t gitweb-test + +test-installed: + GITWEB_TEST_INSTALLED='$(DESTDIR_SQ)$(gitwebdir_SQ)' \ + $(MAKE) -C ../t gitweb-test + ### Installation rules install: all @@ -156,5 +165,5 @@ install: all clean: $(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 test test-installed .FORCE-GIT-VERSION-FILE FORCE -- cgit v1.2.3 From 9b93aeb29cea16880926bc150ac31cfb31475a44 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Sun, 26 Sep 2010 15:02:24 +0200 Subject: gitweb/Makefile: Include gitweb/config.mak Allow for gitweb-specific Makefile config to reside in config.mak file in the 'gitweb/' subdirectory. This means that gitweb-specific build-time configuration variable can reside in gitweb-specific gitweb/config.mak Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index f2180741fc..df908a18eb 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -39,6 +39,7 @@ GITWEB_SITE_FOOTER = # include user config -include ../config.mak.autogen -include ../config.mak +-include config.mak # determine version ../GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE -- cgit v1.2.3 From 9a86dd571058a511e60af35206a31017d873e54a Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Thu, 28 Apr 2011 21:04:01 +0200 Subject: gitweb: Split JavaScript for maintability, combining on build Split originally single gitweb.js file into smaller files, each dealing with single issue / area of responsibility. This move should make gitweb's JavaScript code easier to maintain. For better webapp performance it is recommended[1][2][3] to combine JavaScript files. Do it during build time (in gitweb/Makefile), by straight concatenation of files into gitweb.js file (which is now ignored as being generated). This means that there are no changes to gitweb script itself - it still uses gitweb.js or gitweb.min.js, but now generated. [1]: http://developer.yahoo.com/performance/rules.html "Minimize HTTP Requests" section [2]: http://code.google.com/speed/articles/include-scripts-properly.html "1. Combine external JavaScript files" [3]: http://javascript-reference.info/speed-up-your-javascript-load-time.htm "Combine Your Files" section. See also new gitweb/static/js/README file. Inspired-by-patch-by: John 'Warthog9' Hawley Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/Makefile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index 0a6ac00631..0baa9df9f6 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -86,7 +86,7 @@ ifndef V endif endif -all:: gitweb.cgi +all:: gitweb.cgi static/gitweb.js GITWEB_PROGRAMS = gitweb.cgi @@ -112,6 +112,15 @@ endif GITWEB_FILES += static/git-logo.png static/git-favicon.png +# JavaScript files that are composed (concatenated) to form gitweb.js +# +# js/lib/common-lib.js should be always first, then js/lib/*.js, +# then the rest of files; js/gitweb.js should be last (if it exists) +GITWEB_JSLIB_FILES += static/js/lib/common-lib.js +GITWEB_JSLIB_FILES += static/js/javascript-detection.js +GITWEB_JSLIB_FILES += static/js/blame_incremental.js + + GITWEB_REPLACE = \ -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \ -e 's|++GIT_BINDIR++|$(bindir)|g' \ @@ -146,6 +155,11 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS chmod +x $@+ && \ mv $@+ $@ +static/gitweb.js: $(GITWEB_JSLIB_FILES) + $(QUIET_GEN)$(RM) $@ $@+ && \ + cat $^ >$@+ && \ + mv $@+ $@ + ### Testing rules test: -- cgit v1.2.3 From 54b1479a770b240d71bbd000fb40e470987bac59 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Thu, 28 Apr 2011 21:04:04 +0200 Subject: gitweb.js: Extract and improve datetime handling Move formatDateISOLocal(epoch, timezone) function (and also helper timezoneOffset(timezoneInfo) function it requires) from common-lib.js to datetime.js Add new functions: * localTimezoneOffset - to get browser timezone offset in seconds * localTimezoneInfo - to get browser timezone in '(+|-)HHMM' format * formatTimezoneInfo - turn offset in hours and minutes into '(+|-)HHMM' * parseRFC2822Date - to parse RFC-2822 dates that gitweb uses into epoch * formatDateRFC2882 - like formatDateISOLocal, only RFC-2822 format All those functions are meant to be used in future commit 'gitweb: javascript ability to adjust time based on timezone' An alternative would be to use e.g. Datejs (http://www.datejs.com) library, or JavaScript framework that has date formatting (perhaps as a plugin). While at it escape '-' in character class inside tzRe regexp, as recommended by JSLint (http://www.jslint.com). Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index 0baa9df9f6..403265a9b2 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -117,6 +117,7 @@ GITWEB_FILES += static/git-logo.png static/git-favicon.png # js/lib/common-lib.js should be always first, then js/lib/*.js, # then the rest of files; js/gitweb.js should be last (if it exists) GITWEB_JSLIB_FILES += static/js/lib/common-lib.js +GITWEB_JSLIB_FILES += static/js/lib/datetime.js GITWEB_JSLIB_FILES += static/js/javascript-detection.js GITWEB_JSLIB_FILES += static/js/blame_incremental.js -- cgit v1.2.3 From fcce886bfb4671c4c17a3f99cb7caf0f7ab94e16 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Thu, 28 Apr 2011 21:04:05 +0200 Subject: gitweb.js: Introduce code to handle cookies from JavaScript Introduced gitweb/static/js/cookies.js file provides functions for setting, getting and deleting cookies. Code taken from subsection "Cookies in JavaScript" of "Professional JavaScript for Web Developers" by Nicholas C. Zakas and from cookie plugin for jQuery (dual licensed under the MIT and GPL licenses). Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index 403265a9b2..7dd1dee55a 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -118,6 +118,7 @@ GITWEB_FILES += static/git-logo.png static/git-favicon.png # then the rest of files; js/gitweb.js should be last (if it exists) GITWEB_JSLIB_FILES += static/js/lib/common-lib.js GITWEB_JSLIB_FILES += static/js/lib/datetime.js +GITWEB_JSLIB_FILES += static/js/lib/cookies.js GITWEB_JSLIB_FILES += static/js/javascript-detection.js GITWEB_JSLIB_FILES += static/js/blame_incremental.js -- cgit v1.2.3 From 291e52bd19877dc8fdd77079ba4c4326f114c461 Mon Sep 17 00:00:00 2001 From: John 'Warthog9' Hawley Date: Thu, 28 Apr 2011 21:04:09 +0200 Subject: gitweb: JavaScript ability to adjust time based on timezone This patch is based on Kevin Cernekee's patch series entitled "gitweb: introduce localtime feature". While Kevin's patch changed the server side output so that the timezone was output from gitweb itself, this has a number of drawbacks, in particular with respect to gitweb-caching. This patch takes the same basic goal, display the appropriate times in a given common timezone, and implements it in JavaScript. This requires adding / using a new class, "datetime", to be able to find elements to be adjusted from JavaScript. Appropriate dates are wrapped in a span with this class. Timezone to be used can be retrieved from "gitweb_tz" cookie, though currently there is no way to set / manipulate this cookie from gitweb; this is left for later commit. Valid timezones, currently, are: "utc", "local" (which means that timezone is taken from browser), and "+/-ZZZZ" numeric timezone as in RFC-2822. Default timezone is "local" (currently not configurable, left for later commit). Fallback (should JavaScript not be enabled) is to treat dates as they have been and display them, only, in UTC. Pages affected: * 'summary' view, "last change" field (commit time from latest change) * 'log' view, author time * 'commit' and 'commitdiff' views, author/committer time * 'tag' view, tagger time Based-on-code-from: Kevin Cernekee Signed-off-by: John 'Warthog9' Hawley Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index 7dd1dee55a..5d20515fba 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -120,6 +120,7 @@ GITWEB_JSLIB_FILES += static/js/lib/common-lib.js GITWEB_JSLIB_FILES += static/js/lib/datetime.js GITWEB_JSLIB_FILES += static/js/lib/cookies.js GITWEB_JSLIB_FILES += static/js/javascript-detection.js +GITWEB_JSLIB_FILES += static/js/adjust-timezone.js GITWEB_JSLIB_FILES += static/js/blame_incremental.js -- cgit v1.2.3 From 131d6afcba657f9348031ee2e20f62d25d69ce7a Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Mon, 25 Jul 2011 00:29:18 +0200 Subject: gitweb: Introduce common system-wide settings for convenience Because of backward compatibility we cannot change gitweb to always use /etc/gitweb.conf (i.e. even if gitweb_config.perl exists). For common system-wide settings we therefore need separate configuration file: /etc/gitweb-common.conf. Long description: gitweb currently obtains configuration from the following sources: 1. per-instance configuration file (default: gitweb_conf.perl) 2. system-wide configuration file (default: /etc/gitweb.conf) If per-instance configuration file exists, then system-wide configuration is _not used at all_. This is quite untypical and suprising behavior. Moreover it is different from way git itself treats /etc/git.conf. It reads in stuff from /etc/git.conf and then local repos can change or override things as needed. In fact this is quite beneficial, because it gives site admins a simple and easy way to give an automatic hint to a repo about things the admin would like. On the other hand changing current behavior may lead to the situation, where something in /etc/gitweb.conf may interfere with unintended interaction in the local repository. One solution would be to _require_ to do explicit include; with read_config_file() it is now easy, as described in gitweb/README (description introduced in this commit). But as J.H. noticed we cannot ask people to modify their per-instance gitweb config file to include system-wide settings, nor we can require them to do this. Therefore, as proposed by Junio, for gitweb to have centralized config elements while retaining backwards compatibility, introduce separate common system-wide configuration file, by default /etc/gitweb-common.conf Noticed-by: Drew Northup Helped-by: John 'Warthog9' Hawley Inspired-by: Junio C Hamano Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gitweb/Makefile') diff --git a/gitweb/Makefile b/gitweb/Makefile index 5d20515fba..1c85b5fda8 100644 --- a/gitweb/Makefile +++ b/gitweb/Makefile @@ -20,6 +20,7 @@ INSTALL ?= install # default configuration for gitweb GITWEB_CONFIG = gitweb_config.perl GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf +GITWEB_CONFIG_COMMON = /etc/gitweb-common.conf GITWEB_HOME_LINK_STR = projects GITWEB_SITENAME = GITWEB_PROJECTROOT = /pub/git @@ -129,6 +130,7 @@ GITWEB_REPLACE = \ -e 's|++GIT_BINDIR++|$(bindir)|g' \ -e 's|++GITWEB_CONFIG++|$(GITWEB_CONFIG)|g' \ -e 's|++GITWEB_CONFIG_SYSTEM++|$(GITWEB_CONFIG_SYSTEM)|g' \ + -e 's|++GITWEB_CONFIG_COMMON++|$(GITWEB_CONFIG_COMMON)|g' \ -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \ -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \ -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \ -- cgit v1.2.3