Add support for prefix and gitsrc arguments to 'make'

This should improve the installation a little, especially since the new
options are mentioned in the README. Also, add a make-rule to build the
git binaries if necessary + a dependency between cgit and libgit.a.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
This commit is contained in:
Lars Hjemli 2007-02-04 23:57:34 +01:00
parent 74b0db9556
commit c52e84135e
2 changed files with 37 additions and 15 deletions

View File

@ -1,9 +1,10 @@
CGIT_VERSION = 0.1 CGIT_VERSION = 0.1
INSTALL_DIR = /var/www/htdocs/cgit prefix = /var/www/htdocs/cgit
CACHE_ROOT = /var/cache/cgit gitsrc = ../git
EXTLIBS = ../git/libgit.a ../git/xdiff/lib.a -lz -lcrypto CACHE_ROOT = /var/cache/cgit
EXTLIBS = $(gitsrc)/libgit.a $(gitsrc)/xdiff/lib.a -lz -lcrypto
OBJECTS = shared.o cache.o parsing.o html.o ui-shared.o ui-repolist.o \ OBJECTS = shared.o cache.o parsing.o html.o ui-shared.o ui-repolist.o \
ui-summary.o ui-log.o ui-view.c ui-tree.c ui-commit.c ui-diff.o ui-summary.o ui-log.o ui-view.c ui-tree.c ui-commit.c ui-diff.o
@ -16,10 +17,11 @@ endif
all: cgit all: cgit
install: all clean-cache install: all clean-cache
install cgit $(INSTALL_DIR)/cgit.cgi mkdir -p $(prefix)
install cgit.css $(INSTALL_DIR)/cgit.css install cgit $(prefix)/cgit.cgi
install cgit.css $(prefix)/cgit.css
cgit: cgit.c cgit.h git.h $(OBJECTS) cgit: cgit.c cgit.h git.h $(OBJECTS) $(gitsrc)/libgit.a
$(CC) $(CFLAGS) -DCGIT_VERSION='"$(CGIT_VERSION)"' cgit.c -o cgit \ $(CC) $(CFLAGS) -DCGIT_VERSION='"$(CGIT_VERSION)"' cgit.c -o cgit \
$(OBJECTS) $(EXTLIBS) $(OBJECTS) $(EXTLIBS)
@ -27,6 +29,10 @@ $(OBJECTS): cgit.h git.h
ui-diff.o: xdiff.h ui-diff.o: xdiff.h
$(gitsrc)/libgit.a:
$(MAKE) -C $(gitsrc)
.PHONY: clean .PHONY: clean
clean: clean:
rm -f cgit *.o rm -f cgit *.o

34
README
View File

@ -8,20 +8,36 @@ builtin cache to decrease server io-pressure.
Installation Installation
$ $EDITOR Makefile $ make gitsrc=<path>
$ make $ su
$ sudo make install $ make prefix=<path> install
Note: cgit requires the git and xdiff libraries. Currently, the makefile
expects these files to be found in '../git/libgit.a' and '../git/xdiff/lib.a', Default value for gitsrc is "../git", and this directory should contain the
where they will be if you have built git from source in a parallell directory. git sources.
Default value for prefix is "/var/www/htdocs/cgit". This directory will
contain "cgit.cgi" and "cgit.css" after 'make install'.
After installation, httpd.conf probably must be updated with a Directory-
section for cgit, possibly something like this:
<Directory "/var/www/htdocs/cgit/">
AllowOverride None
Options ExecCGI
Order allow,deny
Allow from all
</Directory>
Runtime configuration Runtime configuration
The file /etc/cgitrc is read by cgit before handling a request. A template The file /etc/cgitrc is read by cgit before handling a request. In addition
cgitrc is shipped with the sources, and all parameters and default values to runtime parameters, this file also contains a list of the repositories
can be found in this file. displayed by cgit.
A template cgitrc is shipped with the sources, and all parameters and default
values are documented in this file.
The cache The cache