|
From: | Josh Nisly |
Subject: | Re: [rdiff-backup-users] Building rdiff-backup on Windows |
Date: | Tue, 08 Apr 2008 07:23:46 -0500 |
User-agent: | Thunderbird 2.0.0.12 (X11/20080227) |
Andrew Ferguson wrote:
Under a normal non-cygwin Windows build, there is no place to look for the librsync library, so you have to specify a location somehwere. It seemed that looking in the current directory was the most generic place. Another option would be allowing the --librsync-dir option to work on nt platforms (we only support this flag on posix platforms.)Thanks, Josh Nisly --- setup.py 2008-01-03 09:36:49.000000000 -0600 +++ setup.py 2008-04-02 17:58:36.984375000 -0500 @@ -40,6 +40,9 @@ libdir_list = [os.path.join(LIBRSYNC_DIR, 'lib')] if '-lrsync' in LIBS: libname = [] +elif os.name == 'nt': + incdir_list = ['.'] + lflags_arg = ['/NODEFAULTLIB:libcmt.lib'] setup(name="rdiff-backup", version=version_string,Can you explain why this patch is necessary for Windows? When I last built rdiff-backup under Cygwin/windowsXP (July/August timeframe), it was not necessary to do that. Have things changed such that librsync can only be built in the current directory? Is the libcmt.lib piece a Vista thing, perhaps?Personally, I don't commit patches that are only to make it build in an individual user's environment (eg, I didn't commit logic to handle librsync installed by the Fink package management system, etc.), so I just wanted to check.
The libcmt.lib is a Microsoft compiler thing. Again, it could be made a flag, although it will always have to be that option, because of the mess that Microsoft has made of their libraries.
I believe that unistd.h is a unix or posix library. At any rate, windows doesn't supply it.--- cmodule.c 2008-01-03 09:36:48.000000000 -0600 +++ cmodule.c 2008-04-01 20:08:15.484375000 -0500 @@ -24,7 +24,9 @@ #include <Python.h> #include <sys/types.h> #include <sys/stat.h> +#if !defined(MS_WIN64) && !defined(MS_WIN32) #include <unistd.h> +#endif #include <errno.h>Looks good, but I don't have a system to test on. Again, I don't remember the need to comment that out when I last built it. Do you not have Cygwin installed, per chance? I believe you should have a unistd.h file....
@@ -46,6 +48,7 @@ /* This code taken from Python's posixmodule.c */ #undef STAT #if defined(MS_WIN64) || defined(MS_WIN32) +# define lstat _stati64 # define STAT _stati64 # define FSTAT _fstati64 # define STRUCT_STAT struct _stati64 @@ -69,6 +72,16 @@ #define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) #endifAh, good catch, but what we should do is change the calls to 'lstat' in the body of cmodule.c to be calls to LSTAT and then make that block:
Ok, I'll update the patch. Thanks for the feedback.
No, they do not exist. On Windows, mode only specifies whether a path is a file or directory, plus (sometimes) some permission information. See http://msdn2.microsoft.com/en-us/library/14h5k7ff(VS.80).aspx.#undef STAT #undef LSTAT #if defined(MS_WIN64) || defined(MS_WIN32) # define LSTAT _stati64 # define STAT _stati64 # define FSTAT _fstati64 # define STRUCT_STAT struct _stati64 #else # define LSTAT lstat # define STAT stat # define FSTAT fstat # define STRUCT_STAT struct stat #endif(not that STAT and FSTAT are used in cmodule.c any more, but at least it keeps the correct mappings there for the future).+#if defined(MS_WIN64) || defined(MS_WIN32) +#define S_ISSOCK(mode) (0) +#define S_ISFIFO(mode) (0) +#define S_ISLNK(mode) (0) +#define S_ISCHR(mode) (0) +#define S_ISBLK(mode) (0) +#define sync _flushall +#endif +Do these types not exist on Windows? (socket, fifo, symlink, character device, block device) ?
The sync() call in my_sync() should operate like the LSTAT/STAT/FSTAT calls ... it should be in caps, SYNC(), and then have the definition of SYNC in the LSTAT, etc. block above.
I'll change this too.
Andrew
JoshN
[Prev in Thread] | Current Thread | [Next in Thread] |