[packages] git: reduce size
[openwrt/svn-archive/archive.git] / net / git / patches / 100-convert_builtin.patch
1 --- /dev/null
2 +++ b/builtin/daemon.c
3 @@ -0,0 +1 @@
4 +#include "../daemon.c"
5 --- /dev/null
6 +++ b/builtin/fast-import.c
7 @@ -0,0 +1 @@
8 +#include "../fast-import.c"
9 --- /dev/null
10 +++ b/builtin/http-backend.c
11 @@ -0,0 +1 @@
12 +#include "../http-backend.c"
13 --- /dev/null
14 +++ b/builtin/imap-send.c
15 @@ -0,0 +1 @@
16 +#include "../imap-send.c"
17 --- /dev/null
18 +++ b/builtin/shell.c
19 @@ -0,0 +1 @@
20 +#include "../shell.c"
21 --- /dev/null
22 +++ b/builtin/upload-pack.c
23 @@ -0,0 +1 @@
24 +#include "../upload-pack.c"
25 --- a/builtin.h
26 +++ b/builtin.h
27 @@ -150,5 +150,11 @@ extern int cmd_verify_pack(int argc, con
28 extern int cmd_show_ref(int argc, const char **argv, const char *prefix);
29 extern int cmd_pack_refs(int argc, const char **argv, const char *prefix);
30 extern int cmd_replace(int argc, const char **argv, const char *prefix);
31 +extern int cmd_daemon(int argc, char **argv, const char *prefix);
32 +extern int cmd_fast_import(int argc, const char **argv, const char *prefix);
33 +extern int cmd_http_backend(int argc, char **argv, const char *prefix);
34 +extern int cmd_imap_send(int argc, char **argv, const char *prefix);
35 +extern int cmd_shell(int argc, char **argv, const char *prefix);
36 +extern int cmd_upload_pack(int argc, char **argv, const char *prefix);
37
38 #endif
39 --- a/daemon.c
40 +++ b/daemon.c
41 @@ -1091,7 +1091,7 @@ static int serve(struct string_list *lis
42 return service_loop(&socklist);
43 }
44
45 -int main(int argc, char **argv)
46 +int cmd_daemon(int argc, char **argv, const char *prefix)
47 {
48 int listen_port = 0;
49 struct string_list listen_addr = STRING_LIST_INIT_NODUP;
50 --- a/fast-import.c
51 +++ b/fast-import.c
52 @@ -3347,7 +3347,7 @@ static void parse_argv(void)
53 read_marks();
54 }
55
56 -int main(int argc, const char **argv)
57 +int cmd_fast_import(int argc, const char **argv, const char *prefix)
58 {
59 unsigned int i;
60
61 --- a/http-backend.c
62 +++ b/http-backend.c
63 @@ -533,7 +533,7 @@ static struct service_cmd {
64 {"POST", "/git-receive-pack$", service_rpc}
65 };
66
67 -int main(int argc, char **argv)
68 +int cmd_http_backend(int argc, char **argv, const char *prefix)
69 {
70 char *method = getenv("REQUEST_METHOD");
71 char *dir;
72 --- a/imap-send.c
73 +++ b/imap-send.c
74 @@ -1502,7 +1502,7 @@ static int git_imap_config(const char *k
75 return 0;
76 }
77
78 -int main(int argc, char **argv)
79 +int cmd_imap_send(int argc, char **argv, const char *prefix)
80 {
81 struct msg_data all_msgs, msg;
82 struct store *ctx = NULL;
83 --- a/shell.c
84 +++ b/shell.c
85 @@ -129,7 +129,7 @@ static struct commands {
86 { NULL },
87 };
88
89 -int main(int argc, char **argv)
90 +int cmd_shell(int argc, char **argv, const char *prefix)
91 {
92 char *prog;
93 const char **user_argv;
94 --- a/upload-pack.c
95 +++ b/upload-pack.c
96 @@ -785,7 +785,7 @@ static void upload_pack(void)
97 }
98 }
99
100 -int main(int argc, char **argv)
101 +int cmd_upload_pack(int argc, char **argv, const char *prefix)
102 {
103 char *dir;
104 int i;
105 --- a/git.c
106 +++ b/git.c
107 @@ -269,11 +269,11 @@ const char git_version_string[] = GIT_VE
108
109 struct cmd_struct {
110 const char *cmd;
111 - int (*fn)(int, const char **, const char *);
112 + int (*fn)(int, char **, const char *);
113 int option;
114 };
115
116 -static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
117 +static int run_builtin(struct cmd_struct *p, int argc, char **argv)
118 {
119 int status, help;
120 struct stat st;
121 @@ -326,7 +326,7 @@ static int run_builtin(struct cmd_struct
122 return 0;
123 }
124
125 -static void handle_internal_command(int argc, const char **argv)
126 +static void handle_internal_command(int argc, char **argv)
127 {
128 const char *cmd = argv[0];
129 static struct cmd_struct commands[] = {
130 @@ -352,12 +352,14 @@ static void handle_internal_command(int
131 { "commit-tree", cmd_commit_tree, RUN_SETUP },
132 { "config", cmd_config, RUN_SETUP_GENTLY },
133 { "count-objects", cmd_count_objects, RUN_SETUP },
134 + { "daemon", cmd_daemon },
135 { "describe", cmd_describe, RUN_SETUP },
136 { "diff", cmd_diff },
137 { "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
138 { "diff-index", cmd_diff_index, RUN_SETUP },
139 { "diff-tree", cmd_diff_tree, RUN_SETUP },
140 { "fast-export", cmd_fast_export, RUN_SETUP },
141 + { "fast-import", cmd_fast_import },
142 { "fetch", cmd_fetch, RUN_SETUP },
143 { "fetch-pack", cmd_fetch_pack, RUN_SETUP },
144 { "fmt-merge-msg", cmd_fmt_merge_msg, RUN_SETUP },
145 @@ -370,6 +372,8 @@ static void handle_internal_command(int
146 { "grep", cmd_grep, RUN_SETUP_GENTLY },
147 { "hash-object", cmd_hash_object },
148 { "help", cmd_help },
149 + { "http-backend", cmd_http_backend },
150 + { "imap-send", cmd_imap_send },
151 { "index-pack", cmd_index_pack, RUN_SETUP_GENTLY },
152 { "init", cmd_init_db },
153 { "init-db", cmd_init_db },
154 @@ -418,6 +422,7 @@ static void handle_internal_command(int
155 { "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
156 { "rm", cmd_rm, RUN_SETUP },
157 { "send-pack", cmd_send_pack, RUN_SETUP },
158 + { "shell", cmd_shell },
159 { "shortlog", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },
160 { "show", cmd_show, RUN_SETUP },
161 { "show-branch", cmd_show_branch, RUN_SETUP },
162 @@ -435,6 +440,7 @@ static void handle_internal_command(int
163 { "update-server-info", cmd_update_server_info, RUN_SETUP },
164 { "upload-archive", cmd_upload_archive },
165 { "upload-archive--writer", cmd_upload_archive_writer },
166 + { "upload-pack", cmd_upload_pack },
167 { "var", cmd_var, RUN_SETUP_GENTLY },
168 { "verify-pack", cmd_verify_pack },
169 { "verify-tag", cmd_verify_tag, RUN_SETUP },
170 --- a/Makefile
171 +++ b/Makefile
172 @@ -454,15 +454,7 @@ EXTRA_PROGRAMS =
173 # ... and all the rest that could be moved out of bindir to gitexecdir
174 PROGRAMS += $(EXTRA_PROGRAMS)
175
176 -PROGRAM_OBJS += daemon.o
177 -PROGRAM_OBJS += fast-import.o
178 -PROGRAM_OBJS += imap-send.o
179 -PROGRAM_OBJS += shell.o
180 -PROGRAM_OBJS += show-index.o
181 -PROGRAM_OBJS += upload-pack.o
182 -PROGRAM_OBJS += http-backend.o
183 -PROGRAM_OBJS += sh-i18n--envsubst.o
184 -PROGRAM_OBJS += credential-store.o
185 +PROGRAM_OBJS =
186
187 # Binary suffix, set to .exe for Windows builds
188 X =
189 @@ -852,6 +844,12 @@ BUILTIN_OBJS += builtin/var.o
190 BUILTIN_OBJS += builtin/verify-pack.o
191 BUILTIN_OBJS += builtin/verify-tag.o
192 BUILTIN_OBJS += builtin/write-tree.o
193 +BUILTIN_OBJS += builtin/daemon.o
194 +BUILTIN_OBJS += builtin/fast-import.o
195 +BUILTIN_OBJS += builtin/http-backend.o
196 +BUILTIN_OBJS += builtin/imap-send.o
197 +BUILTIN_OBJS += builtin/shell.o
198 +BUILTIN_OBJS += builtin/upload-pack.o
199
200 GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
201 EXTLIBS =
202 @@ -1447,7 +1445,7 @@ endif
203 EXTLIBS += -lz
204
205 ifndef NO_OPENSSL
206 - OPENSSL_LIBSSL = -lssl
207 + EXTLIBS += -lssl
208 ifdef OPENSSLDIR
209 BASIC_CFLAGS += -I$(OPENSSLDIR)/include
210 OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
211 @@ -2228,10 +2226,6 @@ endif
212 git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
213 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
214
215 -git-imap-send$X: imap-send.o GIT-LDFLAGS $(GITLIBS)
216 - $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
217 - $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
218 -
219 git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
220 $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
221 $(LIBS) $(CURL_LIBCURL)
222 @@ -2526,22 +2520,20 @@ endif
223 bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
224 execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
225 { test "$$bindir/" = "$$execdir/" || \
226 - for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
227 + for p in $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
228 $(RM) "$$execdir/$$p" && \
229 test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
230 - ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
231 + ln -s git "$$execdir/$$p" 2>/dev/null || \
232 cp "$$bindir/$$p" "$$execdir/$$p" || exit; \
233 done; \
234 } && \
235 for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
236 $(RM) "$$bindir/$$p" && \
237 - ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
238 ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
239 cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
240 done && \
241 for p in $(BUILT_INS); do \
242 $(RM) "$$execdir/$$p" && \
243 - ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
244 ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
245 cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
246 done && \