Attached is a patch to provide makefiles, etc. to allow the compilation

of the libpq interface static and dynamic libraries with the freely
downloadable Borland C++ compiler version 5.5 and/or C++ Builder.

Lester Godwin
This commit is contained in:
Bruce Momjian 2002-12-30 21:07:26 +00:00
parent 896bd121cc
commit d82794ee33
5 changed files with 431 additions and 0 deletions

51
src/bcc32.mak Normal file
View File

@ -0,0 +1,51 @@
# $Header: /cvsroot/pgsql/src/bcc32.mak,v 1.1 2002/12/30 21:07:21 momjian Exp $
# Makefile for Borland C++ 5.5 (or compat)
# Top-file makefile for Win32 parts of postgresql.
# Note that most parts are not ported to Win32!
!IF "$(CFG)" != "Release" && "$(CFG)" != "Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running MAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE make -DCFG=[Release | Debug] /f bcc32.mak
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Release" (Win32 Release )
!MESSAGE "Debug" (Win32 Debug)
!MESSAGE
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
ALL:
cd include
if not exist pg_config.h copy pg_config.h.win32 pg_config.h
cd ..
cd interfaces\libpq
make -DCFG=$(CFG) /f bcc32.mak
cd ..\..\bin\psql
make -DCFG=$(CFG) /f bcc32.mak
cd ..\..
echo All Win32 parts have been built!
CLEAN:
cd interfaces\libpq
make -DCFG=Release /f bcc32.mak CLEAN
make -DCFG=Debug /f bcc32.mak CLEAN
cd ..\..\bin\psql
make -DCFG=Release /f bcc32.mak CLEAN
make -DCFG=Debug /f bcc32.mak CLEAN
cd ..\..
echo All Win32 parts have been cleaned!
DISTCLEAN: CLEAN
cd include
del config.h
cd ..

136
src/bin/psql/bcc32.mak Normal file
View File

@ -0,0 +1,136 @@
# Makefile for Borland C++ 5.5
# Borland C++ base install directory goes here
BCB=d:\Borland\Bcc55
!MESSAGE Building PSQL.EXE ...
!MESSAGE
!IF "$(CFG)" == ""
CFG=Release
!MESSAGE No configuration specified. Defaulting to Release with STATIC libraries.
!MESSAGE To use dynamic link libraries add -DDLL_LIBS to make command line.
!MESSAGE
!ELSE
!MESSAGE Configuration "$(CFG)"
!MESSAGE
!ENDIF
!IF "$(CFG)" != "Release" && "$(CFG)" != "Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running MAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE make -DCFG=[Release | Debug] /f bcc32.mak
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Release" (Win32 Release EXE)
!MESSAGE "Debug" (Win32 Debug EXE)
!MESSAGE
!ERROR An invalid configuration was specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
CPP=bcc32.exe
!IF "$(CFG)" == "Debug"
DEBUG=1
OUTDIR=.\Debug
INTDIR=.\Debug
!else
OUTDIR=.\Release
INTDIR=.\Release
!endif
.path.obj = $(INTDIR)
.c.obj:
$(CPP) -o"$(INTDIR)\$&" $(CPP_PROJ) $<
ALL : "$(OUTDIR)\psql.exe"
CLEAN :
-@erase "$(INTDIR)\command.obj"
-@erase "$(INTDIR)\common.obj"
-@erase "$(INTDIR)\help.obj"
-@erase "$(INTDIR)\input.obj"
-@erase "$(INTDIR)\stringutils.obj"
-@erase "$(INTDIR)\mainloop.obj"
-@erase "$(INTDIR)\copy.obj"
-@erase "$(INTDIR)\startup.obj"
-@erase "$(INTDIR)\prompt.obj"
-@erase "$(INTDIR)\sprompt.obj"
-@erase "$(INTDIR)\variables.obj"
-@erase "$(INTDIR)\large_obj.obj"
-@erase "$(INTDIR)\print.obj"
-@erase "$(INTDIR)\describe.obj"
-@erase "$(INTDIR)\tab-complete.obj"
-@erase "$(INTDIR)\getopt.obj"
-@erase "$(INTDIR)\mbprint.obj"
-@erase "$(INTDIR)\psql.ilc"
-@erase "$(INTDIR)\psql.ild"
-@erase "$(INTDIR)\psql.tds"
-@erase "$(INTDIR)\psql.ils"
-@erase "$(INTDIR)\psql.ilf"
-@erase "$(OUTDIR)\psql.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
USERDEFINES = WIN32;_CONSOLE;_MBCS;HAVE_STRDUP
# ---------------------------------------------------------------------------
CPP_PROJ = -I$(BCB)\include;..\..\include;..\..\interfaces\libpq -c -D$(USERDEFINES) -tWM -tWC \
-q -5 -a8 -pc -X -w-use -w-par -w-pia -w-csu -w-aus -w-ccc
!IFDEF DEBUG
CPP_PROJ = $(CPP_PROJ) -Od -r- -k -v -y -vi- -D_DEBUG
LIBPG_DIR = Debug
!ELSE
CPP_PROJ = $(CPP_PROJ) -O -Oi -OS -DNDEBUG
LIBPG_DIR = Release
!ENDIF
!IFDEF DLL_LIBS
CPP_PROJ = $(CPP_PROJ) -D_RTLDLL
LIBRARIES = cw32mti.lib ..\..\interfaces\libpq\$(LIBPG_DIR)\blibpqdll.lib
!ELSE
CPP_PROJ = $(CPP_PROJ) -DBCC32_STATIC
LIBRARIES = cw32mt.lib ..\..\interfaces\libpq\$(LIBPG_DIR)\blibpq.lib
!ENDIF
LINK32=ilink32.exe
LINK32_FLAGS=-L$(BCB)\lib;.\$(LIBPG_DIR) -x -v
LINK32_OBJS= \
command.obj \
common.obj \
help.obj \
input.obj \
stringutils.obj \
mainloop.obj \
copy.obj \
startup.obj \
prompt.obj \
sprompt.obj \
variables.obj \
large_obj.obj \
print.obj \
describe.obj \
tab-complete.obj \
getopt.obj \
mbprint.obj
"$(OUTDIR)\psql.exe" : "$(OUTDIR)" $(LINK32_OBJS)
$(LINK32) @&&!
$(LINK32_FLAGS) +
c0x32.obj $(LINK32_OBJS), +
$@,, +
import32.lib $(LIBRARIES),,
!
getopt.obj : "$(OUTDIR)" ..\..\port\getopt.c

View File

@ -0,0 +1,141 @@
# Makefile for Borland C++ 5.5
# Will build a Win32 static library libpq.lib
# and a Win32 dynamic library libpq.dll with import library libpqdll.lib
# Borland C++ base install directory goes here
BCB=d:\Borland\Bcc55
!MESSAGE Building the Win32 DLL and Static Library...
!MESSAGE
!IF "$(CFG)" == ""
CFG=Release
!MESSAGE No configuration specified. Defaulting to Release.
!MESSAGE
!ELSE
!MESSAGE Configuration "$(CFG)"
!MESSAGE
!ENDIF
!IF "$(CFG)" != "Release" && "$(CFG)" != "Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running MAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE make -DCFG=[Release | Debug] /f bcc32.mak
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "Release" (Win32 Release DLL and Static Library)
!MESSAGE "Debug" (Win32 Debug DLL and Static Library)
!MESSAGE
!ERROR An invalid configuration was specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "Debug"
DEBUG=1
OUTDIR=.\Debug
INTDIR=.\Debug
!else
OUTDIR=.\Release
INTDIR=.\Release
!endif
USERDEFINES=FRONTEND;NDEBUG;WIN32;_WINDOWS;HAVE_VSNPRINTF;HAVE_STRDUP;
CPP=bcc32.exe
CPP_PROJ = -I$(BCB)\include;..\..\include -WD -c -D$(USERDEFINES) -tWM \
-a8 -X -w-use -w-par -w-pia -w-csu -w-aus -w-ccc
!IFDEF DEBUG
CPP_PROJ = $(CPP_PROJ) -Od -r- -k -v -y -vi- -D_DEBUG
!else
CPP_PROJ = $(CPP_PROJ) -O -Oi -OS -DNDEBUG
!endif
LIB32=tlib.exe
LIB32_FLAGS=
LIB32_OBJS= \
"$(OUTDIR)\win32.obj" \
"$(INTDIR)\dllist.obj" \
"$(INTDIR)\md5.obj" \
"$(INTDIR)\fe-auth.obj" \
"$(INTDIR)\fe-connect.obj" \
"$(INTDIR)\fe-exec.obj" \
"$(INTDIR)\fe-lobj.obj" \
"$(INTDIR)\fe-misc.obj" \
"$(INTDIR)\fe-print.obj" \
"$(INTDIR)\fe-secure.obj" \
"$(INTDIR)\pqexpbuffer.obj" \
"$(INTDIR)\wchar.obj" \
"$(INTDIR)\encnames.obj"
RSC=brcc32.exe
RSC_PROJ=/l 0x409 /fo"$(INTDIR)\libpq.res"
LINK32=ilink32.exe
LINK32_FLAGS = -Gn -L$(BCB)\lib;$(INTDIR); -x -Tpd -v
LINK32_OBJS= "$(INTDIR)\libpqdll.obj"
# ---------------------------------------------------------------------------
.path.obj = $(INTDIR)
.path.c = .;..\..\backend\libpq;..\..\backend\lib;..\..\backend\utils\mb
# ---------------------------------------------------------------------------
ALL: "$(OUTDIR)" "$(OUTDIR)\blibpq.dll" "$(OUTDIR)\blibpq.lib"
CLEAN :
-@erase "$(INTDIR)\dllist.obj"
-@erase "$(INTDIR)\md5.obj"
-@erase "$(INTDIR)\fe-auth.obj"
-@erase "$(INTDIR)\fe-connect.obj"
-@erase "$(INTDIR)\fe-exec.obj"
-@erase "$(INTDIR)\fe-lobj.obj"
-@erase "$(INTDIR)\fe-misc.obj"
-@erase "$(INTDIR)\fe-print.obj"
-@erase "$(INTDIR)\fe-secure.obj"
-@erase "$(INTDIR)\pqexpbuffer.obj"
-@erase "$(OUTDIR)\libpqdll.obj"
-@erase "$(OUTDIR)\win32.obj"
-@erase "$(INTDIR)\wchar.obj"
-@erase "$(INTDIR)\encnames.obj"
-@erase "$(OUTDIR)\libpq.res"
-@erase "$(OUTDIR)\blibpq.lib"
-@erase "$(OUTDIR)\blibpqdll.lib"
-@erase "$(OUTDIR)\blibpq.dll"
-@erase "$(OUTDIR)\blibpq.tds"
"$(OUTDIR)" :
@if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
"$(OUTDIR)\blibpq.dll": "$(OUTDIR)\blibpq.lib" $(LINK32_OBJS) "$(INTDIR)\libpq.res" blibpqdll.def
$(LINK32) @&&!
$(LINK32_FLAGS) +
c0d32.obj $(LINK32_OBJS), +
$@,, +
"$(OUTDIR)\blibpq.lib" import32.lib cw32mti.lib, +
blibpqdll.def,"$(INTDIR)\libpq.res"
!
implib -a "$(OUTDIR)\blibpqdll.lib" blibpqdll.def $@
"$(INTDIR)\libpq.res" : "$(INTDIR)" libpq.rc
$(RSC) $(RSC_PROJ) libpq.rc
"$(OUTDIR)\blibpq.lib": $(LIB32_OBJS)
$(LIB32) $@ @&&!
+-"$(**: =" &^
+-")"
!
.c.obj:
$(CPP) -o"$(INTDIR)\$&" $(CPP_PROJ) $<

View File

@ -0,0 +1,95 @@
LIBRARY BLIBPQ
EXPORTS
_PQconnectdb @ 1
_PQsetdbLogin @ 2
_PQconndefaults @ 3
_PQfinish @ 4
_PQreset @ 5
_PQrequestCancel @ 6
_PQdb @ 7
_PQuser @ 8
_PQpass @ 9
_PQhost @ 10
_PQport @ 11
_PQtty @ 12
_PQoptions @ 13
_PQstatus @ 14
_PQerrorMessage @ 15
_PQsocket @ 16
_PQbackendPID @ 17
_PQtrace @ 18
_PQuntrace @ 19
_PQsetNoticeProcessor @ 20
_PQexec @ 21
_PQnotifies @ 22
_PQsendQuery @ 23
_PQgetResult @ 24
_PQisBusy @ 25
_PQconsumeInput @ 26
_PQgetline @ 27
_PQputline @ 28
_PQgetlineAsync @ 29
_PQputnbytes @ 30
_PQendcopy @ 31
_PQfn @ 32
_PQresultStatus @ 33
_PQntuples @ 34
_PQnfields @ 35
_PQbinaryTuples @ 36
_PQfname @ 37
_PQfnumber @ 38
_PQftype @ 39
_PQfsize @ 40
_PQfmod @ 41
_PQcmdStatus @ 42
_PQoidStatus @ 43
_PQcmdTuples @ 44
_PQgetvalue @ 45
_PQgetlength @ 46
_PQgetisnull @ 47
_PQclear @ 48
_PQmakeEmptyPGresult @ 49
_PQprint @ 50
_PQdisplayTuples @ 51
_PQprintTuples @ 52
_lo_open @ 53
_lo_close @ 54
_lo_read @ 55
_lo_write @ 56
_lo_lseek @ 57
_lo_creat @ 58
_lo_tell @ 59
_lo_unlink @ 60
_lo_import @ 61
_lo_export @ 62
_pgresStatus @ 63
_PQmblen @ 64
_PQresultErrorMessage @ 65
_PQresStatus @ 66
_termPQExpBuffer @ 67
_appendPQExpBufferChar @ 68
_initPQExpBuffer @ 69
_resetPQExpBuffer @ 70
_PQoidValue @ 71
_PQclientEncoding @ 72
_PQenv2encoding @ 73
_appendBinaryPQExpBuffer @ 74
_appendPQExpBufferStr @ 75
_destroyPQExpBuffer @ 76
_createPQExpBuffer @ 77
_PQconninfoFree @ 78
_PQconnectPoll @ 79
_PQconnectStart @ 80
_PQflush @ 81
_PQisnonblocking @ 82
_PQresetPoll @ 83
_PQresetStart @ 84
_PQsetClientEncoding @ 85
_PQsetnonblocking @ 86
_PQfreeNotify @ 87
_PQescapeString @ 88
_PQescapeBytea @ 89
_printfPQExpBuffer @ 90
_appendPQExpBuffer @ 91
_pg_encoding_to_char @ 92
_pg_utf_mblen @ 93

View File

@ -10,10 +10,18 @@
/*
* Some other compat functions
*/
#ifdef __BORLANDC__
#define _timeb timeb
#define _ftime(a) ftime(a)
#define _strnicmp(a,b,c) strnicmp(a,b,c)
#define _errno errno
#else
#define open(a,b,c) _open(a,b,c)
#define close(a) _close(a)
#define read(a,b,c) _read(a,b,c)
#define write(a,b,c) _write(a,b,c)
#endif
#define popen(a,b) _popen(a,b)
#define pclose(a) _pclose(a)
#define vsnprintf(a,b,c,d) _vsnprintf(a,b,c,d)