summaryrefslogtreecommitdiffabout
authorMikhail Gusarov <dottedmag@dottedmag.net>2009-10-28 21:39:55 (UTC)
committer Lars Hjemli <hjemli@gmail.com>2009-11-07 15:23:19 (UTC)
commit59310ab102a448d90c337b3b138dd53681d8097e (patch) (unidiff)
tree6b2d1aa00ed31247bf06b87722a35b1f75ceb093
parent4b1fee00ddfbb7bfb48f85bef49b5aff928d0f2e (diff)
downloadcgit-59310ab102a448d90c337b3b138dd53681d8097e.zip
cgit-59310ab102a448d90c337b3b138dd53681d8097e.tar.gz
cgit-59310ab102a448d90c337b3b138dd53681d8097e.tar.bz2
Add NO_OPENSSL option
Linking with OpenSSL is not always desirable. Add NO_OPENSSL option to use SHA-1 code bundled with Git. Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 60d8c58..4e101d3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,171 +1,180 @@
1CGIT_VERSION = v0.8.3 1CGIT_VERSION = v0.8.3
2CGIT_SCRIPT_NAME = cgit.cgi 2CGIT_SCRIPT_NAME = cgit.cgi
3CGIT_SCRIPT_PATH = /var/www/htdocs/cgit 3CGIT_SCRIPT_PATH = /var/www/htdocs/cgit
4CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) 4CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH)
5CGIT_CONFIG = /etc/cgitrc 5CGIT_CONFIG = /etc/cgitrc
6CACHE_ROOT = /var/cache/cgit 6CACHE_ROOT = /var/cache/cgit
7SHA1_HEADER = <openssl/sha.h> 7SHA1_HEADER = <openssl/sha.h>
8GIT_VER = 1.6.4.3 8GIT_VER = 1.6.4.3
9GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 9GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2
10INSTALL = install 10INSTALL = install
11 11
12# Define NO_STRCASESTR if you don't have strcasestr. 12# Define NO_STRCASESTR if you don't have strcasestr.
13# 13#
14# Define NO_OPENSSL to disable linking with OpenSSL and use bundled SHA1
15# implementation (slower).
16#
14# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin). 17# Define NEEDS_LIBICONV if linking with libc is not enough (eg. Darwin).
15# 18#
16 19
17#-include config.mak 20#-include config.mak
18 21
19# 22#
20# Platform specific tweaks 23# Platform specific tweaks
21# 24#
22 25
23uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') 26uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
24uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') 27uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
25uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') 28uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
26 29
27ifeq ($(uname_O),Cygwin) 30ifeq ($(uname_O),Cygwin)
28 NO_STRCASESTR = YesPlease 31 NO_STRCASESTR = YesPlease
29 NEEDS_LIBICONV = YesPlease 32 NEEDS_LIBICONV = YesPlease
30endif 33endif
31 34
32# 35#
33# Let the user override the above settings. 36# Let the user override the above settings.
34# 37#
35-include cgit.conf 38-include cgit.conf
36 39
37# 40#
38# Define a way to invoke make in subdirs quietly, shamelessly ripped 41# Define a way to invoke make in subdirs quietly, shamelessly ripped
39# from git.git 42# from git.git
40# 43#
41QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir 44QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir
42QUIET_SUBDIR1 = 45QUIET_SUBDIR1 =
43 46
44ifneq ($(findstring $(MAKEFLAGS),w),w) 47ifneq ($(findstring $(MAKEFLAGS),w),w)
45PRINT_DIR = --no-print-directory 48PRINT_DIR = --no-print-directory
46else # "make -w" 49else # "make -w"
47NO_SUBDIR = : 50NO_SUBDIR = :
48endif 51endif
49 52
50ifndef V 53ifndef V
51 QUIET_CC = @echo ' ' CC $@; 54 QUIET_CC = @echo ' ' CC $@;
52 QUIET_MM = @echo ' ' MM $@; 55 QUIET_MM = @echo ' ' MM $@;
53 QUIET_SUBDIR0 = +@subdir= 56 QUIET_SUBDIR0 = +@subdir=
54 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ 57 QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
55 $(MAKE) $(PRINT_DIR) -C $$subdir 58 $(MAKE) $(PRINT_DIR) -C $$subdir
56endif 59endif
57 60
58# 61#
59# Define a pattern rule for automatic dependency building 62# Define a pattern rule for automatic dependency building
60# 63#
61%.d: %.c 64%.d: %.c
62 $(QUIET_MM)$(CC) $(CFLAGS) -MM $< | sed -e 's/\($*\)\.o:/\1.o $@:/g' >$@ 65 $(QUIET_MM)$(CC) $(CFLAGS) -MM $< | sed -e 's/\($*\)\.o:/\1.o $@:/g' >$@
63 66
64# 67#
65# Define a pattern rule for silent object building 68# Define a pattern rule for silent object building
66# 69#
67%.o: %.c 70%.o: %.c
68 $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $< 71 $(QUIET_CC)$(CC) -o $*.o -c $(CFLAGS) $<
69 72
70 73
71EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto 74EXTLIBS = git/libgit.a git/xdiff/lib.a -lz
72OBJECTS = 75OBJECTS =
73OBJECTS += cache.o 76OBJECTS += cache.o
74OBJECTS += cgit.o 77OBJECTS += cgit.o
75OBJECTS += cmd.o 78OBJECTS += cmd.o
76OBJECTS += configfile.o 79OBJECTS += configfile.o
77OBJECTS += html.o 80OBJECTS += html.o
78OBJECTS += parsing.o 81OBJECTS += parsing.o
79OBJECTS += scan-tree.o 82OBJECTS += scan-tree.o
80OBJECTS += shared.o 83OBJECTS += shared.o
81OBJECTS += ui-atom.o 84OBJECTS += ui-atom.o
82OBJECTS += ui-blob.o 85OBJECTS += ui-blob.o
83OBJECTS += ui-clone.o 86OBJECTS += ui-clone.o
84OBJECTS += ui-commit.o 87OBJECTS += ui-commit.o
85OBJECTS += ui-diff.o 88OBJECTS += ui-diff.o
86OBJECTS += ui-log.o 89OBJECTS += ui-log.o
87OBJECTS += ui-patch.o 90OBJECTS += ui-patch.o
88OBJECTS += ui-plain.o 91OBJECTS += ui-plain.o
89OBJECTS += ui-refs.o 92OBJECTS += ui-refs.o
90OBJECTS += ui-repolist.o 93OBJECTS += ui-repolist.o
91OBJECTS += ui-shared.o 94OBJECTS += ui-shared.o
92OBJECTS += ui-snapshot.o 95OBJECTS += ui-snapshot.o
93OBJECTS += ui-stats.o 96OBJECTS += ui-stats.o
94OBJECTS += ui-summary.o 97OBJECTS += ui-summary.o
95OBJECTS += ui-tag.o 98OBJECTS += ui-tag.o
96OBJECTS += ui-tree.o 99OBJECTS += ui-tree.o
97 100
98ifdef NEEDS_LIBICONV 101ifdef NEEDS_LIBICONV
99 EXTLIBS += -liconv 102 EXTLIBS += -liconv
100endif 103endif
101 104
102 105
103.PHONY: all libgit test install uninstall clean force-version get-git \ 106.PHONY: all libgit test install uninstall clean force-version get-git \
104 doc man-doc html-doc clean-doc 107 doc man-doc html-doc clean-doc
105 108
106all: cgit 109all: cgit
107 110
108VERSION: force-version 111VERSION: force-version
109 @./gen-version.sh "$(CGIT_VERSION)" 112 @./gen-version.sh "$(CGIT_VERSION)"
110-include VERSION 113-include VERSION
111 114
112 115
113CFLAGS += -g -Wall -Igit 116CFLAGS += -g -Wall -Igit
114CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' 117CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)'
115CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' 118CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"'
116CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' 119CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"'
117CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' 120CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"'
118CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' 121CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"'
119 122
120ifdef NO_ICONV 123ifdef NO_ICONV
121 CFLAGS += -DNO_ICONV 124 CFLAGS += -DNO_ICONV
122endif 125endif
123ifdef NO_STRCASESTR 126ifdef NO_STRCASESTR
124 CFLAGS += -DNO_STRCASESTR 127 CFLAGS += -DNO_STRCASESTR
125endif 128endif
129ifdef NO_OPENSSL
130 CFLAGS += -DNO_OPENSSL
131 GIT_OPTIONS += NO_OPENSSL=1
132else
133 EXTLIBS += -lcrypto
134endif
126 135
127cgit: $(OBJECTS) libgit 136cgit: $(OBJECTS) libgit
128 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS) 137 $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS)
129 138
130cgit.o: VERSION 139cgit.o: VERSION
131 140
132-include $(OBJECTS:.o=.d) 141-include $(OBJECTS:.o=.d)
133 142
134libgit: 143libgit:
135 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 libgit.a 144 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) libgit.a
136 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 xdiff/lib.a 145 $(QUIET_SUBDIR0)git $(QUIET_SUBDIR1) NO_CURL=1 $(GIT_OPTIONS) xdiff/lib.a
137 146
138test: all 147test: all
139 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all 148 $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all
140 149
141install: all 150install: all
142 $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_SCRIPT_PATH) 151 $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_SCRIPT_PATH)
143 $(INSTALL) -m 0755 cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) 152 $(INSTALL) -m 0755 cgit $(DESTDIR)$(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
144 $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_DATA_PATH) 153 $(INSTALL) -m 0755 -d $(DESTDIR)$(CGIT_DATA_PATH)
145 $(INSTALL) -m 0644 cgit.css $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css 154 $(INSTALL) -m 0644 cgit.css $(DESTDIR)$(CGIT_DATA_PATH)/cgit.css
146 $(INSTALL) -m 0644 cgit.png $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png 155 $(INSTALL) -m 0644 cgit.png $(DESTDIR)$(CGIT_DATA_PATH)/cgit.png
147 156
148uninstall: 157uninstall:
149 rm -f $(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME) 158 rm -f $(CGIT_SCRIPT_PATH)/$(CGIT_SCRIPT_NAME)
150 rm -f $(CGIT_DATA_PATH)/cgit.css 159 rm -f $(CGIT_DATA_PATH)/cgit.css
151 rm -f $(CGIT_DATA_PATH)/cgit.png 160 rm -f $(CGIT_DATA_PATH)/cgit.png
152 161
153doc: man-doc html-doc pdf-doc 162doc: man-doc html-doc pdf-doc
154 163
155man-doc: cgitrc.5.txt 164man-doc: cgitrc.5.txt
156 a2x -f manpage cgitrc.5.txt 165 a2x -f manpage cgitrc.5.txt
157 166
158html-doc: cgitrc.5.txt 167html-doc: cgitrc.5.txt
159 a2x -f xhtml --stylesheet=cgit-doc.css cgitrc.5.txt 168 a2x -f xhtml --stylesheet=cgit-doc.css cgitrc.5.txt
160 169
161pdf-doc: cgitrc.5.txt 170pdf-doc: cgitrc.5.txt
162 a2x -f pdf cgitrc.5.txt 171 a2x -f pdf cgitrc.5.txt
163 172
164clean: clean-doc 173clean: clean-doc
165 rm -f cgit VERSION *.o *.d 174 rm -f cgit VERSION *.o *.d
166 175
167clean-doc: 176clean-doc:
168 rm -f cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo 177 rm -f cgitrc.5 cgitrc.5.html cgitrc.5.pdf cgitrc.5.xml cgitrc.5.fo
169 178
170get-git: 179get-git:
171 curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git 180 curl $(GIT_URL) | tar -xj && rm -rf git && mv git-$(GIT_VER) git