{"thread":{"id":"23102","subject":"[PATCHv3] gitweb: fill in missing parts of JavaScript minify support","startedAt":"2010-03-20T04:29:19Z","lastAt":"2015-12-07T07:42:03Z","messageCount":3,"participants":["Mark Rada","Junio C Hamano","mikelilin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"137302","messageId":"4BA44F1F.9030008@mailservices.uwaterloo.ca","threadId":"23102","inReplyTo":null,"subject":"[PATCHv3] gitweb: fill in missing parts of JavaScript minify support","fromName":"Mark Rada","fromEmail":"marada@uwaterloo.ca","sentAt":"2010-03-20T04:29:19Z","receivedAt":"2010-03-20T04:29:19Z","isPatch":false,"sender":{"key":"marada@uwaterloo.ca","avatar":"https://avatars.githubusercontent.com/u/38430?v=4"},"body":"\nJavaScript minification was added to the git build system, but it was a\nhidden away feature that did not play by all the rules.\n\nThis patch adds an ignore and clean rule to take care of minified\nfiles belonging to gitweb. It also updates the gitweb INSTALL file to\nmention the JavaScript usage and optional minification.\n\nTo make minification more accessible, a configure option is added to\nenable minification without making the user edit the Makefiles directly.\n\nSigned-off-by: Mark Rada <marada@uwaterloo.ca>\n\n---\n\nThis patch was named \"Add ignore and clean rules for gitweb.min.js\"\npreviously, but now I've squashed other stuff into it.\n\nChanges since previous versions:\n\t- Changed patch name and added a commit message\n\t- Made ignore and clean rule use globs to be more\n\t  future friendly (other minified files)\n\t- Added configure script support for JSMIN\n\t- Added gitweb/INSTALL updates related to gitweb.js\n\t- Compacted Makefile code related to gitweb building\n\t  specifically related to gitweb.min.js generation\n\nNothing related to gitweb or git-instaweb breaks for me with\nJSMIN enabled or disabled, but I'm not sure if I broke portability\nby taking things out of the root level Makefile, there just\nseemed to be a lot of redundant information there that was\nhandled by the Makefile in the gitweb directory.\n\n\n .gitignore      |    1 +\n Makefile        |   11 ++---------\n configure.ac    |   10 ++++++++++\n gitweb/INSTALL  |   25 ++++++++++++++++---------\n gitweb/Makefile |   21 ++++++---------------\n 5 files changed, 35 insertions(+), 33 deletions(-)\n\ndiff --git a/.gitignore b/.gitignore\nindex 7b3acb7..4c24152 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -156,6 +156,7 @@\n /git-core-*/?*\n /gitk-git/gitk-wish\n /gitweb/gitweb.cgi\n+/gitweb/gitweb.min.*\n /test-chmtime\n /test-ctype\n /test-date\ndiff --git a/Makefile b/Makefile\nindex f80b25e..58f2cc3 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -279,8 +279,6 @@ lib = lib\n # DESTDIR=\n pathsep = :\n \n-# JavaScript minifier invocation that can function as filter\n-JSMIN =\n \n export prefix bindir sharedir sysconfdir\n \n@@ -1556,14 +1554,9 @@ else\n GITWEB_JS=gitweb/gitweb.js\n endif\n OTHER_PROGRAMS += gitweb/gitweb.cgi $(GITWEB_JS)\n-gitweb/gitweb.cgi: gitweb/gitweb.perl $(GITWEB_PROGRAMS)\n+gitweb/gitweb.cgi:\n \t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n \n-ifdef JSMIN\n-gitweb/gitweb.min.js: gitweb/gitweb.js\n-\t$(QUIET_SUBDIR0)gitweb $(QUIET_SUBDIR1) $(patsubst gitweb/%,%,$@)\n-endif # JSMIN\n-\n \n git-instaweb: git-instaweb.sh gitweb/gitweb.cgi gitweb/gitweb.css gitweb/gitweb.js\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n@@ -2077,7 +2070,7 @@ clean:\n \t$(RM) $(htmldocs).tar.gz $(manpages).tar.gz\n \t$(MAKE) -C Documentation/ clean\n ifndef NO_PERL\n-\t$(RM) gitweb/gitweb.cgi\n+\t$(RM) gitweb/{gitweb.cgi,gitweb.min.*}\n \t$(MAKE) -C perl clean\n endif\n ifndef NO_PYTHON\ndiff --git a/configure.ac b/configure.ac\nindex 914ae57..59e7b9e 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -179,6 +179,16 @@ fi],\n    AC_MSG_NOTICE([Will try -pthread then -lpthread to enable POSIX Threads.])\n ])\n \n+# Define option to enable JavaScript minification\n+AC_ARG_ENABLE([jsmin],\n+ [AS_HELP_STRING([--enable-jsmin=ARG],\n+   [ARG is the value to pass to make to enable JavaScript minification.])],\n+ [\n+   JSMIN=$enableval;\n+   AC_MSG_NOTICE([Setting JSMIN to '$JSMIN' to enable JavaScript minifying])\n+   GIT_CONF_APPEND_LINE(JSMIN=$enableval);\n+ ])\n+\n ## Site configuration (override autodetection)\n ## --with-PACKAGE[=ARG] and --without-PACKAGE\n AC_MSG_NOTICE([CHECKS for site configuration])\ndiff --git a/gitweb/INSTALL b/gitweb/INSTALL\nindex b76a0cf..8383106 100644\n--- a/gitweb/INSTALL\n+++ b/gitweb/INSTALL\n@@ -2,11 +2,11 @@ GIT web Interface (gitweb) Installation\n =======================================\n \n First you have to generate gitweb.cgi from gitweb.perl using\n-\"make gitweb/gitweb.cgi\", then copy appropriate files (gitweb.cgi,\n-gitweb.css, git-logo.png and git-favicon.png) to their destination.\n+\"make gitweb\", then copy appropriate files (gitweb.cgi, gitweb.js,\n+gitweb.css, git-logo.png and git-favicon.png) to to their destination.\n For example if git was (or is) installed with /usr prefix, you can do\n \n-\t$ make prefix=/usr gitweb/gitweb.cgi  ;# as yourself\n+\t$ make prefix=/usr gitweb             ;# as yourself\n \t# cp gitweb/git* /var/www/cgi-bin/    ;# as root\n \n Alternatively you can use autoconf generated ./configure script to\n@@ -15,7 +15,7 @@ instead\n \n \t$ make configure                     ;# as yourself\n \t$ ./configure --prefix=/usr          ;# as yourself\n-\t$ make gitweb/gitweb.cgi             ;# as yourself\n+\t$ make gitweb                        ;# as yourself\n \t# cp gitweb/git* /var/www/cgi-bin/   ;# as root\n \n The above example assumes that your web server is configured to run\n@@ -61,10 +61,16 @@ file for gitweb (in gitweb/README).\n   projectroot linking to projectname/.git (but it is just\n   a suggestion).\n \n-- You can control where gitweb tries to find its main CSS style file,\n-  its favicon and logo with the GITWEB_CSS, GITWEB_FAVICON and GITWEB_LOGO\n-  build configuration variables. By default gitweb tries to find them\n-  in the same directory as gitweb.cgi script.\n+- You can control where gitweb tries to find its main JavaScript file,\n+  CSS file, favicon and logo with the GITWEB_JS, GITWEB_CSS,\n+  GITWEB_FAVICON and GITWEB_LOGO build configuration variables. By default\n+  gitweb tries to find them in the same directory as gitweb.cgi script.\n+\n+- You can generate a minified version of gitweb.js and at build\n+  time by setting the JSMIN variable to the full path of a JavaScript\n+  minifier or using the --enable-jsmin=/PATH/TO/MINIFIER configure script\n+  flag. NOTE: substitue gitweb.min.js for all use of gitweb.js in this\n+  INSTALL file if you choose to use this option.\n \n Build example\n ~~~~~~~~~~~~~\n@@ -74,13 +80,14 @@ Build example\n   we want to display are under /home/local/scm, you can do\n \n \tmake GITWEB_PROJECTROOT=\"/home/local/scm\" \\\n+             GITWEB_JS=\"/gitweb/gitweb.js\" \\\n \t     GITWEB_CSS=\"/gitweb/gitweb.css\" \\\n \t     GITWEB_LOGO=\"/gitweb/git-logo.png\" \\\n \t     GITWEB_FAVICON=\"/gitweb/git-favicon.png\" \\\n \t     bindir=/usr/local/bin \\\n \t     gitweb/gitweb.cgi\n \n-\tcp -fv ~/git/gitweb/gitweb.{cgi,css} \\\n+\tcp -fv ~/git/gitweb/gitweb.{.js,cgi,css} \\\n \t       ~/git/gitweb/git-{favicon,logo}.png \\\n \t     /var/www/cgi-bin/gitweb/\n \ndiff --git a/gitweb/Makefile b/gitweb/Makefile\nindex c9eb1ee..edff9fd 100644\n--- a/gitweb/Makefile\n+++ b/gitweb/Makefile\n@@ -11,9 +11,6 @@ prefix ?= $(HOME)\n bindir ?= $(prefix)/bin\n RM ?= rm -f\n \n-# JavaScript minifier invocation that can function as filter\n-JSMIN ?=\n-\n # default configuration for gitweb\n GITWEB_CONFIG = gitweb_config.perl\n GITWEB_CONFIG_SYSTEM = /etc/gitweb.conf\n@@ -29,11 +26,7 @@ GITWEB_HOMETEXT = indextext.html\n GITWEB_CSS = gitweb.css\n GITWEB_LOGO = git-logo.png\n GITWEB_FAVICON = git-favicon.png\n-ifdef JSMIN\n-GITWEB_JS = gitweb.min.js\n-else\n GITWEB_JS = gitweb.js\n-endif\n GITWEB_SITE_HEADER =\n GITWEB_SITE_FOOTER =\n \n@@ -84,15 +77,13 @@ endif\n \n all:: gitweb.cgi\n \n+FILES=gitweb.cgi gitweb.min*\n+\n ifdef JSMIN\n-FILES=gitweb.cgi gitweb.min.js\n-gitweb.cgi: gitweb.perl gitweb.min.js\n-else # !JSMIN\n-FILES=gitweb.cgi\n-gitweb.cgi: gitweb.perl\n-endif # JSMIN\n+GITWEB_JS = gitweb.min.js\n+endif\n \n-gitweb.cgi:\n+gitweb.cgi: gitweb.perl $(GITWEB_JS)\n \t$(QUIET_GEN)$(RM) $@ $@+ && \\\n \tsed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|' \\\n \t    -e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \\\n-- \n1.7.0.2.279.gf1ba1c\n"},{"id":"137339","messageId":"7vbpejovg4.fsf@alter.siamese.dyndns.org","threadId":"23102","inReplyTo":"4BA44F1F.9030008@mailservices.uwaterloo.ca","subject":"Re: [PATCHv3] gitweb: fill in missing parts of JavaScript minify support","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-20T15:37:47Z","receivedAt":"2010-03-20T15:37:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mark Rada <marada@uwaterloo.ca> writes:\n\n> This patch was named \"Add ignore and clean rules for gitweb.min.js\"\n> previously, but now I've squashed other stuff into it.\n> ...\n> @@ -1556,14 +1554,9 @@ else\n>  GITWEB_JS=gitweb/gitweb.js\n\nPatch does not apply; no version of Makefile I have has this line in it.\n"},{"id":"274103","messageId":"1449474123548-7643775.post@n2.nabble.com","threadId":"23102","inReplyTo":"4BA44F1F.9030008@mailservices.uwaterloo.ca","subject":"Re: [PATCHv3] gitweb: fill in missing parts of JavaScript minify support","fromName":"mikelilin","fromEmail":"zbin1986@gmail.com","sentAt":"2015-12-07T07:42:03Z","receivedAt":"2015-12-07T07:42:03Z","isPatch":false,"sender":{"key":"zbin1986@gmail.com","avatar":null},"body":"i find a free online tool to  minify javascript\n<http://www.online-code.net/minify-js.html>  .\n\n\n\n\n--\nView this message in context: http://git.661346.n2.nabble.com/PATCHv3-gitweb-fill-in-missing-parts-of-JavaScript-minify-support-tp4767036p7643775.html\nSent from the git mailing list archive at Nabble.com.\n"}]}