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 <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jakub Narebski committed
May 1, 2010 at 22:36 UTC
152d94348f6a38eb7cb5f4af8397f51ba06ddffb
3 files changed
+35
-11
Makefile
+3
@@ -2004,6 +2004,9 @@ endif
2004
done; } && \
2005
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
2006
2007
+install-gitweb:
2008
+ $(MAKE) -C gitweb install
2009
+
2010
install-doc:
2011
$(MAKE) -C Documentation install
2012
gitweb/INSTALL
+4
-7
@@ -6,10 +6,8 @@ First you have to generate gitweb.cgi from gitweb.perl using
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
8
9
- $ make prefix=/usr gitweb ;# as yourself
10
- # cp gitweb/*.cgi gitweb/*.css \
11
- gitweb/*.js gitweb/*.png \
12
- /var/www/cgi-bin/ ;# as root
9
+ $ make prefix=/usr gitweb ;# as yourself
10
+ # make gitwebdir=/var/www/cgi-bin install-gitweb ;# as root
11
12
Alternatively you can use autoconf generated ./configure script to
13
set up path to git binaries (via config.mak.autogen), so you can write
@@ -18,9 +16,8 @@ instead
16
$ make configure ;# as yourself
17
$ ./configure --prefix=/usr ;# as yourself
18
$ make gitweb ;# as yourself
21
- # cp gitweb/*.cgi gitweb/*.css \
22
- gitweb/*.js gitweb/*.png \
23
- /var/www/cgi-bin/ ;# as root
19
+ # make gitwebdir=/var/www/cgi-bin \
20
+ install-gitweb ;# as root
21
22
The above example assumes that your web server is configured to run
23
[executable] files in /var/www/cgi-bin/ as server scripts (as CGI
gitweb/Makefile
+28
-4
@@ -12,7 +12,10 @@ all::
12
13
prefix ?= $(HOME)
14
bindir ?= $(prefix)/bin
15
+gitwebdir ?= /var/www/cgi-bin
16
+
17
RM ?= rm -f
18
+INSTALL ?= install
19
20
# default configuration for gitweb
21
GITWEB_CONFIG = gitweb_config.perl
@@ -49,9 +52,11 @@ SHELL_PATH ?= $(SHELL)
52
PERL_PATH ?= /usr/bin/perl
53
54
# Shell quote;
52
-bindir_SQ = $(subst ','\'',$(bindir)) #'
53
-SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) #'
54
-PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) #'
55
+bindir_SQ = $(subst ','\'',$(bindir))#'
56
+gitwebdir_SQ = $(subst ','\'',$(gitwebdir))#'
57
+SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))#'
58
+PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))#'
59
+DESTDIR_SQ = $(subst ','\'',$(DESTDIR))#'
60
61
# Quiet generation (unless V=1)
62
QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
@@ -80,20 +85,30 @@ endif
85
86
all:: gitweb.cgi
87
88
+GITWEB_PROGRAMS = gitweb.cgi
89
+
90
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
95
$(QUIET_GEN)$(JSMIN) <$< >$@
96
+else
97
+GITWEB_FILES += gitweb.js
98
endif
99
100
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
105
$(QUIET_GEN)$(CSSMIN) <$ >$@
106
+else
107
+GITWEB_FILES += gitweb.css
108
endif
109
110
+GITWEB_FILES += git-logo.png git-favicon.png
111
+
112
GITWEB_REPLACE = \
113
-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
114
-e 's|++GIT_BINDIR++|$(bindir)|g' \
@@ -127,8 +142,17 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS
142
chmod +x $@+ && \
143
mv $@+ $@
144
145
+### Installation rules
146
+
147
+install: all
148
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(gitwebdir_SQ)'
149
+ $(INSTALL) -m 755 $(GITWEB_PROGRAMS) '$(DESTDIR_SQ)$(gitwebdir_SQ)'
150
+ $(INSTALL) -m 644 $(GITWEB_FILES) '$(DESTDIR_SQ)$(gitwebdir_SQ)'
151
+
152
+### Cleaning rules
153
+
154
clean:
155
$(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS
156
133
-.PHONY: all clean .FORCE-GIT-VERSION-FILE FORCE
157
+.PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE
158