Skip to content

Commit

Permalink
Remove support for bcc and msvc standalone libpq builds
Browse files Browse the repository at this point in the history
This removes the support for building just libpq using Borland C++ or
Visual C++. This has not worked properly for years, and given the number
of complaints it's clearly not worth the maintenance burden.

Building libpq using the standard MSVC build system is of course still
supported, along with mingw.
  • Loading branch information
mhagander committed Apr 11, 2017
1 parent 258cef1 commit 6da56f3
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 930 deletions.
117 changes: 0 additions & 117 deletions doc/src/sgml/install-windows.sgml
Expand Up @@ -34,14 +34,6 @@
<productname>Windows</productname>.
</para>

<para>
Finally, the client access library
(<application>libpq</application>) can be built using
<productname>Visual C++ 7.1</productname> or
<productname>Borland C++</productname> for compatibility with statically
linked applications built using these tools.
</para>

<para>
Building using <productname>MinGW</productname> or
<productname>Cygwin</productname> uses the normal build system, see
Expand Down Expand Up @@ -539,113 +531,4 @@ $ENV{DOCROOT}='c:\docbook';
</sect2>

</sect1>

<sect1 id="install-windows-libpq">
<title>Building <application>libpq</application> with
<productname>Visual C++</productname> or
<productname>Borland C++</productname></title>

<para>
Using <productname>Visual C++ 7.1-9.0</productname> or
<productname>Borland C++</productname> to build libpq is only recommended
if you need a version with different debug/release flags, or if you need a
static library to link into an application. For normal use the
<productname>MinGW</productname> or
<productname>Visual Studio</productname> or
<productname>Windows SDK</productname> method is recommended.
</para>

<para>
To build the <application>libpq</application> client library using
<productname>Visual Studio 7.1 or later</productname>, change into the
<filename>src</filename> directory and type the command:
<screen>
<userinput>nmake /f win32.mak</userinput>
</screen>
</para>
<para>
To build a 64-bit version of the <application>libpq</application>
client library using <productname>Visual Studio 8.0 or
later</productname>, change into the <filename>src</filename>
directory and type in the command:
<screen>
<userinput>nmake /f win32.mak CPU=AMD64</userinput>
</screen>
See the <filename>win32.mak</filename> file for further details
about supported variables.
</para>

<para>
To build the <application>libpq</application> client library using
<productname>Borland C++</productname>, change into the
<filename>src</filename> directory and type the command:
<screen>
<userinput>make -N -DCFG=Release /f bcc32.mak</userinput>
</screen>
</para>

<sect2>
<title>Generated Files</title>
<para>
The following files will be built:

<variablelist>
<varlistentry>
<term><filename>interfaces\libpq\Release\libpq.dll</filename></term>
<listitem>
<para>
The dynamically linkable frontend library
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><filename>interfaces\libpq\Release\libpqdll.lib</filename></term>
<listitem>
<para>
Import library to link your programs to <filename>libpq.dll</filename>
</para>
</listitem>
</varlistentry>

<varlistentry>
<term><filename>interfaces\libpq\Release\libpq.lib</filename></term>
<listitem>
<para>
Static version of the frontend library
</para>
</listitem>
</varlistentry>

</variablelist>
</para>

<para>
Normally you do not need to install any of the client files. You should
place the <filename>libpq.dll</filename> file in the same directory
as your applications executable file. Do not install
<filename>libpq.dll</filename> into your <filename>Windows</>,
<filename>System</> or <filename>System32</> directory unless
absolutely necessary.
If this file is installed using a setup program, then it should
be installed with version checking using the
<symbol>VERSIONINFO</symbol> resource included in the file, to
ensure that a newer version of the library is not overwritten.
</para>

<para>
If you are planning to do development using <application>libpq</application>
on this machine, you will have to add the
<filename>src\include</filename> and
<filename>src\interfaces\libpq</filename> subdirectories of the source
tree to the include path in your compiler's settings.
</para>

<para>
To use the library, you must add the
<filename>libpqdll.lib</filename> file to your project. (In Visual
C++, just right-click on the project and choose to add it.)
</para>
</sect2>
</sect1>
</chapter>
16 changes: 4 additions & 12 deletions src/Makefile.shlib
Expand Up @@ -405,30 +405,22 @@ endif # PORTNAME == cygwin || PORTNAME == win32
# tarballs.

ifneq (,$(SHLIB_EXPORTS))
distprep: lib$(NAME)dll.def lib$(NAME)ddll.def blib$(NAME)dll.def
distprep: lib$(NAME)dll.def lib$(NAME)ddll.def

UC_NAME = $(shell echo $(NAME) | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')

lib$(NAME)dll.def: $(SHLIB_EXPORTS)
echo '; DEF file for win32.mak release build and for Makefile.shlib (MinGW)' >$@
echo '; DEF file for Makefile.shlib (MinGW)' >$@
echo 'LIBRARY LIB$(UC_NAME).dll' >>$@
echo 'EXPORTS' >>$@
sed -e '/^#/d' -e 's/^\(.*[ ]\)\([0-9][0-9]*\)/ \1@ \2/' $< >>$@

lib$(NAME)ddll.def: $(SHLIB_EXPORTS)
echo '; DEF file for win32.mak debug build' >$@
echo '; DEF file for Makefile.shlib (MinGW)' >$@
echo 'LIBRARY LIB$(UC_NAME)D.dll' >>$@
echo 'EXPORTS' >>$@
sed -e '/^#/d' -e 's/^\(.*[ ]\)\([0-9][0-9]*\)/ \1@ \2/' $< >>$@

blib$(NAME)dll.def: $(SHLIB_EXPORTS)
echo '; DEF file for bcc32.mak (Borland C++ Builder)' >$@
echo 'LIBRARY BLIB$(UC_NAME)' >>$@
echo 'EXPORTS' >>$@
sed -e '/^#/d' -e 's/^\(.*[ ]\)\([0-9][0-9]*\)/ _\1@ \2/' $< >>$@
echo >>$@
echo '; Aliases for MS compatible names' >> $@
sed -e '/^#/d' -e 's/^\(.*[ ]\)\([0-9][0-9]*\)/ \1= _\1/' $< | sed 's/ *$$//' >>$@
endif # SHLIB_EXPORTS


Expand Down Expand Up @@ -517,5 +509,5 @@ clean-lib:

ifneq (,$(SHLIB_EXPORTS))
maintainer-clean-lib:
rm -f lib$(NAME)dll.def lib$(NAME)ddll.def blib$(NAME)dll.def
rm -f lib$(NAME)dll.def lib$(NAME)ddll.def
endif
47 changes: 0 additions & 47 deletions src/bcc32.mak

This file was deleted.

4 changes: 0 additions & 4 deletions src/bin/psql/command.c
Expand Up @@ -8,10 +8,6 @@
#include "postgres_fe.h"
#include "command.h"

#ifdef __BORLANDC__ /* needed for BCC */
#undef mkdir
#endif

#include <ctype.h>
#include <time.h>
#include <pwd.h>
Expand Down
2 changes: 0 additions & 2 deletions src/include/getaddrinfo.h
Expand Up @@ -44,10 +44,8 @@
#ifndef WSA_NOT_ENOUGH_MEMORY
#define WSA_NOT_ENOUGH_MEMORY (WSAENOBUFS)
#endif
#ifndef __BORLANDC__
#define WSATYPE_NOT_FOUND (WSABASEERR+109)
#endif
#endif
#define EAI_AGAIN WSATRY_AGAIN
#define EAI_BADFLAGS WSAEINVAL
#define EAI_FAIL WSANO_RECOVERY
Expand Down
2 changes: 1 addition & 1 deletion src/include/port.h
Expand Up @@ -403,7 +403,7 @@ extern size_t strlcat(char *dst, const char *src, size_t siz);
extern size_t strlcpy(char *dst, const char *src, size_t siz);
#endif

#if !defined(HAVE_RANDOM) && !defined(__BORLANDC__)
#if !defined(HAVE_RANDOM)
extern long random(void);
#endif

Expand Down
1 change: 0 additions & 1 deletion src/include/port/atomics/generic-msvc.h
Expand Up @@ -23,7 +23,6 @@
#error "should be included via atomics.h"
#endif

/* Should work on both MSVC and Borland. */
#pragma intrinsic(_ReadWriteBarrier)
#define pg_compiler_barrier_impl() _ReadWriteBarrier()

Expand Down
31 changes: 2 additions & 29 deletions src/include/port/win32.h
@@ -1,6 +1,6 @@
/* src/include/port/win32.h */

#if defined(_MSC_VER) || defined(__BORLANDC__)
#if defined(_MSC_VER)
#define WIN32_ONLY_COMPILER
#endif

Expand Down Expand Up @@ -32,9 +32,7 @@
* Always build with SSPI support. Keep it as a #define in case
* we want a switch to disable it sometime in the future.
*/
#ifndef __BORLANDC__
#define ENABLE_SSPI 1
#endif

/* undefine and redefine after #include */
#undef mkdir
Expand All @@ -56,9 +54,7 @@
#include <signal.h>
#include <errno.h>
#include <direct.h>
#ifndef __BORLANDC__
#include <sys/utime.h> /* for non-unicode version */
#endif
#undef near

/* Must be here to avoid conflicting with prototype in windows.h */
Expand Down Expand Up @@ -207,10 +203,8 @@
#define SIGTTIN 21
#define SIGTTOU 22 /* Same as SIGABRT -- no problem, I hope */
#define SIGWINCH 28
#ifndef __BORLANDC__
#define SIGUSR1 30
#define SIGUSR2 31
#endif

/*
* New versions of mingw have gettimeofday() and also declare
Expand Down Expand Up @@ -421,7 +415,7 @@ extern int pgwin32_is_admin(void);
#define putenv(x) pgwin32_putenv(x)
#define unsetenv(x) pgwin32_unsetenv(x)

/* Things that exist in MingW headers, but need to be added to MSVC & BCC */
/* Things that exist in MingW headers, but need to be added to MSVC */
#ifdef WIN32_ONLY_COMPILER

#ifndef _WIN64
Expand All @@ -430,7 +424,6 @@ typedef long ssize_t;
typedef __int64 ssize_t;
#endif

#ifndef __BORLANDC__
typedef unsigned short mode_t;

#define S_IRUSR _S_IREAD
Expand All @@ -440,7 +433,6 @@ typedef unsigned short mode_t;
/* see also S_IRGRP etc below */
#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif /* __BORLANDC__ */

#define F_OK 0
#define W_OK 2
Expand All @@ -454,26 +446,9 @@ typedef unsigned short mode_t;
/* Pulled from Makefile.port in mingw */
#define DLSUFFIX ".dll"

#ifdef __BORLANDC__

/* for port/dirent.c */
#ifndef INVALID_FILE_ATTRIBUTES
#define INVALID_FILE_ATTRIBUTES ((DWORD) -1)
#endif

/* for port/open.c */
#ifndef O_RANDOM
#define O_RANDOM 0x0010 /* File access is primarily random */
#define O_SEQUENTIAL 0x0020 /* File access is primarily sequential */
#define O_TEMPORARY 0x0040 /* Temporary file bit */
#define O_SHORT_LIVED 0x1000 /* Temporary storage file, try not to flush */
#define _O_SHORT_LIVED O_SHORT_LIVED
#endif /* ifndef O_RANDOM */
#endif /* __BORLANDC__ */
#endif /* WIN32_ONLY_COMPILER */

/* These aren't provided by either MingW or MSVC */
#ifndef __BORLANDC__
#define S_IRGRP 0
#define S_IWGRP 0
#define S_IXGRP 0
Expand All @@ -482,5 +457,3 @@ typedef unsigned short mode_t;
#define S_IWOTH 0
#define S_IXOTH 0
#define S_IRWXO 0

#endif /* __BORLANDC__ */

0 comments on commit 6da56f3

Please sign in to comment.