Teach the extension building process about buildlink, and allow passing

LDFLAGS to the linker command when linking a python extension.  This lets
us pass the right flags to correctly find libraries required for certain
extensions, e.g. zlib.so.

Also explicitly comment out a few extensions that aren't being built and
should never be.
This commit is contained in:
jlam 2002-04-09 04:14:39 +00:00
parent 57ea52bf0a
commit 5ec676a042
4 changed files with 93 additions and 10 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.4 2002/01/22 13:05:03 drochner Exp $
# $NetBSD: Makefile,v 1.5 2002/04/09 04:14:39 jlam Exp $
#
DISTNAME= Python-2.1.2
@ -11,7 +11,8 @@ MAINTAINER= packages@netbsd.org
HOMEPAGE= http://www.python.org/
COMMENT= Interpreted, interactive, object-oriented programming language
GNU_CONFIGURE= YES
USE_BUILDLINK_ONLY= YES
GNU_CONFIGURE= YES
CONFIGURE_ARGS+= --without-threads
INSTALL_TARGET= altinstall
@ -19,4 +20,12 @@ INSTALL_TARGET= altinstall
post-extract:
${MV} ${WRKSRC}/Tools/scripts/pydoc ${WRKSRC}/Tools/scripts/pydoc2.1
.include "../../devel/zlib/buildlink.mk"
.include "../../mk/bsd.pkg.mk"
# This comes after bsd.pkg.mk so that the LDFLAGS here overrides the one
# set earlier in the environment (last definition wins).
#
.if ${OBJECT_FMT} == "a.out"
MAKE_ENV+= LDFLAGS="${LDFLAGS:S/-Wl,//}"
.endif

View file

@ -1,7 +1,8 @@
$NetBSD: distinfo,v 1.4 2002/01/28 09:09:15 drochner Exp $
$NetBSD: distinfo,v 1.5 2002/04/09 04:14:40 jlam Exp $
SHA1 (Python-2.1.2.tgz) = f7279eaa43a6692948586279c5e85992093a70cc
Size (Python-2.1.2.tgz) = 6189889 bytes
SHA1 (patch-aa) = 8273acc49a9eedad6e09685098178f3b7fb8f1c6
SHA1 (patch-ab) = f87a4d5c76182ab27ba79b42f00e8a2ff63bcf2b
SHA1 (patch-ac) = 48c85ff3b1d9cca132d86090aafa74e8e40e448b
SHA1 (patch-ac) = 53a478a9b0ff30e75a141c1c3621edf052df9206
SHA1 (patch-ad) = 769bcd7803723c8d538a74173792ffcc491fa414

View file

@ -1,8 +1,30 @@
$NetBSD: patch-ac,v 1.2 2002/01/28 09:09:16 drochner Exp $
$NetBSD: patch-ac,v 1.3 2002/04/09 04:14:41 jlam Exp $
--- setup.py.orig Thu Dec 27 22:51:02 2001
+++ setup.py Sun Jan 27 15:53:18 2002
@@ -265,13 +265,13 @@
--- setup.py.orig Thu Dec 27 16:51:02 2001
+++ setup.py
@@ -145,11 +145,16 @@
return platform
def detect_modules(self):
- # Ensure that /usr/local is always used
- if '/usr/local/lib' not in self.compiler.library_dirs:
- self.compiler.library_dirs.insert(0, '/usr/local/lib')
- if '/usr/local/include' not in self.compiler.include_dirs:
- self.compiler.include_dirs.insert(0, '/usr/local/include' )
+ # Add the buildlink directories for pkgsrc
+ if os.environ.has_key('BUILDLINK_DIR'):
+ dir = os.environ['BUILDLINK_DIR']
+ libdir = dir + '/lib'
+ incdir = dir + '/include'
+ if libdir not in self.compiler.library_dirs:
+ self.compiler.library_dirs.insert(0, libdir)
+ if incdir not in self.compiler.include_dirs:
+ self.compiler.include_dirs.insert(0, incdir)
+
# lib_dirs and inc_dirs are used to search for files;
# if a file is found in one of those directories, it can
@@ -265,13 +270,13 @@
# These represent audio samples or images as strings:
# Disabled on 64-bit platforms
@ -20,7 +42,35 @@ $NetBSD: patch-ac,v 1.2 2002/01/28 09:09:16 drochner Exp $
# readline
if self.compiler.find_library_file(lib_dirs, 'readline'):
@@ -417,8 +417,8 @@
@@ -296,14 +301,10 @@
# socket(2)
# Detect SSL support for the socket module
ssl_incs = find_file('openssl/ssl.h', inc_dirs,
- ['/usr/local/ssl/include',
- '/usr/contrib/ssl/include/'
- ]
+ []
)
ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,
- ['/usr/local/ssl/lib',
- '/usr/contrib/ssl/lib/'
- ] )
+ [] )
if (ssl_incs is not None and
ssl_libs is not None):
@@ -408,8 +409,8 @@
if (self.compiler.find_library_file(lib_dirs, 'ncurses')):
curses_libs = ['ncurses']
- exts.append( Extension('_curses', ['_cursesmodule.c'],
- libraries = curses_libs) )
+# exts.append( Extension('_curses', ['_cursesmodule.c'],
+# libraries = curses_libs) )
elif (self.compiler.find_library_file(lib_dirs, 'curses')) and platform[:6] != 'darwin':
# OSX has an old Berkeley curses, not good enough for the _curses module.
if (self.compiler.find_library_file(lib_dirs, 'terminfo')):
@@ -417,8 +418,8 @@
else:
curses_libs = ['curses', 'termcap']
@ -31,7 +81,7 @@ $NetBSD: patch-ac,v 1.2 2002/01/28 09:09:16 drochner Exp $
# If the curses module is enabled, check for the panel module
if (os.path.exists('Modules/_curses_panel.c') and
@@ -609,7 +609,7 @@
@@ -609,7 +610,7 @@
ext_modules=[Extension('struct', ['structmodule.c'])],
# Scripts to install

View file

@ -0,0 +1,23 @@
$NetBSD: patch-ad,v 1.1 2002/04/09 04:14:41 jlam Exp $
--- Lib/distutils/command/build_ext.py.orig Sat Mar 17 15:15:41 2001
+++ Lib/distutils/command/build_ext.py
@@ -461,8 +461,18 @@
# that go into the mix.
if ext.extra_objects:
objects.extend(ext.extra_objects)
+
+ # Two possible sources for extra linker arguments:
+ # - 'extra_link_args' in Extension object
+ # - LDFLAGS environment variable
+ # The environment variable should take precedence, and
+ # any sensible compiler will give precedence to later
+ # command line args. Hence we combine them in order:
extra_args = ext.extra_link_args or []
+
+ if os.environ.has_key('LDFLAGS'):
+ extra_args.extend(string.split(os.environ['LDFLAGS']))
self.compiler.link_shared_object(
objects, ext_filename,