Merge branch 'mr/gitweb-jsmin'
authorJunio C Hamano <gitster@pobox.com>
Sat, 10 Apr 2010 20:02:22 +0000 (13:02 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 10 Apr 2010 20:02:22 +0000 (13:02 -0700)
* mr/gitweb-jsmin:
gitweb: update INSTALL to use shorter make target
gitweb: add documentation to INSTALL regarding gitweb.js
instaweb: add minification awareness
Gitweb: add autoconfigure support for minifiers
Gitweb: add support for minifying gitweb.css
Gitweb: add ignore and clean rules for minified files

1  2 
Makefile
diff --combined Makefile
index 956e781622e732e3045b22776a761d4d95476a00,7aad43fd2482af434d5e67b30d289e1a5e1ffa0e..910f4713ef1491278500573bab2d00ee1925abb8
+++ b/Makefile
@@@ -34,7 -34,7 +34,7 @@@ all:
  # Define NO_D_INO_IN_DIRENT if you don't have d_ino in your struct dirent.
  #
  # Define NO_D_TYPE_IN_DIRENT if your platform defines DT_UNKNOWN but lacks
 -# d_type in struct dirent (latest Cygwin -- will be fixed soonish).
 +# d_type in struct dirent (Cygwin 1.5, fixed in Cygwin 1.7).
  #
  # Define NO_C99_FORMAT if your formatted IO functions (printf/scanf et.al.)
  # do not support the 'size specifiers' introduced by C99, namely ll, hh,
  # Define NO_PTHREADS if you do not have or do not want to use Pthreads.
  #
  # Define NO_PREAD if you have a problem with pread() system call (e.g.
 -# cygwin.dll before v1.5.22).
 +# cygwin1.dll before v1.5.22).
  #
  # Define NO_FAST_WORKING_DIRECTORY if accessing objects in pack files is
  # generally faster on your platform than accessing the working directory.
  # 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
+ #
  # Define DEFAULT_PAGER to a sensible pager command (defaults to "less") if
  # you want to use something different.  The value will be interpreted by the
  # shell at runtime when it is used.
@@@ -279,9 -282,6 +282,6 @@@ lib = li
  # DESTDIR=
  pathsep = :
  
- # JavaScript minifier invocation that can function as filter
- JSMIN =
  export prefix bindir sharedir sysconfdir
  
  CC = gcc
@@@ -831,24 -831,22 +831,24 @@@ ifeq ($(uname_S),SunOS
        BASIC_CFLAGS += -D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H
  endif
  ifeq ($(uname_O),Cygwin)
 -      NO_D_TYPE_IN_DIRENT = YesPlease
 -      NO_D_INO_IN_DIRENT = YesPlease
 -      NO_STRCASESTR = YesPlease
 -      NO_MEMMEM = YesPlease
 -      NO_MKSTEMPS = YesPlease
 -      NO_SYMLINK_HEAD = YesPlease
 +      ifeq ($(shell expr "$(uname_R)" : '1\.[1-6]\.'),4)
 +              NO_D_TYPE_IN_DIRENT = YesPlease
 +              NO_D_INO_IN_DIRENT = YesPlease
 +              NO_STRCASESTR = YesPlease
 +              NO_MEMMEM = YesPlease
 +              NO_MKSTEMPS = YesPlease
 +              NO_SYMLINK_HEAD = YesPlease
 +              NO_IPV6 = YesPlease
 +              OLD_ICONV = UnfortunatelyYes
 +      endif
        NEEDS_LIBICONV = YesPlease
        NO_FAST_WORKING_DIRECTORY = UnfortunatelyYes
        NO_TRUSTABLE_FILEMODE = UnfortunatelyYes
 -      OLD_ICONV = UnfortunatelyYes
        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
        # There are conflicting reports about this.
        # On some boxes NO_MMAP is needed, and not so elsewhere.
        # Try commenting this out if you suspect MMAP is more efficient
        NO_MMAP = YesPlease
 -      NO_IPV6 = YesPlease
        X = .exe
        COMPAT_OBJS += compat/cygwin.o
        UNRELIABLE_FSTAT = UnfortunatelyYes
@@@ -866,7 -864,6 +866,7 @@@ ifeq ($(uname_S),FreeBSD
                NO_UINTMAX_T = YesPlease
                NO_STRTOUMAX = YesPlease
        endif
 +      PYTHON_PATH = /usr/local/bin/python
  endif
  ifeq ($(uname_S),OpenBSD)
        NO_STRCASESTR = YesPlease
@@@ -922,6 -919,7 +922,6 @@@ ifeq ($(uname_S),IRIX
        SNPRINTF_RETURNS_BOGUS = YesPlease
        SHELL_PATH = /usr/gnu/bin/bash
        NEEDS_LIBGEN = YesPlease
 -      NEEDS_LIBICONV = YesPlease
  endif
  ifeq ($(uname_S),IRIX64)
        NO_SETENV=YesPlease
        SNPRINTF_RETURNS_BOGUS = YesPlease
        SHELL_PATH=/usr/gnu/bin/bash
        NEEDS_LIBGEN = YesPlease
 -      NEEDS_LIBICONV = YesPlease
  endif
  ifeq ($(uname_S),HP-UX)
        NO_IPV6=YesPlease
@@@ -1479,7 -1478,7 +1479,7 @@@ endi
  ifndef NO_PYTHON
        $(QUIET_SUBDIR0)git_remote_helpers $(QUIET_SUBDIR1) PYTHON_PATH='$(PYTHON_PATH_SQ)' prefix='$(prefix_SQ)' all
  endif
 -      $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1)
 +      $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) SHELL_PATH='$(SHELL_PATH_SQ)' PERL_PATH='$(PERL_PATH_SQ)'
  
  please_set_SHELL_PATH_to_a_more_modern_shell:
        @$$(:)
@@@ -1561,18 -1560,29 +1561,29 @@@ gitweb
        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) all
  
  ifdef JSMIN
OTHER_PROGRAMS += gitweb/gitweb.cgi   gitweb/gitweb.min.js
gitweb/gitweb.cgi: gitweb/gitweb.perl gitweb/gitweb.min.js
GITWEB_PROGRAMS += gitweb/gitweb.min.js
GITWEB_JS = gitweb/gitweb.min.js
  else
- OTHER_PROGRAMS += gitweb/gitweb.cgi
- gitweb/gitweb.cgi: gitweb/gitweb.perl
+ GITWEB_JS = gitweb/gitweb.js
  endif
+ ifdef CSSMIN
+ GITWEB_PROGRAMS += gitweb/gitweb.min.css
+ GITWEB_CSS = gitweb/gitweb.min.css
+ else
+ GITWEB_CSS = gitweb/gitweb.css
+ endif
+ OTHER_PROGRAMS +=  gitweb/gitweb.cgi  $(GITWEB_PROGRAMS)
+ gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)
        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
  
  ifdef JSMIN
  gitweb/gitweb.min.js: gitweb/gitweb.js
        $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
  endif # JSMIN
+ ifdef CSSMIN
+ gitweb/gitweb.min.css: gitweb/gitweb.css
+       $(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)
+ endif # CSSMIN
  
  
  git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js
            -e 's/@@NO_CURL@@/$(NO_CURL)/g' \
            -e '/@@GITWEB_CGI@@/r gitweb/gitweb.cgi' \
            -e '/@@GITWEB_CGI@@/d' \
-           -e '/@@GITWEB_CSS@@/r gitweb/gitweb.css' \
+           -e '/@@GITWEB_CSS@@/r $(GITWEB_CSS)' \
            -e '/@@GITWEB_CSS@@/d' \
-           -e '/@@GITWEB_JS@@/r gitweb/gitweb.js' \
+           -e '/@@GITWEB_JS@@/r $(GITWEB_JS)' \
            -e '/@@GITWEB_JS@@/d' \
            -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \
+             -e 's|@@GITWEB_CSS_NAME@@|$(GITWEB_CSS)|' \
+             -e 's|@@GITWEB_JS_NAME@@|$(GITWEB_JS)|' \
            $@.sh > $@+ && \
        chmod +x $@+ && \
        mv $@+ $@
@@@ -1612,8 -1624,9 +1625,8 @@@ $(patsubst %.py,%,$(SCRIPT_PYTHON)): % 
            -e '}' \
            -e 's|^import sys.*|&; \\\
                   import os; \\\
 -                 sys.path[0] = os.environ.has_key("GITPYTHONLIB") and \\\
 -                               os.environ["GITPYTHONLIB"] or \\\
 -                               "@@INSTLIBDIR@@"|' \
 +                 sys.path.insert(0, os.getenv("GITPYTHONLIB",\
 +                                              "@@INSTLIBDIR@@"));|' \
            -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
            $@.py >$@+ && \
        chmod +x $@+ && \
@@@ -2085,7 -2098,7 +2098,7 @@@ clean
        $(RM) $(htmldocs).tar.gz $(manpages).tar.gz
        $(MAKE) -C Documentation/ clean
  ifndef NO_PERL
-       $(RM) gitweb/gitweb.cgi
+       $(RM) gitweb/gitweb.cgi gitweb/gitweb.min.*
        $(MAKE) -C perl clean
  endif
  ifndef NO_PYTHON