Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c51b00a

Browse files
committed
PL/Python integration: support in create/droplang, add CVS keywords,
remove useless files, beat some sense into Makefile. For me it builds and sort of runs, so it's a start.
1 parent bb30d49 commit c51b00a

File tree

15 files changed

+75
-334
lines changed

15 files changed

+75
-334
lines changed

src/bin/scripts/createlang.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
# Portions Copyright (c) 1994, Regents of the University of California
99
#
10-
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.24 2001/05/09 22:08:19 petere Exp $
10+
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.25 2001/05/12 01:30:30 petere Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

@@ -209,9 +209,15 @@ case "$langname" in
209209
handler="plperl_call_handler"
210210
object="plperl"
211211
;;
212+
plpython)
213+
lancomp="PL/Python"
214+
trusted="TRUSTED "
215+
handler="plpython_call_handler"
216+
object="plpython"
217+
;;
212218
*)
213219
echo "$CMDNAME: unsupported language '$langname'" 1>&2
214-
echo "Supported languages are 'plpgsql', 'pltcl', 'pltclu', and 'plperl'." 1>&2
220+
echo "Supported languages are 'plpgsql', 'pltcl', 'pltclu', 'plperl', and 'plpython'." 1>&2
215221
exit 1
216222
;;
217223
esac

src/bin/scripts/droplang

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
88
# Portions Copyright (c) 1994, Regents of the University of California
99
#
10-
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.14 2001/05/09 22:08:19 petere Exp $
10+
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.15 2001/05/12 01:30:30 petere Exp $
1111
#
1212
#-------------------------------------------------------------------------
1313

@@ -177,9 +177,13 @@ case "$langname" in
177177
lancomp="PL/Perl"
178178
handler="plperl_call_handler"
179179
;;
180+
plpython)
181+
lancomp="PL/Python"
182+
handler="plpython_call_handler"
183+
;;
180184
*)
181185
echo "$CMDNAME: unsupported language '$langname'" 1>&2
182-
echo "Supported languages are 'plpgsql', 'pltcl', 'pltclu', and 'plperl'." 1>&2
186+
echo "Supported languages are 'plpgsql', 'pltcl', 'pltclu', 'plperl', and 'plpython'." 1>&2
183187
exit 1
184188
;;
185189
esac

src/pl/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# Copyright (c) 1994, Regents of the University of California
66
#
7-
# $Header: /cvsroot/pgsql/src/pl/Makefile,v 1.19 2001/05/10 03:00:11 momjian Exp $
7+
# $Header: /cvsroot/pgsql/src/pl/Makefile,v 1.20 2001/05/12 01:30:30 petere Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -22,12 +22,12 @@ ifeq ($(with_perl), yes)
2222
DIRS += plperl
2323
endif
2424

25+
# Doesn't build portably yet.
2526
#ifeq ($(with_python), yes)
2627
#DIRS += plpython
2728
#endif
2829

2930
all install installdirs uninstall depend distprep:
30-
@echo "PL/Python disabled until merged into our Makefile system, bjm 2001-05-09"
3131
@for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done
3232

3333
clean distclean maintainer-clean:

src/pl/plpython/Makefile

Lines changed: 41 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,60 @@
1+
# $Header: /cvsroot/pgsql/src/pl/plpython/Makefile,v 1.4 2001/05/12 01:30:30 petere Exp $
12

2-
# cflags. pick your favorite
3-
#
4-
CC=gcc
5-
CFLAGS=-g -O0 -Wall -Wmissing-declarations -fPIC
3+
subdir = src/pl/plpython
4+
top_builddir = ../../..
5+
include $(top_builddir)/src/Makefile.global
66

7-
# build info for python, alter as needed
8-
#
7+
# These things ought to go into $(top_srcdir)/config/python.m4 sometime.
98

10-
# python headers
11-
#
12-
#INCPYTHON=/usr/include/python1.5
13-
INCPYTHON=/usr/include/python2.0
9+
PYTHON_VERSION := $(shell $(PYTHON) -c 'import sys; print sys.version[:3]')
10+
PYTHON_INCLUDE := $(shell $(PYTHON) -c 'import sys; print sys.prefix')/include/python$(PYTHON_VERSION)
1411

15-
# python shared library
16-
#
17-
#LIBPYTHON=python1.5
18-
LIBPYTHON=python2.0
12+
override CPPFLAGS := -I$(srcdir) -I$(PYTHON_INCLUDE) $(CPPFLAGS)
1913

20-
# if python is someplace odd
21-
#
22-
LIBPYTHONPATH=/usr/lib
14+
PYTHON_LIB := $(shell $(PYTHON) -c 'import sys; print sys.exec_prefix')/lib/python$(PYTHON_VERSION)
2315

24-
# python 2 seems to want libdb
25-
# various db libs are still messed on my system
26-
#
27-
#LIBPYTHONEXTRA=/usr/lib/libdb2.so.2.7.7
28-
#LIBPYTHONEXTRA=-ldb2
16+
NAME = plpython
17+
SO_MAJOR_VERSION = 0
18+
SO_MINOR_VERSION = 0
19+
OBJS = plpython.o
2920

30-
LDPYTHON=-L$(LIBPYTHONPATH) -l$(LIBPYTHON) $(LIBPYTHONEXTRA)
21+
# This static version might work on most ELF systems...
22+
SHLIB_LINK += $(PYTHON_LIB)/config/libpython$(PYTHON_VERSION).a
23+
# ...otherwise you need a shared version, but you need to build that yourself.
24+
#SHLIB_LINK += -lpython$(PYTHON_VERSION)
3125

32-
# build info for postgres
33-
#
26+
# Python uses this. Should become a configure check.
27+
SHLIB_LINK += -lpthread
3428

35-
# postgres headers. the installed include directory doesn't work for me
36-
#
37-
#INCPOSTGRES=/usr/include/postgres
38-
INCPOSTGRES=/home/andrew/builds/postgresql/src/include
29+
# Python 2 seems to want libdb.
30+
#SHLIB_LINK += -ldb2
3931

40-
# hopefully you won't need this utter crap...
41-
# but if you can't patch the appropriate dynloader file, try this. you
42-
# may have to add other modules.
43-
#
44-
#DLDIR=/usr/lib/python1.5/lib-dynload
45-
#DLHACK=$(DLDIR)/arraymodule.so $(DLDIR)/timemodule.so $(DLDIR)/cmathmodule.so $(DLDIR)/errnomodule.so $(DLDIR)/mathmodule.so $(DLDIR)/md5module.so $(DLDIR)/operator.so
46-
# $(DLDIR)/shamodule.so
4732

48-
# shouldn't need to alter anything below here
33+
# Hopefully you won't need this utter crap. But if you can't patch
34+
# the appropriate dynloader file, try this. You may have to add other
35+
# modules.
4936
#
50-
INCLUDES=-I$(INCPYTHON) -I$(INCPOSTGRES) -I./
37+
#DLDIR=$(PYTHON_LIB)/lib-dynload
38+
#DLHACK=$(DLDIR)/arraymodule.so $(DLDIR)/timemodule.so $(DLDIR)/cmathmodule.so $(DLDIR)/errnomodule.so $(DLDIR)/mathmodule.so $(DLDIR)/md5module.so $(DLDIR)/operator.so $(DLDIR)/shamodule.so
39+
#SHLIB_LINK += $(DLDIR)
40+
41+
include $(top_srcdir)/src/Makefile.shlib
5142

52-
# dynamic linker flags.
53-
#
54-
#LDFLAGS=--shared -Wl,-Bshareable -Wl,-E -Wl,-soname,$@
55-
LDFLAGS=--shared -Wl,-E -Wl,-soname,$@
5643

57-
.PHONY: clean
44+
all: all-lib
5845

59-
all: plpython.so
46+
install: all installdirs
47+
$(INSTALL_SHLIB) $(shlib) $(DESTDIR)$(libdir)/plpython$(DLSUFFIX)
6048

61-
plpython.o: plpython.c plpython.h
62-
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
49+
installdirs:
50+
$(mkinstalldirs) $(DESTDIR)$(libdir)
6351

64-
plpython.so: plpython.o
65-
$(CC) $(LDFLAGS) -o $@ $^ $(LDPYTHON) $(DLHACK) -ldl -lpthread -lm
52+
uninstall:
53+
rm -f $(DESTDIR)$(libdir)/plpython$(DLSUFFIX)
6654

67-
clean:
68-
rm -f plpython.so *.o
55+
clean distclean maintainer-clean: clean-lib
56+
rm -f $(OBJS)
57+
@rm -f error.diff feature.diff error.output feature.output test.log
6958

59+
installcheck:
60+
PATH=$(bindir):$$PATH $(SHELL) $(srcdir)/test.sh

src/pl/plpython/error.diff

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/pl/plpython/error.output

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/pl/plpython/feature.diff

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/pl/plpython/feature.output

Lines changed: 0 additions & 139 deletions
This file was deleted.

0 commit comments

Comments
 (0)