add darwin/osxpb support to cvs
this patch and tar archive will add support for the darwin/osxpb to the current cvs tree.
a couple things to note:
- unpack the tar archive in pgsql/
- the config.guess and config.sub files have been updated by apple to support their new os. i don't think these changes have been folded back in to the main archive yet (at least they aren't in the pgsql cvs yet). these need to be copied over from /usr/libexec/config.* in order to obtain the correct os (e.g. powerpc-apple-darwin1.2 on PB).
- the diff only patches configure.in so autoconf needs to be rerun
- the situation with darwin's implementation of sysv semaphores is in progress at the moment (the shm/ipc support *is* there and seems to work fine). so this patch uses HAVE_SYS_SEM_H to conditionally build the src/backend/port/darwin semaphore code (borrowed from qnx4). I've followed the BeOS example of including the necessary sem.h declarations in src/include/port/darwin.h. this is rather messy at the moment and can be dumped once apple releases a version of PB with sysv sem built into the kernel.
- i'm a bit confused over the __powerpc__ tas function in s_lock.c (there i assume for the ppc-linux port). it doesn't compile at all on darwin so i just added a version that does work on darwin under DARWIN_OS. it's potentially a bit confusing and s_lock.c should probably be changed to include a better conditional.
bruce
Attachments:
pg_darwin.diffapplication/octet-stream; name=pg_darwin.diff; x-unix-mode=0644Download
Index: configure.in
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/configure.in,v
retrieving revision 1.63
diff -c -r1.63 configure.in
*** configure.in 2000/10/21 22:36:10 1.63
--- configure.in 2000/10/22 23:28:29
***************
*** 64,69 ****
--- 64,70 ----
beos*) template=beos ;;
bsdi*) template=bsdi ;;
cygwin*) template=win ;;
+ darwin*) template=darwin ;;
dgux*) template=dgux ;;
freebsd*) template=freebsd ;;
hpux*) template=hpux ;;
Index: src/Makefile.shlib
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/Makefile.shlib,v
retrieving revision 1.26
diff -c -r1.26 Makefile.shlib
*** src/Makefile.shlib 2000/10/20 21:03:38 1.26
--- src/Makefile.shlib 2000/10/22 23:28:33
***************
*** 128,133 ****
--- 128,138 ----
endif
endif
+ ifeq ($(PORTNAME), darwin)
+ shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
+ override CFLAGS += $(CFLAGS_SL)
+ endif
+
ifeq ($(PORTNAME), hpux)
# HPUX doesn't believe in version numbers for shlibs
shlib := lib$(NAME)$(DLSUFFIX)
***************
*** 227,232 ****
--- 232,238 ----
endif # not win
ifdef shlib
+ ifneq ($(PORTNAME), darwin)
ifneq ($(PORTNAME), beos)
ifneq ($(PORTNAME), win)
ifneq ($(PORTNAME), aix)
***************
*** 275,280 ****
--- 281,295 ----
$(CC) -Xlinker -soname=$@ $(LDFLAGS_SL) -o $@ _APP_ $(OBJS) $(SHLIB_LINK)
endif # PORTNAME == beos
+
+ else # PORTNAME == darwin
+
+ # Darwin case
+ $(shlib): $(OBJS)
+ $(CC) $(CFLAGS_SL) -o $@ $(OBJS) $(SHLIB_LINK)
+
+ endif # PORTNAME == darwin
+
endif # shlib
Index: src/backend/port/Makefile.in
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/port/Makefile.in,v
retrieving revision 1.27
diff -c -r1.27 Makefile.in
*** src/backend/port/Makefile.in 2000/10/20 21:03:45 1.27
--- src/backend/port/Makefile.in 2000/10/22 23:28:37
***************
*** 27,32 ****
--- 27,37 ----
ifeq ($(PORTNAME), qnx4)
OBJS += getrusage.o qnx4/SUBSYS.o
endif
+ ifeq ($(PORTNAME), darwin)
+ ifndef HAVE_SYS_SEM_H
+ OBJS += darwin/SUBSYS.o
+ endif
+ endif
ifeq ($(PORTNAME), beos)
OBJS += beos/SUBSYS.o
endif
***************
*** 39,44 ****
--- 44,54 ----
qnx4.dir:
$(MAKE) -C qnx4 all
+
+ darwin/SUBSYS.o: darwin.dir
+
+ darwin.dir:
+ $(MAKE) -C darwin all
beos/SUBSYS.o: beos.dir
Index: src/backend/storage/buffer/s_lock.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/storage/buffer/s_lock.c,v
retrieving revision 1.24
diff -c -r1.24 s_lock.c
*** src/backend/storage/buffer/s_lock.c 2000/01/26 05:56:52 1.24
--- src/backend/storage/buffer/s_lock.c 2000/10/22 23:28:38
***************
*** 143,148 ****
--- 143,169 ----
#endif /* __powerpc__ */
+ #if defined(DARWIN_OS)
+ /* Note: need a nice gcc constrained asm version so it can be inlined */
+ static void
+ tas_dummy()
+ {__asm__(" \n\
+ .globl _tas \n\
+ _tas: lwarx r5,0,r3 \n\
+ cmpwi r5,0 \n\
+ bne fail \n\
+ addi r5,r5,1 \n\
+ stwcx. r5,0,r3 \n\
+ beq success \n\
+ fail: li r3,1 \n\
+ blr \n\
+ success: li r3,0 \n\
+ blr \n\
+ ");
+ }
+
+ #endif /* DARWIN_OS */
+
#if defined(__mips__)
static void
tas_dummy()
Index: src/test/regress/resultmap
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/test/regress/resultmap,v
retrieving revision 1.35
diff -c -r1.35 resultmap
*** src/test/regress/resultmap 2000/10/22 22:15:09 1.35
--- src/test/regress/resultmap 2000/10/22 23:28:45
***************
*** 13,18 ****
--- 13,19 ----
float8/i.86-pc-cygwin*=float8-small-is-zero
geometry/.*-bsdi=geometry-positive-zeros-bsd
geometry/.*-freebsd=geometry-positive-zeros
+ geometry/.*-apple-darwin1.2=geometry-positive-zeros
geometry/.*-freebsdelf4.0=geometry-positive-zeros-bsd
geometry/.*-irix6=geometry-irix
geometry/.*-netbsd=geometry-positive-zeros
***************
*** 36,41 ****
--- 37,43 ----
int2/.*-aix4=int2-too-large
int2/.*-bsdi=int2-too-large
int2/.*-freebsd=int2-too-large
+ int2/.*-apple-darwin=int2-too-large
int2/.*-irix6=int2-too-large
int2/.*-netbsd=int2-too-large
int2/.*-qnx=int2-too-large
***************
*** 51,56 ****
--- 53,59 ----
int4/.*-aix4=int4-too-large
int4/.*-bsdi=int4-too-large
int4/.*-freebsd=int4-too-large
+ int4/.*-apple-darwin=int4-too-large
int4/.*-irix6=int4-too-large
int4/.*-netbsd=int4-too-large
int4/.*-qnx=int4-too-large
Do you actually *need* -O0 on darwin with current sources?
Or is that a leftover from 7.0.* ? AFAIK -O2 should work on PPC.
regards, tom lane
I'll take this and integrate it. Please, nobody commit this right now,
I'm messing with things...
Bruce Hartzler writes:
this patch and tar archive will add support for the darwin/osxpb to the current cvs tree.
a couple things to note:
- unpack the tar archive in pgsql/
- the config.guess and config.sub files have been updated by apple to support their new os. i don't think these changes have been folded back in to the main archive yet (at least they aren't in the pgsql cvs yet). these need to be copied over from /usr/libexec/config.* in order to obtain the correct os (e.g. powerpc-apple-darwin1.2 on PB).
- the diff only patches configure.in so autoconf needs to be rerun
- the situation with darwin's implementation of sysv semaphores is in progress at the moment (the shm/ipc support *is* there and seems to work fine). so this patch uses HAVE_SYS_SEM_H to conditionally build the src/backend/port/darwin semaphore code (borrowed from qnx4). I've followed the BeOS example of including the necessary sem.h declarations in src/include/port/darwin.h. this is rather messy at the moment and can be dumped once apple releases a version of PB with sysv sem built into the kernel.
- i'm a bit confused over the __powerpc__ tas function in s_lock.c (there i assume for the ppc-linux port). it doesn't compile at all on darwin so i just added a version that does work on darwin under DARWIN_OS. it's potentially a bit confusing and s_lock.c should probably be changed to include a better conditional.
bruce
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Bruce Hartzler writes:
this patch and tar archive will add support for the darwin/osxpb to the current cvs tree.
Next time you can make your patch with "diff -crN" so that you don't have
to create a separate tarball.
- the config.guess and config.sub files have been updated by apple to
support their new os. i don't think these changes have been folded
back in to the main archive yet
I installed the latest ones from GNU which claim to support it according
to the ChangeLog.
- the situation with darwin's implementation of sysv semaphores is in
progress at the moment (the shm/ipc support *is* there and seems to
work fine). so this patch uses HAVE_SYS_SEM_H to conditionally build
HAVE_SYS_SEM_H is a preprocessor symbol, not a makefile variable.
the src/backend/port/darwin semaphore code (borrowed from qnx4).
If you could arrange it, could you use the same files as QNX, perhaps with
an #ifdef here or there
I've followed the BeOS example of including the necessary sem.h
declarations in src/include/port/darwin.h. this is rather messy at the
moment and can be dumped once apple releases a version of PB with sysv
sem built into the kernel.
The include/port/beos.h isn't really a shining example of how to do this.
This file is include *everywhere*, but we don't want to know about
semaphores everywhere. I'd prefer it if you use the QNX approach and
symlink sem.h into an include directory (e.g., /usr/local/include/sys),
since it's only temporary anyway.
Also, overriding configure results (� la #undef HAVE_UNION_SEMUN) isn't
cool.
I'm also somewhat concerned about the dynloader.c because it's under the
Apache license which has a funny advertisement clause. Comments from
someone?
- i'm a bit confused over the __powerpc__ tas function in s_lock.c
(there i assume for the ppc-linux port). it doesn't compile at all on
darwin so i just added a version that does work on darwin under
DARWIN_OS. it's potentially a bit confusing and s_lock.c should
probably be changed to include a better conditional.
The compiler probably predefines something like __darwin__, which you
should use. You can find out with
touch foo.h
cc -E -dM foo.h
rm foo.h
And finally, what's up with this:
CFLAGS='-O0 -g -traditional-cpp'
? What's wrong with the "modern-cpp"?
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Next time you can make your patch with "diff -crN" so that you don't have
to create a separate tarball.
No problem. I tried just doing a diff with cvs but wasn't able to get
the -N option to work. This is the first time I've ever tried
patching unix software so I'm sorry if it's a bit messy. Thanks for
you help in getting it right.
- the config.guess and config.sub files have been updated by apple to
support their new os. i don't think these changes have been folded
back in to the main archive yetI installed the latest ones from GNU which claim to support it according
to the ChangeLog.
I'll try checking out the new versions and see if they work. I can
send you a diff with the ones I have here if you want to see the
additions Apple made.
I've followed the BeOS example of including the necessary sem.h
declarations in src/include/port/darwin.h. this is rather messy at the
moment and can be dumped once apple releases a version of PB with sysv
sem built into the kernel.The include/port/beos.h isn't really a shining example of how to do this.�
This file is include *everywhere*, but we don't want to know about
semaphores everywhere. I'd prefer it if you use the QNX approach and
symlink sem.h into an include directory (e.g., /usr/local/include/sys),
since it's only temporary anyway.
I agree it's rather messy. I originally had just used the sym link in
/usr/local/include, but as I said, some of the newer Darwin kernels
have the sysv sem.h file already there and I was worried about people
overwriting it. If you think it's fair to put this responsibility on
the end user, I'm ok with that. I just thought it might be nice to
check and see if the semaphore implementation was already there, and
if not, build the necessary parts. I'll switch it back to the way it
was.
I'm also somewhat concerned about the dynloader.c because it's under the
Apache license which has a funny advertisement clause. Comments from
someone?
I wondering about this too. I'll try emailing Wilfredo Sanchez and
see if I can get the code outside the Apache license. This would
probably be easiest.
The compiler probably predefines something like __darwin__, which you
should use. You can find out with
It doesn't actually provide __darwin__ but as I mentioned in a
previous post, Apple is suggesting people use __APPLE__ combined with
__ppc__ or __i386__ for the different darwin builds. The section in
s_lock.c should probably be changed to reflect this instead of using
DARWIN_OS.
And finally, what's up with this:
CFLAGS='-O0 -g -traditional-cpp'
? What's wrong with the "modern-cpp"?
Apple's "modern-cpp" called cpp-precomp uses some strange parsing
that breaks on several files in the postgresql build. They are still
working on it apparently and are suggesting people simply use the
-traditional-cpp flag when this happens instead of trying to update
the files.
Thanks again for all your comments and suggestions.
Bruce
[ folks in Cc: were also interested in Darwin/MacOS X support ]
Bruce Hartzler writes:
this patch and tar archive will add support for the darwin/osxpb to the current cvs tree.
Greetings.
I installed parts of your patch, which should at least get you, or other
interested people going.
Open issues:
* Dynamic loader code that's under a BSD license. I've just installed
dummy files for now.
* It was reported that the assembler doesn't like the__powerpc__ code in
backend/storage/buffer/s_lock.h. Your code looks essentially the same, so
it seems to be a syntax discrepancy between the GNU assembler and whatever
your system uses. Perhaps we could check if the altered code works on
other systems as well before we install duplicates? (The GNU assembler
ought to be pretty flexible.)
* Semaphore support reportedly does exist in new kernels, so I don't think
we need to add that to the tree. Maybe a separate patch for older kernels
is in order.
Besides that, try to build all the optional parts (C++, Tcl, ODBC, ...) as
well.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Greetings.
I installed parts of your patch, which should at least get you, or other
interested people going.
Open issues:* Dynamic loader code that's under a BSD license. I've just installed
dummy files for now.
Thanks Peter,
I heard back from Fred about the dynamic loader code. He gave the ok
to use it outside the Apache license (see below).
* It was reported that the assembler doesn't like the__powerpc__ code in
backend/storage/buffer/s_lock.h. Your code looks essentially the same, so
it seems to be a syntax discrepancy between the GNU assembler and whatever
your system uses. Perhaps we could check if the altered code works on
other systems as well before we install duplicates? (The GNU assembler
ought to be pretty flexible.)
You are probably right. Apple's gcc-based compiler was split off from
the main tree a while back when they were adding a bunch of
NEXT-based objective-c compiling routines to it. I know people have
been trying to merge the changes back into the main gcc tree (and new
gcc changes into Apple's) but I don't know how long this process it
going to go on for. For now though, it won't compile the other PPC
code already in there.
* Semaphore support reportedly does exist in new kernels, so I don't think
we need to add that to the tree. Maybe a separate patch for older kernels
is in order.
This sound fine with me. The C++ stuff worked ok with the cvs tree.
The Tcl stuff is on the way and might be working now (it's on the
Darwin cvs server). I'll look into ODBC.
Thanks for your help,
Bruce
-------------------------------------------
Delivered-To: bruceh@mail.utexas.edu
Date: Wed, 25 Oct 2000 12:24:07 +0000
Reply-To: wsanchez@apple.com
From: Wilfredo Sanchez <wsanchez@apple.com>
To: Bruce Hartzler <bruceh@mail.utexas.edu>
Mime-Version: 1.0 (Apple Message framework v337)
Subject: Re: dynloader code in Apache
Status: R
I was wondering if you had released your dynloader code under any�
other licenses besides Apache's? I've brought it over in order to get�
Postgresql running on Darwin but I think the people managing the�
Postgresql code are a bit uneasy about using it under Apache's�
advertising license. Anything you might suggest would be most helpful.
The code is pretty simple to reproduce from just looking at the headers.
You needn't worry about the license. Pretend I sent it to you as a patch.
-Fred
Wilfredo S�nchez, wsanchez@apple.com
Open Source Engineering Lead
Apple Computer, Inc., Core Operating System Group
1 Infinite Loop, Cupertino, CA 94086, 408.974-5174