author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2009-10-28 21:39:55 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2009-11-07 15:23:19 (UTC) |
commit | 59310ab102a448d90c337b3b138dd53681d8097e (patch) (unidiff) | |
tree | 6b2d1aa00ed31247bf06b87722a35b1f75ceb093 | |
parent | 4b1fee00ddfbb7bfb48f85bef49b5aff928d0f2e (diff) | |
download | cgit-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>
-rw-r--r-- | Makefile | 15 |
1 files changed, 12 insertions, 3 deletions
@@ -1,171 +1,180 @@ | |||
1 | CGIT_VERSION = v0.8.3 | 1 | CGIT_VERSION = v0.8.3 |
2 | CGIT_SCRIPT_NAME = cgit.cgi | 2 | CGIT_SCRIPT_NAME = cgit.cgi |
3 | CGIT_SCRIPT_PATH = /var/www/htdocs/cgit | 3 | CGIT_SCRIPT_PATH = /var/www/htdocs/cgit |
4 | CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) | 4 | CGIT_DATA_PATH = $(CGIT_SCRIPT_PATH) |
5 | CGIT_CONFIG = /etc/cgitrc | 5 | CGIT_CONFIG = /etc/cgitrc |
6 | CACHE_ROOT = /var/cache/cgit | 6 | CACHE_ROOT = /var/cache/cgit |
7 | SHA1_HEADER = <openssl/sha.h> | 7 | SHA1_HEADER = <openssl/sha.h> |
8 | GIT_VER = 1.6.4.3 | 8 | GIT_VER = 1.6.4.3 |
9 | GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 | 9 | GIT_URL = http://www.kernel.org/pub/software/scm/git/git-$(GIT_VER).tar.bz2 |
10 | INSTALL = install | 10 | INSTALL = 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 | ||
23 | uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') | 26 | uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') |
24 | uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') | 27 | uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not') |
25 | uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') | 28 | uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not') |
26 | 29 | ||
27 | ifeq ($(uname_O),Cygwin) | 30 | ifeq ($(uname_O),Cygwin) |
28 | NO_STRCASESTR = YesPlease | 31 | NO_STRCASESTR = YesPlease |
29 | NEEDS_LIBICONV = YesPlease | 32 | NEEDS_LIBICONV = YesPlease |
30 | endif | 33 | endif |
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 | # |
41 | QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir | 44 | QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir |
42 | QUIET_SUBDIR1 = | 45 | QUIET_SUBDIR1 = |
43 | 46 | ||
44 | ifneq ($(findstring $(MAKEFLAGS),w),w) | 47 | ifneq ($(findstring $(MAKEFLAGS),w),w) |
45 | PRINT_DIR = --no-print-directory | 48 | PRINT_DIR = --no-print-directory |
46 | else # "make -w" | 49 | else # "make -w" |
47 | NO_SUBDIR = : | 50 | NO_SUBDIR = : |
48 | endif | 51 | endif |
49 | 52 | ||
50 | ifndef V | 53 | ifndef 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 |
56 | endif | 59 | endif |
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 | ||
71 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz -lcrypto | 74 | EXTLIBS = git/libgit.a git/xdiff/lib.a -lz |
72 | OBJECTS = | 75 | OBJECTS = |
73 | OBJECTS += cache.o | 76 | OBJECTS += cache.o |
74 | OBJECTS += cgit.o | 77 | OBJECTS += cgit.o |
75 | OBJECTS += cmd.o | 78 | OBJECTS += cmd.o |
76 | OBJECTS += configfile.o | 79 | OBJECTS += configfile.o |
77 | OBJECTS += html.o | 80 | OBJECTS += html.o |
78 | OBJECTS += parsing.o | 81 | OBJECTS += parsing.o |
79 | OBJECTS += scan-tree.o | 82 | OBJECTS += scan-tree.o |
80 | OBJECTS += shared.o | 83 | OBJECTS += shared.o |
81 | OBJECTS += ui-atom.o | 84 | OBJECTS += ui-atom.o |
82 | OBJECTS += ui-blob.o | 85 | OBJECTS += ui-blob.o |
83 | OBJECTS += ui-clone.o | 86 | OBJECTS += ui-clone.o |
84 | OBJECTS += ui-commit.o | 87 | OBJECTS += ui-commit.o |
85 | OBJECTS += ui-diff.o | 88 | OBJECTS += ui-diff.o |
86 | OBJECTS += ui-log.o | 89 | OBJECTS += ui-log.o |
87 | OBJECTS += ui-patch.o | 90 | OBJECTS += ui-patch.o |
88 | OBJECTS += ui-plain.o | 91 | OBJECTS += ui-plain.o |
89 | OBJECTS += ui-refs.o | 92 | OBJECTS += ui-refs.o |
90 | OBJECTS += ui-repolist.o | 93 | OBJECTS += ui-repolist.o |
91 | OBJECTS += ui-shared.o | 94 | OBJECTS += ui-shared.o |
92 | OBJECTS += ui-snapshot.o | 95 | OBJECTS += ui-snapshot.o |
93 | OBJECTS += ui-stats.o | 96 | OBJECTS += ui-stats.o |
94 | OBJECTS += ui-summary.o | 97 | OBJECTS += ui-summary.o |
95 | OBJECTS += ui-tag.o | 98 | OBJECTS += ui-tag.o |
96 | OBJECTS += ui-tree.o | 99 | OBJECTS += ui-tree.o |
97 | 100 | ||
98 | ifdef NEEDS_LIBICONV | 101 | ifdef NEEDS_LIBICONV |
99 | EXTLIBS += -liconv | 102 | EXTLIBS += -liconv |
100 | endif | 103 | endif |
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 | ||
106 | all: cgit | 109 | all: cgit |
107 | 110 | ||
108 | VERSION: force-version | 111 | VERSION: force-version |
109 | @./gen-version.sh "$(CGIT_VERSION)" | 112 | @./gen-version.sh "$(CGIT_VERSION)" |
110 | -include VERSION | 113 | -include VERSION |
111 | 114 | ||
112 | 115 | ||
113 | CFLAGS += -g -Wall -Igit | 116 | CFLAGS += -g -Wall -Igit |
114 | CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' | 117 | CFLAGS += -DSHA1_HEADER='$(SHA1_HEADER)' |
115 | CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' | 118 | CFLAGS += -DCGIT_VERSION='"$(CGIT_VERSION)"' |
116 | CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' | 119 | CFLAGS += -DCGIT_CONFIG='"$(CGIT_CONFIG)"' |
117 | CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' | 120 | CFLAGS += -DCGIT_SCRIPT_NAME='"$(CGIT_SCRIPT_NAME)"' |
118 | CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' | 121 | CFLAGS += -DCGIT_CACHE_ROOT='"$(CACHE_ROOT)"' |
119 | 122 | ||
120 | ifdef NO_ICONV | 123 | ifdef NO_ICONV |
121 | CFLAGS += -DNO_ICONV | 124 | CFLAGS += -DNO_ICONV |
122 | endif | 125 | endif |
123 | ifdef NO_STRCASESTR | 126 | ifdef NO_STRCASESTR |
124 | CFLAGS += -DNO_STRCASESTR | 127 | CFLAGS += -DNO_STRCASESTR |
125 | endif | 128 | endif |
129 | ifdef NO_OPENSSL | ||
130 | CFLAGS += -DNO_OPENSSL | ||
131 | GIT_OPTIONS += NO_OPENSSL=1 | ||
132 | else | ||
133 | EXTLIBS += -lcrypto | ||
134 | endif | ||
126 | 135 | ||
127 | cgit: $(OBJECTS) libgit | 136 | cgit: $(OBJECTS) libgit |
128 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS) | 137 | $(QUIET_CC)$(CC) $(CFLAGS) $(LDFLAGS) -o cgit $(OBJECTS) $(EXTLIBS) |
129 | 138 | ||
130 | cgit.o: VERSION | 139 | cgit.o: VERSION |
131 | 140 | ||
132 | -include $(OBJECTS:.o=.d) | 141 | -include $(OBJECTS:.o=.d) |
133 | 142 | ||
134 | libgit: | 143 | libgit: |
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 | ||
138 | test: all | 147 | test: all |
139 | $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all | 148 | $(QUIET_SUBDIR0)tests $(QUIET_SUBDIR1) all |
140 | 149 | ||
141 | install: all | 150 | install: 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 | ||
148 | uninstall: | 157 | uninstall: |
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 | ||
153 | doc: man-doc html-doc pdf-doc | 162 | doc: man-doc html-doc pdf-doc |
154 | 163 | ||
155 | man-doc: cgitrc.5.txt | 164 | man-doc: cgitrc.5.txt |
156 | a2x -f manpage cgitrc.5.txt | 165 | a2x -f manpage cgitrc.5.txt |
157 | 166 | ||
158 | html-doc: cgitrc.5.txt | 167 | html-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 | ||
161 | pdf-doc: cgitrc.5.txt | 170 | pdf-doc: cgitrc.5.txt |
162 | a2x -f pdf cgitrc.5.txt | 171 | a2x -f pdf cgitrc.5.txt |
163 | 172 | ||
164 | clean: clean-doc | 173 | clean: clean-doc |
165 | rm -f cgit VERSION *.o *.d | 174 | rm -f cgit VERSION *.o *.d |
166 | 175 | ||
167 | clean-doc: | 176 | clean-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 | ||
170 | get-git: | 179 | get-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 |