From d17b18abecd04a8fcb4682c5ca5e5b851aa8e6ce Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sun, 20 May 2007 21:25:49 +0200 Subject: [PATCH] Make mingw branch compile on Linux again --- Makefile | 4 ++-- git-compat-util.h | 22 ++++++++++++++-------- setup.c | 2 +- spawn-pipe.c | 5 ++++- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 1470f29a7d..a85f7102fc 100644 --- a/Makefile +++ b/Makefile @@ -209,8 +209,7 @@ SCRIPT_SH = \ git-applymbox.sh git-applypatch.sh git-am.sh \ git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \ git-merge-resolve.sh git-merge-ours.sh \ - git-lost-found.sh git-quiltimport.sh \ - cpio.sh + git-lost-found.sh git-quiltimport.sh SCRIPT_PERL = \ git-add--interactive.perl \ @@ -504,6 +503,7 @@ ifneq (,$(findstring MINGW,$(uname_S))) X = .exe NOEXECTEMPL = .noexec template_dir = ../share/git-core/templates/ + SCRIPT_SH += cpio.sh endif ifneq (,$(findstring arm,$(uname_M))) ARM_SHA1 = YesPlease diff --git a/git-compat-util.h b/git-compat-util.h index f88f851941..7ae57d6019 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -48,16 +48,20 @@ #include #include #include -//#include #include -//#include -//#include -//#include +#ifndef __MINGW32__ +#include +#include +#include +#include +#endif #include #include -//#include -//#include -//#include +#ifndef __MINGW32__ +#include +#include +#include +#endif #ifndef NO_ETC_PASSWD #include #include @@ -345,7 +349,7 @@ static inline int strtoul_ui(char const *s, int base, unsigned int *result) return 0; } -// MinGW +#ifdef __MINGW32__ #ifndef S_ISLNK #define S_IFLNK 0120000 /* Symbolic link */ @@ -459,4 +463,6 @@ int mingw_socket(int domain, int type, int protocol); extern void quote_argv(const char **dst, const char **src); extern const char *parse_interpreter(const char *cmd); +#endif /* __MINGW32__ */ + #endif diff --git a/setup.c b/setup.c index a66f479944..a2903b9573 100644 --- a/setup.c +++ b/setup.c @@ -78,11 +78,11 @@ const char *prefix_path(const char *prefix, int len, const char *path) const char *prefix_filename(const char *pfx, int pfx_len, const char *arg) { static char path[PATH_MAX]; + char *p; #ifndef __MINGW32__ if (!pfx || !*pfx || arg[0] == '/') return arg; #else - char *p; /* don't add prefix to absolute paths */ const int is_absolute = is_dir_sep(arg[0]) || diff --git a/spawn-pipe.c b/spawn-pipe.c index 7d8aa7d6c7..c8f0452823 100644 --- a/spawn-pipe.c +++ b/spawn-pipe.c @@ -106,12 +106,15 @@ static char *path_lookup(const char *cmd, char **path) int spawnvpe_pipe(const char *cmd, const char **argv, const char **env, int pin[], int pout[]) { +#ifdef __MINGW32__ char **path = get_path_split(); pid_t pid = spawnvppe_pipe(cmd, argv, env, path, pin, pout); free_path_split(path); - +#else + pid_t pid = spawnvppe_pipe(cmd, argv, env, NULL, pin, pout); +#endif return pid; }