public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Cross-compiling with mingw32
@ 2005-05-23 23:23 Mikael Magnusson
       [not found] ` <1117094471.19617.6.camel@desk.home>
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Magnusson @ 2005-05-23 23:23 UTC (permalink / raw)
  To: pthreads-win32

[-- Attachment #1: Type: text/plain, Size: 461 bytes --]

Hi,

I'm posting a patch that I use to cross-compile with mingw32 on Linux.
It uses macros instead of referencing dlltool, gcc and g++ directly. I have
added a call to ranlib, which was needed. I also had to remove INLINE from
ptw32_relmillisecs, to link the GCE library.

For example the GC static library can be built with:

  make CC=i586-mingw32msvc-gcc RC=i586-mingw32msvc-windres RANLIB=i586-mingw32msvc-ranlib clean GC-static

Regards,
Mikael Magnusson


[-- Attachment #2: pthreads-w32-2-6-0-cross.patch --]
[-- Type: text/plain, Size: 5341 bytes --]

--- ./GNUmakefile.orig	2005-04-25 16:42:39.000000000 +0200
+++ ./GNUmakefile	2005-05-23 18:11:49.000000000 +0200
@@ -49,6 +49,10 @@
 #CP	= copy
 
 AR	= ar
+DLLTOOL = dlltool
+CC      = gcc
+CXX     = g++
+RANLIB  = ranlib
 
 OPT	= $(CLEANUP) -O3 -finline-functions
 DOPT	= $(CLEANUP) -g -O0
@@ -454,34 +458,34 @@
 	@ $(MAKE) clean GC
 
 GC:
-		$(MAKE) CC=gcc CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL)
+		$(MAKE) CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" $(GC_DLL)
 
 GC-debug:
-		$(MAKE) CC=gcc CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_DLL)
+		$(MAKE) CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_DLL)
 
 GCE:
-		$(MAKE) CC=g++ CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL)
+		$(MAKE) CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" $(GCE_DLL)
 
 GCE-debug:
-		$(MAKE) CC=g++ CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCED_DLL)
+		$(MAKE) CC=$(CXX) CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCED_DLL)
 
 GC-inlined:
-		$(MAKE) CC=gcc XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_INLINED_STAMP)
+		$(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_INLINED_STAMP)
 
 GC-inlined-debug:
-		$(MAKE) CC=gcc XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_INLINED_STAMP)
+		$(MAKE) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_INLINED_STAMP)
 
 GCE-inlined:
-		$(MAKE) CC=g++ XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP)
+		$(MAKE) CC=$(CXX) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GCE_INLINED_STAMP)
 
 GCE-inlined-debug:
-		$(MAKE) CC=g++ XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCED_INLINED_STAMP)
+		$(MAKE) CC=$(CXX) XOPT="-DPTW32_BUILD_INLINED" CLEANUP=-D__CLEANUP_CXX XC_FLAGS="$(GCE_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCED_INLINED_STAMP)
 
 GC-static:
-		$(MAKE) CC=gcc XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_STATIC_STAMP)
+		$(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" $(GC_STATIC_STAMP)
 
 GC-static-debug:
-		$(MAKE) CC=gcc XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_STATIC_STAMP)
+		$(MAKE) XOPT="-DPTW32_BUILD_INLINED -DPTW32_STATIC_LIB" CLEANUP=-D__CLEANUP_C XC_FLAGS="$(GC_CFLAGS)" OBJ="$(DLL_INLINED_OBJS)" DLL_VER=$(DLL_VERD) OPT="$(DOPT)" $(GCD_STATIC_STAMP)
 
 tests:
 	@ cd tests
@@ -503,29 +507,30 @@
 
 $(GC_DLL) $(GCD_DLL): $(DLL_OBJS)
 	$(CC) $(OPT) -shared -o $(GC_DLL) $(DLL_OBJS) $(LFLAGS)
-	dlltool -z pthread.def $(DLL_OBJS)
-	dlltool -k --dllname $@ --output-lib $(GC_LIB) --def $(PTHREAD_DEF)
+	$(DLLTOOL) -z pthread.def $(DLL_OBJS)
+	$(DLLTOOL) -k --dllname $@ --output-lib $(GC_LIB) --def $(PTHREAD_DEF)
 
 $(GCE_DLL): $(DLL_OBJS)
 	$(CC) $(OPT) -mthreads -shared -o $(GCE_DLL) $(DLL_OBJS) $(LFLAGS)
-	dlltool -z pthread.def $(DLL_OBJS)
-	dlltool -k --dllname $@ --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
+	$(DLLTOOL) -z pthread.def $(DLL_OBJS)
+	$(DLLTOOL) -k --dllname $@ --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
 
 $(GC_INLINED_STAMP) $(GCD_INLINED_STAMP): $(DLL_INLINED_OBJS)
 	$(CC) $(OPT) $(XOPT) -shared -o $(GC_DLL) $(DLL_INLINED_OBJS) $(LFLAGS)
-	dlltool -z pthread.def $(DLL_INLINED_OBJS)
-	dlltool -k --dllname $(GC_DLL) --output-lib $(GC_LIB) --def $(PTHREAD_DEF)
+	$(DLLTOOL) -z pthread.def $(DLL_INLINED_OBJS)
+	$(DLLTOOL) -k --dllname $(GC_DLL) --output-lib $(GC_LIB) --def $(PTHREAD_DEF)
 	echo touched > $(GC_INLINED_STAMP)
 
 $(GCE_INLINED_STAMP) $(GCED_INLINED_STAMP): $(DLL_INLINED_OBJS)
 	$(CC) $(OPT) $(XOPT) -mthreads -shared -o $(GCE_DLL) $(DLL_INLINED_OBJS)  $(LFLAGS)
-	dlltool -z pthread.def $(DLL_INLINED_OBJS)
-	dlltool -k --dllname $(GCE_DLL) --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
+	$(DLLTOOL) -z pthread.def $(DLL_INLINED_OBJS)
+	$(DLLTOOL) -k --dllname $(GCE_DLL) --output-lib $(GCE_LIB) --def $(PTHREAD_DEF)
 	echo touched > $(GCE_INLINED_STAMP)
 
 $(GC_STATIC_STAMP) $(GCD_STATIC_STAMP): $(DLL_INLINED_OBJS)
 	$(RM) $(GC_LIB)
 	$(AR) -rv $(GC_LIB) $(DLL_INLINED_OBJS)
+	$(RANLIB) $(GC_LIB)
 	echo touched > $(GC_STATIC_STAMP)
 
 clean:
--- ./ptw32_relmillisecs.c.orig	2005-04-25 16:42:42.000000000 +0200
+++ ./ptw32_relmillisecs.c	2005-05-23 16:30:15.000000000 +0200
@@ -44,7 +44,7 @@
 #endif
 
 
-INLINE DWORD 
+DWORD
 ptw32_relmillisecs (const struct timespec * abstime)
 {
   const int64_t NANOSEC_PER_MILLISEC = 1000000;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Cross-compiling with mingw32
       [not found] ` <1117094471.19617.6.camel@desk.home>
@ 2005-05-30 19:53   ` Mikael Magnusson
  0 siblings, 0 replies; 2+ messages in thread
From: Mikael Magnusson @ 2005-05-30 19:53 UTC (permalink / raw)
  To: pthreads-win32

Ross Johnson wrote:
> On Tue, 2005-05-24 at 01:22 +0200, Mikael Magnusson wrote: 
> 
>>Hi,
>>
>>I'm posting a patch that I use to cross-compile with mingw32 on Linux.
>>It uses macros instead of referencing dlltool, gcc and g++ directly. I have
>>added a call to ranlib, which was needed. I also had to remove INLINE from
>>ptw32_relmillisecs, to link the GCE library.
> 
> 
> Thanks for the lead. This is very convenient. I've installed the cross-
> tools and can build the library.
> 
> What was the problem with the INLINE in ptw32_relmillisecs()? Seems to
> build ok using the cross-tools and passes the test suite in Windows. Why
> only this routine?
> 

I thought there was a problem, but I obviously were incorrect, since 
when I tried building the library again without modifying 
ptw32_relmillisecs, there was no problem.

/Mikael Magnusson

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-05-30 19:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-23 23:23 [PATCH] Cross-compiling with mingw32 Mikael Magnusson
     [not found] ` <1117094471.19617.6.camel@desk.home>
2005-05-30 19:53   ` Mikael Magnusson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).