From 5ca0c61cd36db4835fd19b4ef6a0f8fca4418408 Mon Sep 17 00:00:00 2001 From: jlam Date: Tue, 9 Apr 2002 04:33:18 +0000 Subject: 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. --- lang/python22/Makefile | 13 ++++++++++-- lang/python22/distinfo | 5 +++-- lang/python22/patches/patch-aa | 45 +++++++++++++++++++++++++++++------------- lang/python22/patches/patch-ae | 23 +++++++++++++++++++++ 4 files changed, 68 insertions(+), 18 deletions(-) create mode 100644 lang/python22/patches/patch-ae (limited to 'lang') diff --git a/lang/python22/Makefile b/lang/python22/Makefile index 0fcca37db74..77023e04b23 100644 --- a/lang/python22/Makefile +++ b/lang/python22/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1.1.1 2002/01/15 17:11:03 drochner Exp $ +# $NetBSD: Makefile,v 1.2 2002/04/09 04:33:18 jlam Exp $ # DISTNAME= Python-2.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.2 +.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 diff --git a/lang/python22/distinfo b/lang/python22/distinfo index b49a7607609..adeea7c43b5 100644 --- a/lang/python22/distinfo +++ b/lang/python22/distinfo @@ -1,8 +1,9 @@ -$NetBSD: distinfo,v 1.3 2002/03/22 15:20:23 drochner Exp $ +$NetBSD: distinfo,v 1.4 2002/04/09 04:33:19 jlam Exp $ SHA1 (Python-2.2.tgz) = ff78e4ab501bdb089a81884187ce2f4b44091ba2 Size (Python-2.2.tgz) = 6542443 bytes -SHA1 (patch-aa) = 04bf82c8d760e98f70453aa9c765a7bb7b5ad853 +SHA1 (patch-aa) = d6524d37f2e06075aa78c3675c415bc8ac15d3ab SHA1 (patch-ab) = aa06824d9f595a24aaddc96c83f31646f522ab09 SHA1 (patch-ac) = 82e5f3505321df21adde4a9a1bf752d157fb61cd SHA1 (patch-ad) = 7b532616983b152b0c313cc4a1e372483c8b0eb9 +SHA1 (patch-ae) = aefeec78e25631a6e9e2aa047dce12c9c522715e diff --git a/lang/python22/patches/patch-aa b/lang/python22/patches/patch-aa index d112a0cce6d..c83e0ba56a8 100644 --- a/lang/python22/patches/patch-aa +++ b/lang/python22/patches/patch-aa @@ -1,23 +1,29 @@ -$NetBSD: patch-aa,v 1.3 2002/03/22 15:20:24 drochner Exp $ +$NetBSD: patch-aa,v 1.4 2002/04/09 04:33:20 jlam Exp $ ---- setup.py.orig Mon Dec 17 18:24:43 2001 -+++ setup.py Fri Mar 22 12:28:30 2002 -@@ -193,10 +193,10 @@ +--- setup.py.orig Mon Dec 17 12:24:43 2001 ++++ setup.py +@@ -192,11 +192,15 @@ + return platform def detect_modules(self): - # Ensure that /usr/local is always used +- # 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' ) -+# 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) try: have_unicode = unicode -@@ -256,7 +256,7 @@ +@@ -256,7 +260,7 @@ if have_unicode: exts.append( Extension('unicodedata', ['unicodedata.c']) ) # access to ISO C locale support @@ -26,7 +32,7 @@ $NetBSD: patch-aa,v 1.3 2002/03/22 15:20:24 drochner Exp $ # Modules with some UNIX dependencies -- on by default: # (If you have a really backward UNIX, select and socket may not be -@@ -314,13 +314,13 @@ +@@ -314,13 +318,13 @@ # These represent audio samples or images as strings: # Disabled on 64-bit platforms @@ -44,7 +50,7 @@ $NetBSD: patch-aa,v 1.3 2002/03/22 15:20:24 drochner Exp $ # readline if self.compiler.find_library_file(lib_dirs, 'readline'): -@@ -347,14 +347,10 @@ +@@ -347,14 +351,10 @@ # socket(2) # Detect SSL support for the socket module ssl_incs = find_file('openssl/ssl.h', inc_dirs, @@ -61,7 +67,18 @@ $NetBSD: patch-aa,v 1.3 2002/03/22 15:20:24 drochner Exp $ if (ssl_incs is not None and ssl_libs is not None): -@@ -481,8 +477,8 @@ +@@ -470,8 +470,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 != 'darwin'): + # OSX has an old Berkeley curses, not good enough for +@@ -481,8 +481,8 @@ else: curses_libs = ['curses', 'termcap'] @@ -72,7 +89,7 @@ $NetBSD: patch-aa,v 1.3 2002/03/22 15:20:24 drochner Exp $ # If the curses module is enabled, check for the panel module if (module_enabled(exts, '_curses') and -@@ -784,7 +780,7 @@ +@@ -784,7 +784,7 @@ ext_modules=[Extension('struct', ['structmodule.c'])], # Scripts to install diff --git a/lang/python22/patches/patch-ae b/lang/python22/patches/patch-ae new file mode 100644 index 00000000000..dfc45d4431b --- /dev/null +++ b/lang/python22/patches/patch-ae @@ -0,0 +1,23 @@ +$NetBSD: patch-ae,v 1.1 2002/04/09 04:33:21 jlam Exp $ + +--- Lib/distutils/command/build_ext.py.orig Thu Dec 6 17:59:54 2001 ++++ Lib/distutils/command/build_ext.py +@@ -472,8 +472,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, -- cgit v1.2.3