Re: Makefiles for building with mingw32 on win32

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Gerhard Häring <haering_python(at)gmx(dot)de>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Makefiles for building with mingw32 on win32
Date: 2001-09-07 22:19:04
Message-ID: 200109072219.f87MJ4v02093@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-cygwin pgsql-patches


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(at)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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-cygwin by date

  From Date Subject
Next Message Tom Lane 2001-09-07 23:07:32 Re: Makefiles for building with mingw32 on win32
Previous Message fred 2001-09-06 15:08:43 Re: pgadmin

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2001-09-07 23:07:32 Re: Makefiles for building with mingw32 on win32
Previous Message Bruce Momjian 2001-09-07 22:17:49 Re: Fix for 2 test cases of JDBC test suite