Thread: Makefiles for building with mingw32 on win32
Makefiles for building the win32 parts with the native (mingw32) mode of gcc. Currently, only libpq is implemented because I only cared for that :-) Supports cross-compilation and includes documentation updates. So people don't need to spend big $$$ for Visual C++ :-) Gerhard -- mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/doc/src/sgml/install-win32.sgml ./doc/src/sgml/install-win32.sgml *** ../pgsql_HEAD/doc/src/sgml/install-win32.sgml Sun May 13 00:51:35 2001 --- ./doc/src/sgml/install-win32.sgml Mon Aug 27 06:59:52 2001 *************** *** 111,116 **** --- 111,134 ---- C++, just right-click on the project and chose to add it.) </para> + <para> + Alternatively, you can use the native mode of the GNU compilers (minimalist + GNU win32 - mingw32) to compile the win32 parts of PostgreSQL. + Currently, only libpq has a Makefile suitable for compilation with mingw32. + </para> + <para> + To build everything that you can with GNU tools on + <productname>Windows</productname>, change into the + <filename>src</filename> directory and type the command + <screen> + <userinput>make -f mingw32.mak</userinput> + </screen> + This assumes that you are the<productname>Cygnus Toolkit</productname>'s bash + shell or have a suitable mingw32 environment with make and gcc installed. The + Makefiles also support cross-compilation. + </para> + + </chapter> <!-- Keep this comment at the end of the file diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/src/interfaces/libpq/mingw32.mak ./src/interfaces/libpq/mingw32.mak *** ../pgsql_HEAD/src/interfaces/libpq/mingw32.mak Thu Jan 1 01:00:00 1970 --- ./src/interfaces/libpq/mingw32.mak Fri Aug 24 08:34:24 2001 *************** *** 0 **** --- 1,66 ---- + # Makefile for compiling a native win32 libpq with GNU tools (GNU make) + # ===================================================================== + # + # To build an optimized non-debug library, simply compile with + # $ make -f mingw32.mak + # + # To cross-compile from FreeBSD/Linux/..., compile with + # $ make -f mingw32.mak PREFIX=i386-mingw32msvc- + # + # To build the library with debugging support, compile with + # $ make -f mingw32.mak OPT=-g LDOPT= + # + # To build the library with multibyte support, compile with + # $ make -f mingw32.mak MULTIBYTE=1 + # + # You can combine any of the above. + + ##################################################################### + # You can change these parameters on the commandline: + ##################################################################### + PREFIX= + OPT=-O3 + MULTIBYTE=0 + LDOPT=-s + ##################################################################### + + + DEFINES=-DFRONTEND -DHAVE_VSNPRINTF -DHAVE_STRDUP + ifeq (1,$(MULTIBYTE)) + DEFINES := $(DEFINES) -DMULTIBYTE=1 + endif + + CFLAGS=-mno-cygwin -Wall $(OPT) $(DEFINES) + CC=$(PREFIX)gcc + DLLTOOL=$(PREFIX)dlltool + DLLWRAP=$(PREFIX)dllwrap + + INC=-I../../../src/include/ + LIBS=-lwsock32 + + objects=fe-auth.o fe-connect.o fe-exec.o fe-lobj.o fe-misc.o fe-print.o libpqdll.o pqexpbuffer.o pqsignal.o ../../backend/lib/dllist.o../../backend/libpq/md5.o + ifeq (1,$(MULTIBYTE)) + objects := $(objects) ../../backend/utils/mb/wchar.o + endif + + # Default target + ALL: libpq.dll libpqdll.a libpq.a + + $(objects): %.o: %.c + $(CC) -c $(CFLAGS) $(INC) $< -o $@ + + # Building the DLL. + libpq.dll: $(objects) libpqdll.def + $(DLLWRAP) -mno-cygwin --dllname libpq.dll --driver-name $(CC) --def libpqdll.def -o libpq.dll $(objects) $(LDOPT)--entry _DllMain@12 --target=i386-mingw32 $(LIBS) + + # The import library for the DLL. + libpqdll.a: libpq.dll + $(DLLTOOL) --def libpqdll.def --dllname libpq.dll --output-lib libpqdll.a + + # A static library. + libpq.a: $(objects) + ar -r libpq.a $(objects) + + clean: + rm -f $(objects) *.dll *.a *~ + Binary files ../pgsql_HEAD/src/interfaces/libpq/pqexpbuffer.o and ./src/interfaces/libpq/pqexpbuffer.o differ Binary files ../pgsql_HEAD/src/interfaces/libpq/pqsignal.o and ./src/interfaces/libpq/pqsignal.o differ diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/src/mingw32.mak ./src/mingw32.mak *** ../pgsql_HEAD/src/mingw32.mak Thu Jan 1 01:00:00 1970 --- ./src/mingw32.mak Mon Aug 27 07:02:04 2001 *************** *** 0 **** --- 1,20 ---- + # Makefile for mingw32 mode of gcc + # + # Only compiles libpq so far. + # See interfaces/libpq/mingw32.mak for options! + # + # Note that most parts are not ported to Win32! + + ALL: docopy libpq + + docopy: + # TODO copy only if target doesn't exist + cp include/config.h.win32 include/config.h + + libpq: + cd interfaces/libpq && $(MAKE) -e -f mingw32.mak + -echo All Win32 parts have been built! + + clean: + cd interfaces/libpq && $(MAKE) -e -f mingw32.mak clean +
Gerhard Häring writes: > Makefiles for building the win32 parts with the native (mingw32) mode of gcc. > Currently, only libpq is implemented because I only cared for that :-) Can't you run configure on mingw32? -- Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
Peter Eisentraut wrote: >Gerhard Häring writes: > >>Makefiles for building the win32 parts with the native (mingw32) mode of gcc. >>Currently, only libpq is implemented because I only cared for that :-) >> > >Can't you run configure on mingw32? > It doesn't work on my system. If somebody gets this to work, why not submit a patch to the documentation? I am not a Makefile hacker, let alone an autoconf hacker, so I can't debug that. -- Gerhard
Your patch has been added to the PostgreSQL unapplied patches list at: http://candle.pha.pa.us/cgi-bin/pgpatches I will try to apply it within the next 48 hours. > Makefiles for building the win32 parts with the native (mingw32) mode of gcc. > Currently, only libpq is implemented because I only cared for that :-) > Supports cross-compilation and includes documentation updates. So people don't > need to spend big $$$ for Visual C++ :-) > > Gerhard > -- > mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 > web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage > public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 > reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) > diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/doc/src/sgml/install-win32.sgml ./doc/src/sgml/install-win32.sgml > *** ../pgsql_HEAD/doc/src/sgml/install-win32.sgml Sun May 13 00:51:35 2001 > --- ./doc/src/sgml/install-win32.sgml Mon Aug 27 06:59:52 2001 > *************** > *** 111,116 **** > --- 111,134 ---- > C++, just right-click on the project and chose to add it.) > </para> > > + <para> > + Alternatively, you can use the native mode of the GNU compilers (minimalist > + GNU win32 - mingw32) to compile the win32 parts of PostgreSQL. > + Currently, only libpq has a Makefile suitable for compilation with mingw32. > + </para> > + <para> > + To build everything that you can with GNU tools on > + <productname>Windows</productname>, change into the > + <filename>src</filename> directory and type the command > + <screen> > + <userinput>make -f mingw32.mak</userinput> > + </screen> > + This assumes that you are the<productname>Cygnus Toolkit</productname>'s bash > + shell or have a suitable mingw32 environment with make and gcc installed. The > + Makefiles also support cross-compilation. > + </para> > + > + > </chapter> > > <!-- Keep this comment at the end of the file > diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/src/interfaces/libpq/mingw32.mak ./src/interfaces/libpq/mingw32.mak > *** ../pgsql_HEAD/src/interfaces/libpq/mingw32.mak Thu Jan 1 01:00:00 1970 > --- ./src/interfaces/libpq/mingw32.mak Fri Aug 24 08:34:24 2001 > *************** > *** 0 **** > --- 1,66 ---- > + # Makefile for compiling a native win32 libpq with GNU tools (GNU make) > + # ===================================================================== > + # > + # To build an optimized non-debug library, simply compile with > + # $ make -f mingw32.mak > + # > + # To cross-compile from FreeBSD/Linux/..., compile with > + # $ make -f mingw32.mak PREFIX=i386-mingw32msvc- > + # > + # To build the library with debugging support, compile with > + # $ make -f mingw32.mak OPT=-g LDOPT= > + # > + # To build the library with multibyte support, compile with > + # $ make -f mingw32.mak MULTIBYTE=1 > + # > + # You can combine any of the above. > + > + ##################################################################### > + # You can change these parameters on the commandline: > + ##################################################################### > + PREFIX= > + OPT=-O3 > + MULTIBYTE=0 > + LDOPT=-s > + ##################################################################### > + > + > + DEFINES=-DFRONTEND -DHAVE_VSNPRINTF -DHAVE_STRDUP > + ifeq (1,$(MULTIBYTE)) > + DEFINES := $(DEFINES) -DMULTIBYTE=1 > + endif > + > + CFLAGS=-mno-cygwin -Wall $(OPT) $(DEFINES) > + CC=$(PREFIX)gcc > + DLLTOOL=$(PREFIX)dlltool > + DLLWRAP=$(PREFIX)dllwrap > + > + INC=-I../../../src/include/ > + LIBS=-lwsock32 > + > + objects=fe-auth.o fe-connect.o fe-exec.o fe-lobj.o fe-misc.o fe-print.o libpqdll.o pqexpbuffer.o pqsignal.o ../../backend/lib/dllist.o../../backend/libpq/md5.o > + ifeq (1,$(MULTIBYTE)) > + objects := $(objects) ../../backend/utils/mb/wchar.o > + endif > + > + # Default target > + ALL: libpq.dll libpqdll.a libpq.a > + > + $(objects): %.o: %.c > + $(CC) -c $(CFLAGS) $(INC) $< -o $@ > + > + # Building the DLL. > + libpq.dll: $(objects) libpqdll.def > + $(DLLWRAP) -mno-cygwin --dllname libpq.dll --driver-name $(CC) --def libpqdll.def -o libpq.dll $(objects) $(LDOPT)--entry _DllMain@12 --target=i386-mingw32 $(LIBS) > + > + # The import library for the DLL. > + libpqdll.a: libpq.dll > + $(DLLTOOL) --def libpqdll.def --dllname libpq.dll --output-lib libpqdll.a > + > + # A static library. > + libpq.a: $(objects) > + ar -r libpq.a $(objects) > + > + clean: > + rm -f $(objects) *.dll *.a *~ > + > Binary files ../pgsql_HEAD/src/interfaces/libpq/pqexpbuffer.o and ./src/interfaces/libpq/pqexpbuffer.o differ > Binary files ../pgsql_HEAD/src/interfaces/libpq/pqsignal.o and ./src/interfaces/libpq/pqsignal.o differ > diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/src/mingw32.mak ./src/mingw32.mak > *** ../pgsql_HEAD/src/mingw32.mak Thu Jan 1 01:00:00 1970 > --- ./src/mingw32.mak Mon Aug 27 07:02:04 2001 > *************** > *** 0 **** > --- 1,20 ---- > + # Makefile for mingw32 mode of gcc > + # > + # Only compiles libpq so far. > + # See interfaces/libpq/mingw32.mak for options! > + # > + # Note that most parts are not ported to Win32! > + > + ALL: docopy libpq > + > + docopy: > + # TODO copy only if target doesn't exist > + cp include/config.h.win32 include/config.h > + > + libpq: > + cd interfaces/libpq && $(MAKE) -e -f mingw32.mak > + -echo All Win32 parts have been built! > + > + clean: > + cd interfaces/libpq && $(MAKE) -e -f mingw32.mak clean > + > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Gerhard Häring writes: > >Can't you run configure on mingw32? > > > It doesn't work on my system. If somebody gets this to work, why not > submit a patch to the documentation? What do you mean with "work"? You don't have a shell, configure aborts with an error, ...? It would be a whole lot prettier to make this work instead of having to maintain yet another non-standard makefile. -- Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
On Tue, Sep 04, 2001 at 02:42:28AM +0200, Peter Eisentraut wrote: > Gerhard Häring writes: > > > >Can't you run configure on mingw32? > > > > > It doesn't work on my system. If somebody gets this to work, why not > > submit a patch to the documentation? > > What do you mean with "work"? You don't have a shell, configure aborts > with an error, ...? Yes, with "C compiler cannot create executables.". > It would be a whole lot prettier to make this work I agree that it would be "prettier", but I am not willing to make enourmous efforts myself (i. e. learn several new tools and langauges like awk, m4) for this. I know next to zero autoconf, so I will need assistance. Are you volonteering? Where should I ask questions? On the cygwin-pgsql list I suppose. > instead of having to maintain yet another non-standard makefile. You could remove the Visual C++ support so there's only one non-standard Makefile to maintain. ;-) So? Gerhard -- mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
We are waiting to see if you can get the existing Win32 makefiles to work on both compilers, right? > Makefiles for building the win32 parts with the native (mingw32) mode of gcc. > Currently, only libpq is implemented because I only cared for that :-) > Supports cross-compilation and includes documentation updates. So people don't > need to spend big $$$ for Visual C++ :-) > > Gerhard > -- > mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 > web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage > public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 > reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) > diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/doc/src/sgml/install-win32.sgml ./doc/src/sgml/install-win32.sgml > *** ../pgsql_HEAD/doc/src/sgml/install-win32.sgml Sun May 13 00:51:35 2001 > --- ./doc/src/sgml/install-win32.sgml Mon Aug 27 06:59:52 2001 > *************** > *** 111,116 **** > --- 111,134 ---- > C++, just right-click on the project and chose to add it.) > </para> > > + <para> > + Alternatively, you can use the native mode of the GNU compilers (minimalist > + GNU win32 - mingw32) to compile the win32 parts of PostgreSQL. > + Currently, only libpq has a Makefile suitable for compilation with mingw32. > + </para> > + <para> > + To build everything that you can with GNU tools on > + <productname>Windows</productname>, change into the > + <filename>src</filename> directory and type the command > + <screen> > + <userinput>make -f mingw32.mak</userinput> > + </screen> > + This assumes that you are the<productname>Cygnus Toolkit</productname>'s bash > + shell or have a suitable mingw32 environment with make and gcc installed. The > + Makefiles also support cross-compilation. > + </para> > + > + > </chapter> > > <!-- Keep this comment at the end of the file > diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/src/interfaces/libpq/mingw32.mak ./src/interfaces/libpq/mingw32.mak > *** ../pgsql_HEAD/src/interfaces/libpq/mingw32.mak Thu Jan 1 01:00:00 1970 > --- ./src/interfaces/libpq/mingw32.mak Fri Aug 24 08:34:24 2001 > *************** > *** 0 **** > --- 1,66 ---- > + # Makefile for compiling a native win32 libpq with GNU tools (GNU make) > + # ===================================================================== > + # > + # To build an optimized non-debug library, simply compile with > + # $ make -f mingw32.mak > + # > + # To cross-compile from FreeBSD/Linux/..., compile with > + # $ make -f mingw32.mak PREFIX=i386-mingw32msvc- > + # > + # To build the library with debugging support, compile with > + # $ make -f mingw32.mak OPT=-g LDOPT= > + # > + # To build the library with multibyte support, compile with > + # $ make -f mingw32.mak MULTIBYTE=1 > + # > + # You can combine any of the above. > + > + ##################################################################### > + # You can change these parameters on the commandline: > + ##################################################################### > + PREFIX= > + OPT=-O3 > + MULTIBYTE=0 > + LDOPT=-s > + ##################################################################### > + > + > + DEFINES=-DFRONTEND -DHAVE_VSNPRINTF -DHAVE_STRDUP > + ifeq (1,$(MULTIBYTE)) > + DEFINES := $(DEFINES) -DMULTIBYTE=1 > + endif > + > + CFLAGS=-mno-cygwin -Wall $(OPT) $(DEFINES) > + CC=$(PREFIX)gcc > + DLLTOOL=$(PREFIX)dlltool > + DLLWRAP=$(PREFIX)dllwrap > + > + INC=-I../../../src/include/ > + LIBS=-lwsock32 > + > + objects=fe-auth.o fe-connect.o fe-exec.o fe-lobj.o fe-misc.o fe-print.o libpqdll.o pqexpbuffer.o pqsignal.o ../../backend/lib/dllist.o../../backend/libpq/md5.o > + ifeq (1,$(MULTIBYTE)) > + objects := $(objects) ../../backend/utils/mb/wchar.o > + endif > + > + # Default target > + ALL: libpq.dll libpqdll.a libpq.a > + > + $(objects): %.o: %.c > + $(CC) -c $(CFLAGS) $(INC) $< -o $@ > + > + # Building the DLL. > + libpq.dll: $(objects) libpqdll.def > + $(DLLWRAP) -mno-cygwin --dllname libpq.dll --driver-name $(CC) --def libpqdll.def -o libpq.dll $(objects) $(LDOPT)--entry _DllMain@12 --target=i386-mingw32 $(LIBS) > + > + # The import library for the DLL. > + libpqdll.a: libpq.dll > + $(DLLTOOL) --def libpqdll.def --dllname libpq.dll --output-lib libpqdll.a > + > + # A static library. > + libpq.a: $(objects) > + ar -r libpq.a $(objects) > + > + clean: > + rm -f $(objects) *.dll *.a *~ > + > Binary files ../pgsql_HEAD/src/interfaces/libpq/pqexpbuffer.o and ./src/interfaces/libpq/pqexpbuffer.o differ > Binary files ../pgsql_HEAD/src/interfaces/libpq/pqsignal.o and ./src/interfaces/libpq/pqsignal.o differ > diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/src/mingw32.mak ./src/mingw32.mak > *** ../pgsql_HEAD/src/mingw32.mak Thu Jan 1 01:00:00 1970 > --- ./src/mingw32.mak Mon Aug 27 07:02:04 2001 > *************** > *** 0 **** > --- 1,20 ---- > + # Makefile for mingw32 mode of gcc > + # > + # Only compiles libpq so far. > + # See interfaces/libpq/mingw32.mak for options! > + # > + # Note that most parts are not ported to Win32! > + > + ALL: docopy libpq > + > + docopy: > + # TODO copy only if target doesn't exist > + cp include/config.h.win32 include/config.h > + > + libpq: > + cd interfaces/libpq && $(MAKE) -e -f mingw32.mak > + -echo All Win32 parts have been built! > + > + clean: > + cd interfaces/libpq && $(MAKE) -e -f mingw32.mak clean > + > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
On Wed, Sep 05, 2001 at 11:19:20PM -0400, Bruce Momjian wrote: > > We are waiting to see if you can get the existing Win32 makefiles to ^^^ erhm!! > work on both compilers, right? I assume you mean getting - setting-weird-environment-variables - calling ./configure with weird parameters - calling make with parameters - hack configure.in - execute autoconf to work, right? > > [me:] > > Makefiles for building the win32 parts with the native (mingw32) mode of gcc Ok. As I said, I need somebody who is knowledgable in autoconf and Cygwin whom I can bug, or better yet, who just steps forward and invests an hour or two to do this, document it and submit a patch. Volunteers/helpers are wery welcome, also in PM, of course. later, Gerhard PS: I'm trying to subscribe to pgsql-cygwin, but it looks as if Majordomo is in a bad mood again. Whom would I write to if I think it is broken? -- mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
OK, I found Peter E saying this: > > >Can't you run configure on mingw32? > > > > > It doesn't work on my system. If somebody gets this to work, why not > > submit a patch to the documentation? > > What do you mean with "work"? You don't have a shell, configure aborts > with an error, ...? It would be a whole lot prettier to make this work > instead of having to maintain yet another non-standard makefile. Can we actually get configure to work on Win32, and if we can, why do we have other Win32 makefiles? I don't understand why Peter E was saying we should use configure either. --------------------------------------------------------------------------- > On Wed, Sep 05, 2001 at 11:19:20PM -0400, Bruce Momjian wrote: > > > > We are waiting to see if you can get the existing Win32 makefiles to > ^^^ erhm!! > > work on both compilers, right? > > I assume you mean getting > - setting-weird-environment-variables > - calling ./configure with weird parameters > - calling make with parameters > - hack configure.in > - execute autoconf > > to work, right? > > > > [me:] > > > Makefiles for building the win32 parts with the native (mingw32) mode of gcc > > Ok. As I said, I need somebody who is knowledgable in autoconf and Cygwin whom > I can bug, or better yet, who just steps forward and invests an hour or two to > do this, document it and submit a patch. > > Volunteers/helpers are wery welcome, also in PM, of course. > > later, > > Gerhard > > PS: I'm trying to subscribe to pgsql-cygwin, but it looks as if Majordomo is in > a bad mood again. Whom would I write to if I think it is broken? > -- > mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 > web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage > public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 > reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/users-lounge/docs/faq.html > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Bruce Momjian writes: > Can we actually get configure to work on Win32, and if we can, why do we > have other Win32 makefiles? I don't understand why Peter E was saying > we should use configure either. mingw32 is the "minimal GNU environment for Win32" -- sort of like Cygwin ultra-light. As a consequence it should work to run configure on it. In fact, we already have checking for Cygwin environment... no checking for mingw32 environment... no So I'd be interested to know what happens when you do try it. Also, what would be the advantage of the mingw32 specific makefiles that you sent, versus just using the win32 native ones that we already have? > > PS: I'm trying to subscribe to pgsql-cygwin, but it looks as if Majordomo is in > > a bad mood again. Whom would I write to if I think it is broken? Probably pgsql-cygwin-owner@postgresql.org. But the lists should be back up by now. -- Peter Eisentraut peter_e@gmx.net http://funkturm.homeip.net/~peter
Can I have a vote on whether to apply this patch? > Makefiles for building the win32 parts with the native (mingw32) mode of gcc. > Currently, only libpq is implemented because I only cared for that :-) > Supports cross-compilation and includes documentation updates. So people don't > need to spend big $$$ for Visual C++ :-) > > Gerhard > -- > mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 > web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage > public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 > reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) > diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/doc/src/sgml/install-win32.sgml ./doc/src/sgml/install-win32.sgml > *** ../pgsql_HEAD/doc/src/sgml/install-win32.sgml Sun May 13 00:51:35 2001 > --- ./doc/src/sgml/install-win32.sgml Mon Aug 27 06:59:52 2001 > *************** > *** 111,116 **** > --- 111,134 ---- > C++, just right-click on the project and chose to add it.) > </para> > > + <para> > + Alternatively, you can use the native mode of the GNU compilers (minimalist > + GNU win32 - mingw32) to compile the win32 parts of PostgreSQL. > + Currently, only libpq has a Makefile suitable for compilation with mingw32. > + </para> > + <para> > + To build everything that you can with GNU tools on > + <productname>Windows</productname>, change into the > + <filename>src</filename> directory and type the command > + <screen> > + <userinput>make -f mingw32.mak</userinput> > + </screen> > + This assumes that you are the<productname>Cygnus Toolkit</productname>'s bash > + shell or have a suitable mingw32 environment with make and gcc installed. The > + Makefiles also support cross-compilation. > + </para> > + > + > </chapter> > > <!-- Keep this comment at the end of the file > diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/src/interfaces/libpq/mingw32.mak ./src/interfaces/libpq/mingw32.mak > *** ../pgsql_HEAD/src/interfaces/libpq/mingw32.mak Thu Jan 1 01:00:00 1970 > --- ./src/interfaces/libpq/mingw32.mak Fri Aug 24 08:34:24 2001 > *************** > *** 0 **** > --- 1,66 ---- > + # Makefile for compiling a native win32 libpq with GNU tools (GNU make) > + # ===================================================================== > + # > + # To build an optimized non-debug library, simply compile with > + # $ make -f mingw32.mak > + # > + # To cross-compile from FreeBSD/Linux/..., compile with > + # $ make -f mingw32.mak PREFIX=i386-mingw32msvc- > + # > + # To build the library with debugging support, compile with > + # $ make -f mingw32.mak OPT=-g LDOPT= > + # > + # To build the library with multibyte support, compile with > + # $ make -f mingw32.mak MULTIBYTE=1 > + # > + # You can combine any of the above. > + > + ##################################################################### > + # You can change these parameters on the commandline: > + ##################################################################### > + PREFIX= > + OPT=-O3 > + MULTIBYTE=0 > + LDOPT=-s > + ##################################################################### > + > + > + DEFINES=-DFRONTEND -DHAVE_VSNPRINTF -DHAVE_STRDUP > + ifeq (1,$(MULTIBYTE)) > + DEFINES := $(DEFINES) -DMULTIBYTE=1 > + endif > + > + CFLAGS=-mno-cygwin -Wall $(OPT) $(DEFINES) > + CC=$(PREFIX)gcc > + DLLTOOL=$(PREFIX)dlltool > + DLLWRAP=$(PREFIX)dllwrap > + > + INC=-I../../../src/include/ > + LIBS=-lwsock32 > + > + objects=fe-auth.o fe-connect.o fe-exec.o fe-lobj.o fe-misc.o fe-print.o libpqdll.o pqexpbuffer.o pqsignal.o ../../backend/lib/dllist.o../../backend/libpq/md5.o > + ifeq (1,$(MULTIBYTE)) > + objects := $(objects) ../../backend/utils/mb/wchar.o > + endif > + > + # Default target > + ALL: libpq.dll libpqdll.a libpq.a > + > + $(objects): %.o: %.c > + $(CC) -c $(CFLAGS) $(INC) $< -o $@ > + > + # Building the DLL. > + libpq.dll: $(objects) libpqdll.def > + $(DLLWRAP) -mno-cygwin --dllname libpq.dll --driver-name $(CC) --def libpqdll.def -o libpq.dll $(objects) $(LDOPT)--entry _DllMain@12 --target=i386-mingw32 $(LIBS) > + > + # The import library for the DLL. > + libpqdll.a: libpq.dll > + $(DLLTOOL) --def libpqdll.def --dllname libpq.dll --output-lib libpqdll.a > + > + # A static library. > + libpq.a: $(objects) > + ar -r libpq.a $(objects) > + > + clean: > + rm -f $(objects) *.dll *.a *~ > + > Binary files ../pgsql_HEAD/src/interfaces/libpq/pqexpbuffer.o and ./src/interfaces/libpq/pqexpbuffer.o differ > Binary files ../pgsql_HEAD/src/interfaces/libpq/pqsignal.o and ./src/interfaces/libpq/pqsignal.o differ > diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/src/mingw32.mak ./src/mingw32.mak > *** ../pgsql_HEAD/src/mingw32.mak Thu Jan 1 01:00:00 1970 > --- ./src/mingw32.mak Mon Aug 27 07:02:04 2001 > *************** > *** 0 **** > --- 1,20 ---- > + # Makefile for mingw32 mode of gcc > + # > + # Only compiles libpq so far. > + # See interfaces/libpq/mingw32.mak for options! > + # > + # Note that most parts are not ported to Win32! > + > + ALL: docopy libpq > + > + docopy: > + # TODO copy only if target doesn't exist > + cp include/config.h.win32 include/config.h > + > + libpq: > + cd interfaces/libpq && $(MAKE) -e -f mingw32.mak > + -echo All Win32 parts have been built! > + > + clean: > + cd interfaces/libpq && $(MAKE) -e -f mingw32.mak clean > + > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Bruce Momjian <pgman@candle.pha.pa.us> writes: > Can I have a vote on whether to apply this patch? >> Makefiles for building the win32 parts with the native (mingw32) mode of gcc. I think we shouldn't do this, unless someone tries and fails to make configure work in this context. So far I've not heard any reason that configure couldn't work... regards, tom lane
In talking to others, it seems people would like to concentrate on getting configure to work on your platform rather than adding another makefile. Can we assist in that or is that not a possible solution? > Makefiles for building the win32 parts with the native (mingw32) mode of gcc. > Currently, only libpq is implemented because I only cared for that :-) > Supports cross-compilation and includes documentation updates. So people don't > need to spend big $$$ for Visual C++ :-) > > Gerhard > -- > mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 > web: http://www.cs.fhm.edu/~ifw00065/ public key at homepage > public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 > reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) > diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/doc/src/sgml/install-win32.sgml ./doc/src/sgml/install-win32.sgml > *** ../pgsql_HEAD/doc/src/sgml/install-win32.sgml Sun May 13 00:51:35 2001 > --- ./doc/src/sgml/install-win32.sgml Mon Aug 27 06:59:52 2001 > *************** > *** 111,116 **** > --- 111,134 ---- > C++, just right-click on the project and chose to add it.) > </para> > > + <para> > + Alternatively, you can use the native mode of the GNU compilers (minimalist > + GNU win32 - mingw32) to compile the win32 parts of PostgreSQL. > + Currently, only libpq has a Makefile suitable for compilation with mingw32. > + </para> > + <para> > + To build everything that you can with GNU tools on > + <productname>Windows</productname>, change into the > + <filename>src</filename> directory and type the command > + <screen> > + <userinput>make -f mingw32.mak</userinput> > + </screen> > + This assumes that you are the<productname>Cygnus Toolkit</productname>'s bash > + shell or have a suitable mingw32 environment with make and gcc installed. The > + Makefiles also support cross-compilation. > + </para> > + > + > </chapter> > > <!-- Keep this comment at the end of the file > diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/src/interfaces/libpq/mingw32.mak ./src/interfaces/libpq/mingw32.mak > *** ../pgsql_HEAD/src/interfaces/libpq/mingw32.mak Thu Jan 1 01:00:00 1970 > --- ./src/interfaces/libpq/mingw32.mak Fri Aug 24 08:34:24 2001 > *************** > *** 0 **** > --- 1,66 ---- > + # Makefile for compiling a native win32 libpq with GNU tools (GNU make) > + # ===================================================================== > + # > + # To build an optimized non-debug library, simply compile with > + # $ make -f mingw32.mak > + # > + # To cross-compile from FreeBSD/Linux/..., compile with > + # $ make -f mingw32.mak PREFIX=i386-mingw32msvc- > + # > + # To build the library with debugging support, compile with > + # $ make -f mingw32.mak OPT=-g LDOPT= > + # > + # To build the library with multibyte support, compile with > + # $ make -f mingw32.mak MULTIBYTE=1 > + # > + # You can combine any of the above. > + > + ##################################################################### > + # You can change these parameters on the commandline: > + ##################################################################### > + PREFIX= > + OPT=-O3 > + MULTIBYTE=0 > + LDOPT=-s > + ##################################################################### > + > + > + DEFINES=-DFRONTEND -DHAVE_VSNPRINTF -DHAVE_STRDUP > + ifeq (1,$(MULTIBYTE)) > + DEFINES := $(DEFINES) -DMULTIBYTE=1 > + endif > + > + CFLAGS=-mno-cygwin -Wall $(OPT) $(DEFINES) > + CC=$(PREFIX)gcc > + DLLTOOL=$(PREFIX)dlltool > + DLLWRAP=$(PREFIX)dllwrap > + > + INC=-I../../../src/include/ > + LIBS=-lwsock32 > + > + objects=fe-auth.o fe-connect.o fe-exec.o fe-lobj.o fe-misc.o fe-print.o libpqdll.o pqexpbuffer.o pqsignal.o ../../backend/lib/dllist.o../../backend/libpq/md5.o > + ifeq (1,$(MULTIBYTE)) > + objects := $(objects) ../../backend/utils/mb/wchar.o > + endif > + > + # Default target > + ALL: libpq.dll libpqdll.a libpq.a > + > + $(objects): %.o: %.c > + $(CC) -c $(CFLAGS) $(INC) $< -o $@ > + > + # Building the DLL. > + libpq.dll: $(objects) libpqdll.def > + $(DLLWRAP) -mno-cygwin --dllname libpq.dll --driver-name $(CC) --def libpqdll.def -o libpq.dll $(objects) $(LDOPT)--entry _DllMain@12 --target=i386-mingw32 $(LIBS) > + > + # The import library for the DLL. > + libpqdll.a: libpq.dll > + $(DLLTOOL) --def libpqdll.def --dllname libpq.dll --output-lib libpqdll.a > + > + # A static library. > + libpq.a: $(objects) > + ar -r libpq.a $(objects) > + > + clean: > + rm -f $(objects) *.dll *.a *~ > + > Binary files ../pgsql_HEAD/src/interfaces/libpq/pqexpbuffer.o and ./src/interfaces/libpq/pqexpbuffer.o differ > Binary files ../pgsql_HEAD/src/interfaces/libpq/pqsignal.o and ./src/interfaces/libpq/pqsignal.o differ > diff -N -r -C3 --exclude=CVS ../pgsql_HEAD/src/mingw32.mak ./src/mingw32.mak > *** ../pgsql_HEAD/src/mingw32.mak Thu Jan 1 01:00:00 1970 > --- ./src/mingw32.mak Mon Aug 27 07:02:04 2001 > *************** > *** 0 **** > --- 1,20 ---- > + # Makefile for mingw32 mode of gcc > + # > + # Only compiles libpq so far. > + # See interfaces/libpq/mingw32.mak for options! > + # > + # Note that most parts are not ported to Win32! > + > + ALL: docopy libpq > + > + docopy: > + # TODO copy only if target doesn't exist > + cp include/config.h.win32 include/config.h > + > + libpq: > + cd interfaces/libpq && $(MAKE) -e -f mingw32.mak > + -echo All Win32 parts have been built! > + > + clean: > + cd interfaces/libpq && $(MAKE) -e -f mingw32.mak clean > + > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
On Thu, Sep 06, 2001 at 03:29:15PM +0200, Peter Eisentraut wrote: > [...] > mingw32 is the "minimal GNU environment for Win32" -- sort of like Cygwin > ultra-light. As a consequence it should work to run configure on it. In > fact, we already have > > checking for Cygwin environment... no > checking for mingw32 environment... no > > So I'd be interested to know what happens when you do try it. "C compiler cannot create executables." I'll try to sort this out. The current configure script doesn't know anything about mingw32. It doesn't add the "-mno-cygwin" option and it still tries to link against libcrypt and libcygipc. I'll try to sort this out on the pgsql-cygwin list, to which now, I finally managed to subscribe. I'll also try not to swear too loud about autoconf. > Also, what would be the advantage of the mingw32 specific makefiles that > you sent, That's simple: they build native win32 libraries with zero euros worth of tools. >versus just using the win32 native ones that we already have? These only work with M$ Visual C++ and are in a proprietary Makefile format that works with no other compiler than M$'s. Later, Gerhard -- mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
On Sun, Sep 09, 2001 at 08:19:51PM -0400, Bruce Momjian wrote: > In talking to others, it seems people would like to concentrate on getting > configure to work on your platform rather than adding another makefile. Can > we assist in that or is that not a possible solution? > > > [me] > > Makefiles for building the win32 parts with the native (mingw32) mode of > > gcc. [...] Bruce, it would be a solution, but it takes more effort, too. I would very much appreciate it if you and the others that are familiar with the build process could assist me with the autoconf stuff. Thanks, Gerhard -- mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))
Gerhard Häring wrote: > <snip> > > Also, what would be the advantage of the mingw32 specific makefiles that > > you sent, > > That's simple: they build native win32 libraries with zero euros worth of > tools. > > >versus just using the win32 native ones that we already have? > > These only work with M$ Visual C++ and are in a proprietary Makefile format > that works with no other compiler than M$'s. Does this mean with these patches people can compile PostgreSQL on WinNT using something free like Bloodshed's Dev-C++? (er... www.bloodshed.net if anyone's interested, it includes mingw32 with the install). My only comment is "at last" if this can be made to work. Regards and best wishes, Justin Clift > Later, > > Gerhard > -- > mail: gerhard <at> bigfoot <dot> de registered Linux user #64239 > web: http://www.cs.fhm.edu/~ifw00065/ OpenPGP public key id 86AB43C0 > public key fingerprint: DEC1 1D02 5743 1159 CD20 A4B6 7B22 6575 86AB 43C0 > reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b'))) > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster -- "My grandfather once told me that there are two kinds of people: those who work and those who take the credit. He told me to try to be in the first group; there was less competition there." - Indira Gandhi