[haiku-development] Re: building under Cygwin (windows)

2007/5/31, Urias McCullough <umccullough@xxxxxxxxx>:

In any case, I have a fresh environment set up, managed mount created,
and I'm downloading the source now - should be done by morning (my
internet connection is that bad, yes...)

Here's the diff with the changes I made (cc'ing you privately because
I'm not sure the attachment will go through the list). I started from
your diffs and only made the other needed changes.
Index: build/jam/MainBuildRules
===================================================================
--- build/jam/MainBuildRules    (revision 21227)
+++ build/jam/MainBuildRules    (working copy)
@@ -51,6 +51,7 @@
        AddResources $(1) : $(4) ;
        Main $(1) : $(2) ;
        LinkAgainst $(1) : $(3) ;
+       
        LINKFLAGS on $(1) = [ on $(1) return $(LINKFLAGS) ]
                -Xlinker -soname=_APP_ ;
 
@@ -461,6 +462,9 @@
        if $(HOST_PLATFORM) = darwin {
                LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
                        -dynamic -dynamiclib -Xlinker -flat_namespace ;
+       } else if $(HOST_PLATFORM) = cygwin {
+               LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
+                       -shared -Xlinker --allow-multiple-definition ;
        } else {
                LINKFLAGS on $(target) = [ on $(target) return $(LINKFLAGS) ]
                        -shared -Xlinker -soname=\"$(target:G=)\" ;
Index: build/jam/BuildSetup
===================================================================
--- build/jam/BuildSetup        (revision 21227)
+++ build/jam/BuildSetup        (working copy)
@@ -346,16 +346,20 @@
 
 # check the host platform compatibility
 SetPlatformCompatibilityFlagVariables HOST_PLATFORM : HOST : host
-       : linux freebsd darwin ;
+       : linux freebsd darwin cygwin ;
 
 if $(HOST_PLATFORM) = linux || $(HOST_PLATFORM) = freebsd
-       || $(HOST_PLATFORM) = darwin {
+       || $(HOST_PLATFORM) = darwin || $(HOST_PLATFORM) = cygwin {
        # don't use lex: otherwise rc will not work correctly
        if $(LEX) = lex {
                LEX = flex ;
        }
 }
 
+if $(HOST_PLATFORM) = cygwin {
+       HOST_LINKFLAGS += -Xlinker --allow-multiple-definition ;
+}
+
 HOST_CPU       ?= $(OSPLAT:L) ;
 
 HOST_ARCH                              ?= $(HOST_CPU) ;
@@ -656,6 +660,7 @@
        case linux              : TARGET_DEFINES        += 
HAIKU_TARGET_PLATFORM_LINUX ;
        case freebsd    : TARGET_DEFINES        += 
HAIKU_TARGET_PLATFORM_FREEBSD ;
        case darwin             : TARGET_DEFINES        += 
HAIKU_TARGET_PLATFORM_DARWIN ;
+       case cygwin     : TARGET_DEFINES        += HAIKU_TARGET_PLATFORM_CYGWIN 
;
        case libbe_test : TARGET_DEFINES        += 
HAIKU_TARGET_PLATFORM_LIBBE_TEST ;
 }
 
@@ -668,6 +673,8 @@
        case linux              : HOST_DEFINES  += HAIKU_HOST_PLATFORM_LINUX ;
        case freebsd    : HOST_DEFINES  += HAIKU_HOST_PLATFORM_FREEBSD ;
        case darwin             : HOST_DEFINES  += HAIKU_HOST_PLATFORM_DARWIN ;
+       case cygwin     : HOST_DEFINES  += HAIKU_HOST_PLATFORM_CYGWIN ;
+
 }
 
 
Index: configure
===================================================================
--- configure   (revision 21227)
+++ configure   (working copy)
@@ -293,6 +293,7 @@
        Linux)  buildPlatform=linux ;;
        FreeBSD) buildPlatform=freebsd ;;
        Darwin) buildPlatform=darwin ;;
+       CYGWIN_NT-5.1) buildPlatform=cygwin ;;
        *)              echo Unsupported platform: ${platform}
                        exit 1 ;;
 esac
Index: src/build/libroot/errors.cpp
===================================================================
--- src/build/libroot/errors.cpp        (revision 21227)
+++ src/build/libroot/errors.cpp        (working copy)
@@ -75,7 +75,9 @@
        ADD_ERROR(ENOTSOCK);
        ADD_ERROR(EHOSTDOWN);
        ADD_ERROR(EBADMSG);
-       ADD_ERROR(ECANCELED);
+       #ifdef ECANCELED
+               ADD_ERROR(ECANCELED);
+    #endif
        ADD_ERROR(EDESTADDRREQ);
        ADD_ERROR(EDQUOT);
        ADD_ERROR(EIDRM);
Index: src/build/libroot/Jamfile
===================================================================
--- src/build/libroot/Jamfile   (revision 21227)
+++ src/build/libroot/Jamfile   (working copy)
@@ -35,10 +35,11 @@
        strlcpy.c
        strlcat.c
        strnlen.c
+       stpcpy.c
 
        :
        $(HOST_LIBSTDC++)
 ;
 
-SEARCH on [ FGristFiles strlcat.c strlcpy.c strnlen.c ]
+SEARCH on [ FGristFiles strlcat.c strlcpy.c strnlen.c stpcpy.c ]
        = [ FDirName $(HAIKU_TOP) src system libroot posix string ] ;
Index: src/tools/fs_shell/unistd.cpp
===================================================================
--- src/tools/fs_shell/unistd.cpp       (revision 21227)
+++ src/tools/fs_shell/unistd.cpp       (working copy)
@@ -20,7 +20,8 @@
 #      include <Drivers.h>
 #else
 #      if defined(HAIKU_HOST_PLATFORM_FREEBSD) \
-               || defined(HAIKU_HOST_PLATFORM_DARWIN)
+               || defined(HAIKU_HOST_PLATFORM_DARWIN) \
+               || defined(HAIKU_HOST_PLATFORM_CYGWIN)
 #              include <sys/ioctl.h>
 #      else
                // the (POSIX) correct place of definition for ioctl()
Index: headers/build/BeOSBuildCompatibility.h
===================================================================
--- headers/build/BeOSBuildCompatibility.h      (revision 21227)
+++ headers/build/BeOSBuildCompatibility.h      (working copy)
@@ -4,6 +4,10 @@
 typedef unsigned long haiku_build_addr_t;
 #define addr_t haiku_build_addr_t
 
+#if defined(HAIKU_HOST_PLATFORM_CYGWIN)
+#define __addr_t_defined       
+#endif
+
 #include <Errors.h>
 #include <sys/types.h>
 #include <string.h>
@@ -20,6 +24,10 @@
 extern size_t  strnlen(const char *string, size_t length);
 #endif
 
+#if defined(HAIKU_HOST_PLATFORM_CYGWIN)
+extern char * stpcpy(char *dest, const char *src);
+#endif
+
 // BeOS only
 extern ssize_t  read_pos(int fd, off_t pos, void *buffer, size_t count);
 extern ssize_t  write_pos(int fd, off_t pos, const void *buffer, size_t count);

Other related posts: