[packages] git: reduce size
authorluka <luka@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 13 Jun 2012 21:08:59 +0000 (21:08 +0000)
committerluka <luka@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Wed, 13 Jun 2012 21:08:59 +0000 (21:08 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/packages@32347 3c298f89-4303-0410-b956-a3cf2f4a3e73

net/git/Makefile
net/git/patches/100-convert_builtin.patch [new file with mode: 0644]

index 73cbcea..aba71ce 100644 (file)
@@ -24,7 +24,7 @@ define Package/git
   SECTION:=net
   CATEGORY:=Network
   SUBMENU:=Version Control Systems
-  DEPENDS:=+libopenssl +libcurl +libpthread
+  DEPENDS:=+libopenssl +libpthread
   TITLE:=The fast version control system
   URL:=http://git-scm.com
 endef
@@ -40,9 +40,11 @@ MAKE_FLAGS := \
        CFLAGS="$(TARGET_CFLAGS)" \
        CPPFLAGS="$(TARGET_CPPFLAGS)" \
        LDFLAGS="$(TARGET_LDFLAGS)" \
+       NO_CURL="YesPlease" \
        NO_EXPAT="YesPlease" \
        NO_MKSTEMPS="YesPlease" \
        NO_GETTEXT="YesPlease" \
+       NO_UNIX_SOCKETS="YesPlease" \
        NO_IPV6="YesPlease" \
        NO_ICONV="YesPlease" \
        NO_NSEC="YesPlease" \
diff --git a/net/git/patches/100-convert_builtin.patch b/net/git/patches/100-convert_builtin.patch
new file mode 100644 (file)
index 0000000..bee7c25
--- /dev/null
@@ -0,0 +1,246 @@
+--- /dev/null
++++ b/builtin/daemon.c
+@@ -0,0 +1 @@
++#include "../daemon.c"
+--- /dev/null
++++ b/builtin/fast-import.c
+@@ -0,0 +1 @@
++#include "../fast-import.c"
+--- /dev/null
++++ b/builtin/http-backend.c
+@@ -0,0 +1 @@
++#include "../http-backend.c"
+--- /dev/null
++++ b/builtin/imap-send.c
+@@ -0,0 +1 @@
++#include "../imap-send.c"
+--- /dev/null
++++ b/builtin/shell.c
+@@ -0,0 +1 @@
++#include "../shell.c"
+--- /dev/null
++++ b/builtin/upload-pack.c
+@@ -0,0 +1 @@
++#include "../upload-pack.c"
+--- a/builtin.h
++++ b/builtin.h
+@@ -150,5 +150,11 @@ extern int cmd_verify_pack(int argc, con
+ extern int cmd_show_ref(int argc, const char **argv, const char *prefix);
+ extern int cmd_pack_refs(int argc, const char **argv, const char *prefix);
+ extern int cmd_replace(int argc, const char **argv, const char *prefix);
++extern int cmd_daemon(int argc, char **argv, const char *prefix);
++extern int cmd_fast_import(int argc, const char **argv, const char *prefix);
++extern int cmd_http_backend(int argc, char **argv, const char *prefix);
++extern int cmd_imap_send(int argc, char **argv, const char *prefix);
++extern int cmd_shell(int argc, char **argv, const char *prefix);
++extern int cmd_upload_pack(int argc, char **argv, const char *prefix);
+ #endif
+--- a/daemon.c
++++ b/daemon.c
+@@ -1091,7 +1091,7 @@ static int serve(struct string_list *lis
+       return service_loop(&socklist);
+ }
+-int main(int argc, char **argv)
++int cmd_daemon(int argc, char **argv, const char *prefix)
+ {
+       int listen_port = 0;
+       struct string_list listen_addr = STRING_LIST_INIT_NODUP;
+--- a/fast-import.c
++++ b/fast-import.c
+@@ -3347,7 +3347,7 @@ static void parse_argv(void)
+               read_marks();
+ }
+-int main(int argc, const char **argv)
++int cmd_fast_import(int argc, const char **argv, const char *prefix)
+ {
+       unsigned int i;
+--- a/http-backend.c
++++ b/http-backend.c
+@@ -533,7 +533,7 @@ static struct service_cmd {
+       {"POST", "/git-receive-pack$", service_rpc}
+ };
+-int main(int argc, char **argv)
++int cmd_http_backend(int argc, char **argv, const char *prefix)
+ {
+       char *method = getenv("REQUEST_METHOD");
+       char *dir;
+--- a/imap-send.c
++++ b/imap-send.c
+@@ -1502,7 +1502,7 @@ static int git_imap_config(const char *k
+       return 0;
+ }
+-int main(int argc, char **argv)
++int cmd_imap_send(int argc, char **argv, const char *prefix)
+ {
+       struct msg_data all_msgs, msg;
+       struct store *ctx = NULL;
+--- a/shell.c
++++ b/shell.c
+@@ -129,7 +129,7 @@ static struct commands {
+       { NULL },
+ };
+-int main(int argc, char **argv)
++int cmd_shell(int argc, char **argv, const char *prefix)
+ {
+       char *prog;
+       const char **user_argv;
+--- a/upload-pack.c
++++ b/upload-pack.c
+@@ -785,7 +785,7 @@ static void upload_pack(void)
+       }
+ }
+-int main(int argc, char **argv)
++int cmd_upload_pack(int argc, char **argv, const char *prefix)
+ {
+       char *dir;
+       int i;
+--- a/git.c
++++ b/git.c
+@@ -269,11 +269,11 @@ const char git_version_string[] = GIT_VE
+ struct cmd_struct {
+       const char *cmd;
+-      int (*fn)(int, const char **, const char *);
++      int (*fn)(int, char **, const char *);
+       int option;
+ };
+-static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
++static int run_builtin(struct cmd_struct *p, int argc, char **argv)
+ {
+       int status, help;
+       struct stat st;
+@@ -326,7 +326,7 @@ static int run_builtin(struct cmd_struct
+       return 0;
+ }
+-static void handle_internal_command(int argc, const char **argv)
++static void handle_internal_command(int argc, char **argv)
+ {
+       const char *cmd = argv[0];
+       static struct cmd_struct commands[] = {
+@@ -352,12 +352,14 @@ static void handle_internal_command(int
+               { "commit-tree", cmd_commit_tree, RUN_SETUP },
+               { "config", cmd_config, RUN_SETUP_GENTLY },
+               { "count-objects", cmd_count_objects, RUN_SETUP },
++              { "daemon", cmd_daemon },
+               { "describe", cmd_describe, RUN_SETUP },
+               { "diff", cmd_diff },
+               { "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
+               { "diff-index", cmd_diff_index, RUN_SETUP },
+               { "diff-tree", cmd_diff_tree, RUN_SETUP },
+               { "fast-export", cmd_fast_export, RUN_SETUP },
++              { "fast-import", cmd_fast_import },
+               { "fetch", cmd_fetch, RUN_SETUP },
+               { "fetch-pack", cmd_fetch_pack, RUN_SETUP },
+               { "fmt-merge-msg", cmd_fmt_merge_msg, RUN_SETUP },
+@@ -370,6 +372,8 @@ static void handle_internal_command(int
+               { "grep", cmd_grep, RUN_SETUP_GENTLY },
+               { "hash-object", cmd_hash_object },
+               { "help", cmd_help },
++              { "http-backend", cmd_http_backend },
++              { "imap-send", cmd_imap_send },
+               { "index-pack", cmd_index_pack, RUN_SETUP_GENTLY },
+               { "init", cmd_init_db },
+               { "init-db", cmd_init_db },
+@@ -418,6 +422,7 @@ static void handle_internal_command(int
+               { "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
+               { "rm", cmd_rm, RUN_SETUP },
+               { "send-pack", cmd_send_pack, RUN_SETUP },
++              { "shell", cmd_shell },
+               { "shortlog", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },
+               { "show", cmd_show, RUN_SETUP },
+               { "show-branch", cmd_show_branch, RUN_SETUP },
+@@ -435,6 +440,7 @@ static void handle_internal_command(int
+               { "update-server-info", cmd_update_server_info, RUN_SETUP },
+               { "upload-archive", cmd_upload_archive },
+               { "upload-archive--writer", cmd_upload_archive_writer },
++              { "upload-pack", cmd_upload_pack },
+               { "var", cmd_var, RUN_SETUP_GENTLY },
+               { "verify-pack", cmd_verify_pack },
+               { "verify-tag", cmd_verify_tag, RUN_SETUP },
+--- a/Makefile
++++ b/Makefile
+@@ -454,15 +454,7 @@ EXTRA_PROGRAMS =
+ # ... and all the rest that could be moved out of bindir to gitexecdir
+ PROGRAMS += $(EXTRA_PROGRAMS)
+-PROGRAM_OBJS += daemon.o
+-PROGRAM_OBJS += fast-import.o
+-PROGRAM_OBJS += imap-send.o
+-PROGRAM_OBJS += shell.o
+-PROGRAM_OBJS += show-index.o
+-PROGRAM_OBJS += upload-pack.o
+-PROGRAM_OBJS += http-backend.o
+-PROGRAM_OBJS += sh-i18n--envsubst.o
+-PROGRAM_OBJS += credential-store.o
++PROGRAM_OBJS =
+ # Binary suffix, set to .exe for Windows builds
+ X =
+@@ -852,6 +844,12 @@ BUILTIN_OBJS += builtin/var.o
+ BUILTIN_OBJS += builtin/verify-pack.o
+ BUILTIN_OBJS += builtin/verify-tag.o
+ BUILTIN_OBJS += builtin/write-tree.o
++BUILTIN_OBJS += builtin/daemon.o
++BUILTIN_OBJS += builtin/fast-import.o
++BUILTIN_OBJS += builtin/http-backend.o
++BUILTIN_OBJS += builtin/imap-send.o
++BUILTIN_OBJS += builtin/shell.o
++BUILTIN_OBJS += builtin/upload-pack.o
+ GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
+ EXTLIBS =
+@@ -1447,7 +1445,7 @@ endif
+ EXTLIBS += -lz
+ ifndef NO_OPENSSL
+-      OPENSSL_LIBSSL = -lssl
++      EXTLIBS += -lssl
+       ifdef OPENSSLDIR
+               BASIC_CFLAGS += -I$(OPENSSLDIR)/include
+               OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
+@@ -2228,10 +2226,6 @@ endif
+ git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
+       $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
+-git-imap-send$X: imap-send.o GIT-LDFLAGS $(GITLIBS)
+-      $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
+-              $(LIBS) $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
+-
+ git-http-fetch$X: revision.o http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
+       $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
+               $(LIBS) $(CURL_LIBCURL)
+@@ -2526,22 +2520,20 @@ endif
+       bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
+       execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
+       { test "$$bindir/" = "$$execdir/" || \
+-        for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
++        for p in $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
+               $(RM) "$$execdir/$$p" && \
+               test -z "$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
+-              ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
++              ln -s git "$$execdir/$$p" 2>/dev/null || \
+               cp "$$bindir/$$p" "$$execdir/$$p" || exit; \
+         done; \
+       } && \
+       for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
+               $(RM) "$$bindir/$$p" && \
+-              ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
+               ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
+               cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
+       done && \
+       for p in $(BUILT_INS); do \
+               $(RM) "$$execdir/$$p" && \
+-              ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
+               ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
+               cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
+       done && \