Skip to content

Commit 5d72ef8

Browse files
committed
Miscellaneous Cygwin build fixes from Reini Urban.
1 parent ede8f4e commit 5d72ef8

File tree

5 files changed

+34
-12
lines changed

5 files changed

+34
-12
lines changed

contrib/spi/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $PostgreSQL: pgsql/contrib/spi/Makefile,v 1.24 2004/08/20 20:13:08 momjian Exp $
1+
# $PostgreSQL: pgsql/contrib/spi/Makefile,v 1.25 2004/11/17 17:45:59 tgl Exp $
22

33
MODULES = autoinc insert_username moddatetime refint timetravel
44
DATA_built = $(addsuffix .sql, $(MODULES))
@@ -17,3 +17,5 @@ top_builddir = ../..
1717
include $(top_builddir)/src/Makefile.global
1818
include $(top_srcdir)/contrib/contrib-global.mk
1919
endif
20+
21+
SHLIB_LINK += -L$(top_builddir)/src/port -lpgport

src/bin/pg_ctl/pg_ctl.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
66
*
7-
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.46 2004/11/17 16:34:42 tgl Exp $
7+
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.47 2004/11/17 17:46:12 tgl Exp $
88
*
99
*-------------------------------------------------------------------------
1010
*/
@@ -22,6 +22,7 @@
2222
#include "getopt_long.h"
2323

2424
#if defined(__CYGWIN__)
25+
#include <sys/cygwin.h>
2526
#include <windows.h>
2627
/* Cygwin defines WIN32 in windows.h, but we don't want it. */
2728
#undef WIN32
@@ -820,6 +821,9 @@ pgwin32_CommandLine(bool registration)
820821
{
821822
static char cmdLine[MAXPGPATH];
822823
int ret;
824+
#ifdef __CYGWIN__
825+
char buf[MAXPGPATH];
826+
#endif
823827

824828
if (registration)
825829
{
@@ -840,6 +844,12 @@ pgwin32_CommandLine(bool registration)
840844
}
841845
}
842846

847+
#ifdef __CYGWIN__
848+
/* need to convert to windows path */
849+
cygwin_conv_to_full_win32_path(cmdLine, buf);
850+
strcpy(cmdLine, buf);
851+
#endif
852+
843853
if (registration)
844854
{
845855
if (strcasecmp(cmdLine + strlen(cmdLine) - 4, ".exe"))

src/include/port.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.66 2004/11/08 16:34:23 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.67 2004/11/17 17:46:15 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -73,9 +73,13 @@ extern int find_other_exec(const char *argv0, const char *target,
7373

7474
#if defined(WIN32) || defined(__CYGWIN__)
7575
#define EXE ".exe"
76-
#define DEVNULL "nul"
7776
#else
7877
#define EXE ""
78+
#endif
79+
80+
#if defined(WIN32) && !defined(__CYGWIN__)
81+
#define DEVNULL "nul"
82+
#else
7983
#define DEVNULL "/dev/null"
8084
#endif
8185

@@ -88,13 +92,13 @@ extern int find_other_exec(const char *argv0, const char *target,
8892
* See the "Notes" section about quotes at:
8993
* http://home.earthlink.net/~rlively/MANUALS/COMMANDS/C/CMD.HTM
9094
*/
91-
#ifdef WIN32
95+
#if defined(WIN32) && !defined(__CYGWIN__)
9296
#define SYSTEMQUOTE "\""
9397
#else
9498
#define SYSTEMQUOTE ""
9599
#endif
96100

97-
#ifdef WIN32
101+
#if defined(WIN32) && !defined(__CYGWIN__)
98102
#define HOMEDIR "USERPROFILE"
99103
#else
100104
#define HOMEDIR "HOME"
@@ -163,8 +167,9 @@ extern int pgunlink(const char *path);
163167
* Cygwin has its own symlinks which work on Win95/98/ME where
164168
* junction points don't, so use it instead. We have no way of
165169
* knowing what type of system Cygwin binaries will be run on.
170+
* Note: Some CYGWIN includes might #define WIN32.
166171
*/
167-
#ifdef WIN32
172+
#if defined(WIN32) && !defined(__CYGWIN__)
168173
extern int pgsymlink(const char *oldpath, const char *newpath);
169174
#define symlink(oldpath, newpath) pgsymlink(oldpath, newpath)
170175
#endif
@@ -173,7 +178,7 @@ extern int pgsymlink(const char *oldpath, const char *newpath);
173178

174179
extern bool rmtree(char *path, bool rmtopdir);
175180

176-
#ifdef WIN32
181+
#if defined(WIN32) && !defined(__CYGWIN__)
177182

178183
/* open() replacement to allow delete of held files */
179184
#ifndef WIN32_CLIENT_ONLY
@@ -266,7 +271,7 @@ extern void srandom(unsigned int seed);
266271
/* thread.h */
267272
extern char *pqStrerror(int errnum, char *strerrbuf, size_t buflen);
268273

269-
#ifndef WIN32
274+
#if !defined(WIN32) || defined(__CYGWIN__)
270275
extern int pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer,
271276
size_t buflen, struct passwd ** result);
272277
#endif

src/interfaces/libpq/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
66
# Portions Copyright (c) 1994, Regents of the University of California
77
#
8-
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.120 2004/10/16 22:52:49 tgl Exp $
8+
# $PostgreSQL: pgsql/src/interfaces/libpq/Makefile,v 1.121 2004/11/17 17:46:19 tgl Exp $
99
#
1010
#-------------------------------------------------------------------------
1111

@@ -31,6 +31,10 @@ OBJS= fe-auth.o fe-connect.o fe-exec.o fe-misc.o fe-print.o fe-lobj.o \
3131
md5.o ip.o wchar.o encnames.o noblock.o pgstrcasecmp.o thread.o \
3232
$(filter crypt.o getaddrinfo.o inet_aton.o open.o snprintf.o strerror.o, $(LIBOBJS))
3333

34+
ifeq ($(PORTNAME), cygwin)
35+
override shlib = cyg$(NAME)$(DLSUFFIX)
36+
endif
37+
3438
ifeq ($(PORTNAME), win32)
3539
OBJS += win32.o libpqrc.o
3640
libpqrc.o : libpq.rc

src/template/cygwin

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ SRCH_LIB="/usr/local/lib"
22

33
# This is required to link pg_dump because it finds pg_toupper() in
44
# libpq and pgport
5-
LDFLAGS="-Wl,--allow-multiple-definition"
6-
5+
LDFLAGS="-Wl,--allow-multiple-definition -Wl,--enable-auto-import"
6+
# --enable-auto-import gets rid of a diagnostics linker message
7+
LDFLAGS_SL="-Wl,--enable-auto-import"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy