[Xapian-devel] Fixes for omega under Windows

Charlie Hull charlie at juggler.net
Thu Apr 19 13:36:24 BST 2007


Hi all,

There's been a lot of changes to Omega recently and the Windows build 
wasn't working; I've attached a patch which should fix this. It's mainly 
a lot of changes to use the "safe..." versions of header files.

Cheers

Charlie
-------------- next part --------------
Index: xapian-applications/omega/configfile.cc
===================================================================
--- xapian-applications/omega/configfile.cc	(revision 8311)
+++ xapian-applications/omega/configfile.cc	(working copy)
@@ -26,10 +26,11 @@
 #include <iostream>
 
 #include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
 #include <stdlib.h>
 
+#include "safesysstat.h"
+#include "safeunistd.h"
+
 #include "configfile.h"
 
 using namespace std;
Index: xapian-applications/omega/loadfile.cc
===================================================================
--- xapian-applications/omega/loadfile.cc	(revision 8311)
+++ xapian-applications/omega/loadfile.cc	(working copy)
@@ -32,9 +32,10 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
 
+#include "safesysstat.h"
+#include "safeunistd.h"
+
 #ifndef O_STREAMING
 # ifdef __linux__
 // This is the value used by rml's O_STREAMING patch for 2.4.
Index: xapian-applications/omega/md5wrap.cc
===================================================================
--- xapian-applications/omega/md5wrap.cc	(revision 8311)
+++ xapian-applications/omega/md5wrap.cc	(working copy)
@@ -30,8 +30,10 @@
 
 #include <fcntl.h>
 #include <errno.h>
-#include <unistd.h>
 
+#include "safesysstat.h"
+#include "safeunistd.h"
+
 #ifndef O_STREAMING
 # ifdef __linux__
 // This is the value used by rml's O_STREAMING patch for 2.4.
Index: xapian-applications/omega/omindex.cc
===================================================================
--- xapian-applications/omega/omindex.cc	(revision 8311)
+++ xapian-applications/omega/omindex.cc	(working copy)
@@ -32,14 +32,16 @@
 
 #include <sys/types.h>
 #include <dirent.h>
-#include <sys/stat.h>
-#include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <time.h>
 
+#include "safesysstat.h"
+#include "safeunistd.h"
+
 #include <xapian.h>
 
 #include "commonhelp.h"
Index: xapian-applications/omega/portability/mkdtemp.cc
===================================================================
--- xapian-applications/omega/portability/mkdtemp.cc	(revision 8311)
+++ xapian-applications/omega/portability/mkdtemp.cc	(working copy)
@@ -31,11 +31,21 @@
  */
 
 #include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
 
+#include "safesysstat.h"
+#include "safeunistd.h"
+
 #include <errno.h>
 
+#ifdef __CYGWIN__
+# include "safewindows.h"
+# include <sys/cygwin.h>
+#elif defined __WIN32__
+# include "safewindows.h"
+# define getpid() GetCurrentProcessId()
+typedef int pid_t;
+#endif
+
 static int
 do_mkdtemp(char *path)
 {
Index: xapian-applications/omega/query.cc
===================================================================
--- xapian-applications/omega/query.cc	(revision 8311)
+++ xapian-applications/omega/query.cc	(working copy)
@@ -40,7 +40,7 @@
 #endif
 #include <time.h>
 
-#include <unistd.h>
+#include "safeunistd.h"
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
Index: xapian-applications/omega/scriptindex.cc
===================================================================
--- xapian-applications/omega/scriptindex.cc	(revision 8311)
+++ xapian-applications/omega/scriptindex.cc	(working copy)
@@ -35,8 +35,10 @@
 
 #include <errno.h>
 #include <stdio.h>
-#include <unistd.h>
 
+#include "safeunistd.h"
+#include <time.h>
+
 #include "commonhelp.h"
 #include "hashterm.h"
 #include "indextext.h"
Index: xapian-core/common/safesysstat.h
===================================================================
--- xapian-core/common/safesysstat.h	(revision 8311)
+++ xapian-core/common/safesysstat.h	(working copy)
@@ -59,6 +59,8 @@
 // number of conditionalised #include statements we need in the sources.
 #include <direct.h>
 
+typedef int mode_t;
+
 // Add overloaded version of mkdir which takes an (ignored) mode argument
 // to allow source code to just specify a mode argument unconditionally.
 inline int (mkdir)(const char *pathname, mode_t /*mode*/) {
Index: xapian-maintainer-tools/win32msvc/win32_applications_omega.mak
===================================================================
--- xapian-maintainer-tools/win32msvc/win32_applications_omega.mak	(revision 8311)
+++ xapian-maintainer-tools/win32msvc/win32_applications_omega.mak	(working copy)
@@ -31,12 +31,10 @@
 OUTEXEDIR=$(XAPIAN_CORE_REL_OMEGA)\win32\$(XAPIAN_DEBUG_OR_RELEASE)
 
 PROGRAMS =   "$(OUTEXEDIR)\scriptindex.exe" "$(OUTEXEDIR)\omindex.exe" "$(OUTEXEDIR)\omega.exe" \
-"$(OUTEXEDIR)\md5test.exe" "$(OUTEXEDIR)\htmlparsetest.exe" "$(OUTEXEDIR)\utf8test.exe" 
+"$(OUTEXEDIR)\md5test.exe" "$(OUTEXEDIR)\htmlparsetest.exe"
 
 ALL : $(PROGRAMS) 
-	
 
-
 OMEGA_OBJS= \
 	"$(OUTDIR)\omega.obj" \
 	"$(OUTDIR)\query.obj" \
@@ -51,7 +49,6 @@
  	"$(OUTDIR)\indextext.obj" \
  	"$(OUTDIR)\loadfile.obj" \
  	"$(OUTDIR)\utf8convert.obj" \
- 	"$(OUTDIR)\utf8itor.obj" \
  	"$(OUTDIR)\datematchdecider.obj" 
   
 
@@ -71,8 +68,9 @@
  	"$(OUTDIR)\xmlparse.obj" \
  	"$(OUTDIR)\metaxmlparse.obj" \
  	"$(OUTDIR)\utf8convert.obj" \
- 	"$(OUTDIR)\utf8itor.obj" \
- 	"$(OUTDIR)\tclUniData.obj" 
+	"$(OUTDIR)\mkdtemp.obj" \
+	"$(OUTDIR)\sample.obj"
+
   
 
 SCRIPTINDEX_OBJS= \
@@ -86,24 +84,19 @@
 	"$(OUTDIR)\hashterm.obj" \
 	"$(OUTDIR)\loadfile.obj" \
 	"$(OUTDIR)\utf8convert.obj" \
- 	"$(OUTDIR)\utf8itor.obj" 
+	"$(OUTDIR)\utf8truncate.obj" 
 	
 HTMLPARSETEST_OBJS= \
  	"$(OUTDIR)\htmlparsetest.obj" \
 	"$(OUTDIR)\myhtmlparse.obj" \
  	"$(OUTDIR)\htmlparse.obj" \
-	"$(OUTDIR)\utf8convert.obj" \
- 	"$(OUTDIR)\utf8itor.obj" 
+	"$(OUTDIR)\utf8convert.obj" 
 
 MD5TEST_OBJS= \
  	"$(OUTDIR)\md5.obj" \
  	"$(OUTDIR)\md5wrap.obj" \
  	"$(OUTDIR)\md5test.obj" 
 	
-UTF8TEST_OBJS= \
- 	"$(OUTDIR)\utf8test.obj" \
- 	"$(OUTDIR)\utf8itor.obj"
-	
 
 CLEAN :
 	- at erase $(PROGRAMS)
@@ -112,14 +105,12 @@
 	- at erase $(SCRIPTINDEX_OBJS)
 	- at erase $(HTMLPARSETEST_OBJS)
 	- at erase $(MD5TEST_OBJS)
-	- at erase $(UTF8TEST_OBJS)
 
 #"$(OUTDIR)" :
 #    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
 
 CPP_PROJ=$(CPPFLAGS_EXTRA) \
  /I "." /I "$(XAPIAN_CORE_REL_OMEGA)" /I "$(XAPIAN_CORE_REL_OMEGA)\common" /I "$(XAPIAN_CORE_REL_OMEGA)\include" /I "$(XAPIAN_CORE_REL_OMEGA)\win32" \
- /DCONFIGFILE_SYSTEM=NULL \
  /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /Tp$(INPUTNAME) 
 
 CPP_OBJS=..\win32\$(XAPIAN_DEBUG_OR_RELEASE)
@@ -163,12 +154,6 @@
   $(ALL_LINK32_FLAGS) /out:"$(OUTEXEDIR)\md5test.exe" $(DEF_FLAGS) $(MD5TEST_OBJS)
 <<
 
-"$(OUTEXEDIR)\utf8test.exe" : "$(OUTEXEDIR)" $(DEF_FILE) $(UTF8TEST_OBJS)
-                      $(PROGRAM_DEPENDENCIES)
-    $(LINK32) @<<
-  $(ALL_LINK32_FLAGS) /out:"$(OUTEXEDIR)\utf8test.exe" $(DEF_FLAGS) $(UTF8TEST_OBJS)
-<<
-
 "$(INTDIR)\dirent.obj" : "$(XAPIAN_CORE_REL_OMEGA)\win32\dirent.c"
         $(CPP) @<<
    $(CPP_PROJ) $**
@@ -285,7 +270,7 @@
    $(CPP_PROJ) $**
 <<
 
-"$(INTDIR)\utf8itor.obj" : ".\utf8itor.cc"
+"$(INTDIR)\utf8truncate.obj" : ".\utf8truncate.cc"
         $(CPP) @<<
    $(CPP_PROJ) $**
 <<
@@ -295,11 +280,6 @@
    $(CPP_PROJ) $**
 <<
 
-"$(INTDIR)\tclUniData.obj" : ".\tclUniData.cc"
-        $(CPP) @<<
-   $(CPP_PROJ) $**
-<<
-
 "$(INTDIR)\md5test.obj" : ".\md5test.cc"
         $(CPP) @<<
    $(CPP_PROJ) $**
@@ -326,6 +306,16 @@
    $(CPP_PROJ) $**
 <<
 
+"$(INTDIR)\mkdtemp.obj" : ".\portability\mkdtemp.cc"
+        $(CPP) @<<
+   $(CPP_PROJ) $**
+<<
+
+"$(INTDIR)\sample.obj" : ".\sample.cc"
+        $(CPP) @<<
+   $(CPP_PROJ) $**
+<<
+
 .c{$(CPP_OBJS)}.obj::
    $(CPP) @<<
    $(CPP_PROJ) $<


More information about the Xapian-devel mailing list