Skip to content

Commit 14b8512

Browse files
committed
Merge branch 'jn/gitweb-install'
* jn/gitweb-install: gitweb: Create install target for gitweb in Makefile gitweb: Improve installation instructions in gitweb/INSTALL
2 parents 71f1d72 + 152d943 commit 14b8512

File tree

3 files changed

+41
-12
lines changed

3 files changed

+41
-12
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,6 +2016,9 @@ endif
20162016
done; } && \
20172017
./check_bindir "z$$bindir" "z$$execdir" "$$bindir/git-add$X"
20182018

2019+
install-gitweb:
2020+
$(MAKE) -C gitweb install
2021+
20192022
install-doc:
20202023
$(MAKE) -C Documentation install
20212024

gitweb/INSTALL

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ First you have to generate gitweb.cgi from gitweb.perl using
66
gitweb.css, git-logo.png and git-favicon.png) to their destination.
77
For example if git was (or is) installed with /usr prefix, you can do
88

9-
$ make prefix=/usr gitweb ;# as yourself
10-
# cp gitweb/git* /var/www/cgi-bin/ ;# as root
9+
$ make prefix=/usr gitweb ;# as yourself
10+
# make gitwebdir=/var/www/cgi-bin install-gitweb ;# as root
1111

1212
Alternatively you can use autoconf generated ./configure script to
1313
set up path to git binaries (via config.mak.autogen), so you can write
@@ -16,7 +16,8 @@ instead
1616
$ make configure ;# as yourself
1717
$ ./configure --prefix=/usr ;# as yourself
1818
$ make gitweb ;# as yourself
19-
# cp gitweb/git* /var/www/cgi-bin/ ;# as root
19+
# make gitwebdir=/var/www/cgi-bin \
20+
install-gitweb ;# as root
2021

2122
The above example assumes that your web server is configured to run
2223
[executable] files in /var/www/cgi-bin/ as server scripts (as CGI
@@ -74,9 +75,10 @@ file for gitweb (in gitweb/README).
7475
Build example
7576
~~~~~~~~~~~~~
7677

77-
- To install gitweb to /var/www/cgi-bin/gitweb/ when git wrapper
78-
is installed at /usr/local/bin/git and the repositories (projects)
79-
we want to display are under /home/local/scm, you can do
78+
- To install gitweb to /var/www/cgi-bin/gitweb/, when git wrapper
79+
is installed at /usr/local/bin/git, the repositories (projects)
80+
we want to display are under /home/local/scm, and you do not use
81+
minifiers, you can do
8082

8183
make GITWEB_PROJECTROOT="/home/local/scm" \
8284
GITWEB_JS="/gitweb/gitweb.js" \
@@ -86,8 +88,8 @@ Build example
8688
bindir=/usr/local/bin \
8789
gitweb
8890

89-
cp -fv ~/git/gitweb/gitweb.{cgi,js,css} \
90-
~/git/gitweb/git-{favicon,logo}.png \
91+
cp -fv gitweb/gitweb.{cgi,js,css} \
92+
gitweb/git-{favicon,logo}.png \
9193
/var/www/cgi-bin/gitweb/
9294

9395

gitweb/Makefile

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ all::
1212

1313
prefix ?= $(HOME)
1414
bindir ?= $(prefix)/bin
15+
gitwebdir ?= /var/www/cgi-bin
16+
1517
RM ?= rm -f
18+
INSTALL ?= install
1619

1720
# default configuration for gitweb
1821
GITWEB_CONFIG = gitweb_config.perl
@@ -49,9 +52,11 @@ SHELL_PATH ?= $(SHELL)
4952
PERL_PATH ?= /usr/bin/perl
5053

5154
# 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))#'
5560

5661
# Quiet generation (unless V=1)
5762
QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
@@ -80,20 +85,30 @@ endif
8085

8186
all:: gitweb.cgi
8287

88+
GITWEB_PROGRAMS = gitweb.cgi
89+
8390
ifdef JSMIN
91+
GITWEB_FILES += gitweb.min.js
8492
GITWEB_JS = gitweb.min.js
8593
all:: gitweb.min.js
8694
gitweb.min.js: gitweb.js GITWEB-BUILD-OPTIONS
8795
$(QUIET_GEN)$(JSMIN) <$< >$@
96+
else
97+
GITWEB_FILES += gitweb.js
8898
endif
8999

90100
ifdef CSSMIN
101+
GITWEB_FILES += gitweb.min.css
91102
GITWEB_CSS = gitweb.min.css
92103
all:: gitweb.min.css
93104
gitweb.min.css: gitweb.css GITWEB-BUILD-OPTIONS
94105
$(QUIET_GEN)$(CSSMIN) <$ >$@
106+
else
107+
GITWEB_FILES += gitweb.css
95108
endif
96109

110+
GITWEB_FILES += git-logo.png git-favicon.png
111+
97112
GITWEB_REPLACE = \
98113
-e 's|++GIT_VERSION++|$(GIT_VERSION)|g' \
99114
-e 's|++GIT_BINDIR++|$(bindir)|g' \
@@ -127,8 +142,17 @@ gitweb.cgi: gitweb.perl GITWEB-BUILD-OPTIONS
127142
chmod +x $@+ && \
128143
mv $@+ $@
129144

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+
130154
clean:
131155
$(RM) gitweb.cgi gitweb.min.js gitweb.min.css GITWEB-BUILD-OPTIONS
132156

133-
.PHONY: all clean .FORCE-GIT-VERSION-FILE FORCE
157+
.PHONY: all clean install .FORCE-GIT-VERSION-FILE FORCE
134158

0 commit comments

Comments
 (0)