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 <cwilson@cdwilson.us> Acked-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Christopher Wilson committed
Sep 21, 2010 at 00:25 UTC
7ce896b3000a7bd2ea24f02ad3051f43ad351e1f
3 files changed
+21
-3
gitweb/Makefile
+3
-1
@@ -35,6 +35,7 @@ GITWEB_FAVICON = static/git-favicon.png
35
GITWEB_JS = static/gitweb.js
36
GITWEB_SITE_HEADER =
37
GITWEB_SITE_FOOTER =
38
+HIGHLIGHT_BIN = highlight
39
40
# include user config
41
-include ../config.mak.autogen
@@ -129,7 +130,8 @@ GITWEB_REPLACE = \
130
-e 's|++GITWEB_FAVICON++|$(GITWEB_FAVICON)|g' \
131
-e 's|++GITWEB_JS++|$(GITWEB_JS)|g' \
132
-e 's|++GITWEB_SITE_HEADER++|$(GITWEB_SITE_HEADER)|g' \
132
- -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g'
133
+ -e 's|++GITWEB_SITE_FOOTER++|$(GITWEB_SITE_FOOTER)|g' \
134
+ -e 's|++HIGHLIGHT_BIN++|$(HIGHLIGHT_BIN)|g'
135
136
GITWEB-BUILD-OPTIONS: FORCE
137
@rm -f $@+
gitweb/README
+10
-1
@@ -114,6 +114,11 @@ You can specify the following configuration variables when building GIT:
114
when gitweb.cgi is executed, then the file specified in the environment
115
variable will be loaded instead of the file specified when gitweb.cgi was
116
created. [Default: /etc/gitweb.conf]
117
+ * HIGHLIGHT_BIN
118
+ Path to the highlight executable to use (must be the one from
119
+ http://www.andre-simon.de due to assumptions about parameters and output).
120
+ Useful if highlight is not installed on your webserver's PATH.
121
+ [Default: highlight]
122
123
124
Runtime gitweb configuration
@@ -236,7 +241,11 @@ not include variables usually directly set during build):
241
If server load exceed this value then return "503 Service Unavailable" error.
242
Server load is taken to be 0 if gitweb cannot determine its value. Set it to
243
undefined value to turn it off. The default is 300.
239
-
244
+ * $highlight_bin
245
+ Path to the highlight executable to use (must be the one from
246
+ http://www.andre-simon.de due to assumptions about parameters and output).
247
+ Useful if highlight is not installed on your webserver's PATH.
248
+ [Default: highlight]
249
250
Projects list file format
251
~~~~~~~~~~~~~~~~~~~~~~~~~
gitweb/gitweb.perl
+8
-1
@@ -165,6 +165,12 @@ our @diff_opts = ('-M'); # taken from git_commit
165
# the gitweb domain.
166
our $prevent_xss = 0;
167
168
+# Path to the highlight executable to use (must be the one from
169
+# http://www.andre-simon.de due to assumptions about parameters and output).
170
+# Useful if highlight is not installed on your webserver's PATH.
171
+# [Default: highlight]
172
+our $highlight_bin = "++HIGHLIGHT_BIN++";
173
+
174
# information about snapshot formats that gitweb is capable of serving
175
our %known_snapshot_formats = (
176
# name => {
@@ -3360,7 +3366,8 @@ sub run_highlighter {
3366
close $fd
3367
or die_error(404, "Reading blob failed");
3368
open $fd, quote_command(git_cmd(), "cat-file", "blob", $hash)." | ".
3363
- "highlight --xhtml --fragment --syntax $syntax |"
3369
+ quote_command($highlight_bin).
3370
+ " --xhtml --fragment --syntax $syntax |"
3371
or die_error(500, "Couldn't open file or run syntax highlighter");
3372
return $fd;
3373
}