To: | bug-par [...] rt.cpan.org |
CC: | autrijus [...] autrijus.org |
Subject: | [PAR-0.89] Does not build on windows (patch included) |
From: | Vincent LADEUIL <v.ladeuil [...] alplog.fr> |
Date: | Wed, 06 Jul 2005 16:13:34 +0200 |
Hi,
The enclosed patch solve a problem I encounter in the following
configuration :
- windows 2000 professional
- msys 1.0
- mimgw 4.1 with :
- w32api-3.2
- binutils-2.15.91
- gcc-core-3.4.2
- gcc-g++-3.4.2
- dmake-4.1pl1-win32
myldr/static.c could not compile because mkdir is defined as a
macro (with two parameters) by PAR and declared as a function
(with one parameter) in the system headers.
The following patch replaces all uses of mkdir by my_mkdir and
provide two definitions of my_mkdir : one for WIN32 and one for
the rest (of us :).
Hope it helps, tell me if you need more informations or if I
should have write my patch differently.
Vincent
*** ./myldr/static.c~ Tue Jul 5 17:02:14 2005
--- ./myldr/static.c Tue Jul 5 17:14:55 2005
***************
*** 2,8 ****
#undef readdir
#ifdef WIN32
# include <process.h>
! # define mkdir(file, mode) _mkdir(file)
#endif
#include "mktmpdir.c"
--- 2,10 ----
#undef readdir
#ifdef WIN32
# include <process.h>
! # define my_mkdir(file, mode) _mkdir(file)
! #else
! # define my_mkdir(file, mode) mkdir(file,mode)
#endif
#include "mktmpdir.c"
***************
*** 62,68 ****
stmpdir = (char *)par_getenv("PAR_TEMP");
if ( stmpdir != NULL ) {
! i = mkdir(stmpdir, 0755);
if ( (i != 0) && (i != EEXIST) && (i != -1) ) {
perror("tagada") ;
fprintf(stderr, "%s: creation of private temporary subdirectory %s failed - aborting with %i.\n", argv[0], stmpdir, errno);
--- 64,70 ----
stmpdir = (char *)par_getenv("PAR_TEMP");
if ( stmpdir != NULL ) {
! i = my_mkdir(stmpdir, 0755);
if ( (i != 0) && (i != EEXIST) && (i != -1) ) {
perror("tagada") ;
fprintf(stderr, "%s: creation of private temporary subdirectory %s failed - aborting with %i.\n", argv[0], stmpdir, errno);
*** ./myldr/mktmpdir.c~ Fri Jun 10 09:26:03 2005
--- ./myldr/mktmpdir.c Tue Jul 5 17:13:05 2005
***************
*** 116,122 ****
strlen(subdirbuf_suffix) + 1024
);
sprintf(stmpdir, "%s%s%s%s", tmpdir, dir_sep, subdirbuf_prefix, username);
! mkdir(stmpdir, 0755);
/* Doesn't really work - XXX */
progname = par_findprog(argv[0], strdup(val));
--- 116,122 ----
strlen(subdirbuf_suffix) + 1024
);
sprintf(stmpdir, "%s%s%s%s", tmpdir, dir_sep, subdirbuf_prefix, username);
! my_mkdir(stmpdir, 0755);
/* Doesn't really work - XXX */
progname = par_findprog(argv[0], strdup(val));