It took a while to get the option where I wanted it - but now python will
use openpkg static libraries when building modules. Had to substitute
Makefile after configure - rather ugly but seemed better than overriding all
of LDSHARED when running make. Patch is below.

Martin
----
Martin Andrews
[EMAIL PROTECTED] 

--- python.spec~        Fri Feb  7 09:25:09 2003
+++ python.spec Sat Feb  8 15:38:33 2003
@@ -33,7 +33,10 @@
 Group:        Language
 License:      GPL
 Version:      2.2.2
-Release:      1.2.0
+Release:      lion.1
+
+#   package options
+%option       with_expat  yes
 
 #   list of sources
 Source0:
ftp://ftp.python.org/pub/python/%{version}/Python-%{version}.tgz
@@ -42,6 +45,9 @@
 Prefix:       %{l_prefix}
 BuildRoot:    %{l_buildroot}
 BuildPreReq:  OpenPKG, openpkg >= 1.2.0, gcc
+%if "%{with_expat}" == "yes"
+BuildPreReq:  expat
+%endif
 PreReq:       OpenPKG, openpkg >= 1.2.0
 AutoReq:      no
 AutoReqProv:  no
@@ -59,6 +65,8 @@
 %prep
     %setup -q -n Python-%{version}
     %{l_shtool} subst -e 's;-O3;-O2;g' configure
+    # Search for libraries in openpkg prefix - not /usr/local
+    %{l_shtool} subst -e "s;/usr/local;%{l_prefix};g" setup.py
 
 %build
     CC="%{l_cc}" @@ -67,6 +75,8 @@
     CXXFLAGS="%{l_cxxflags -O}"      ./configure          --prefix=%{l_prefix}
+    # Add -mimpure-text to LDSHARED so that modules can use static
libraries.
+    %{l_shtool} subst -e "s;-shared;-shared -mimpure-text;g" Makefile
     %{l_make} %{l_mflags -O}
 
 %install

> -----Original Message-----
> From: Andrews, Martin [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, February 08, 2003 10:07 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: scripting language extensions - shared libraries
> 
> 
> Hold on. I think you led me to the solution - it appears that python
> defaults to not allow this incorporation of static libraries:
> 
> http://mail.python.org/pipermail/patches/2001-March/004239.html
> 
> I am trying python compilation with -mimpure-text.
> 
> Martin
> 
> > -----Original Message-----
> > From: Ralf S. Engelschall [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, February 08, 2003 9:26 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: scripting language extensions - shared libraries
> > 
> > 
> > On Fri, Feb 07, 2003, Andrews, Martin wrote:
> > 
> > > I am trying to tweak the python package to get support for 
> > xml - it requires
> > > expat. I thought I had a clever (for my first openpkg 
> > patch) solution to
> > > pick up libraries from the openpkg installation but I think 
> > I am now butting
> > > my head against the static library policy - how do you get 
> > binary extensions
> > > to scripting languages without shared libraries? Any 
> > thoughts? This may be a
> > > show stopper for me. Here are the errors that occur while 
> > building python on
> > > solaris (7 and 9):
> > 
> > Extensions for scripting languages do usually not require
> > shared libraries, they just provide their extensions as shared
> > libraries/objects. The usual approach (which Perl and Python use)
> > are that an extension module foo.so is build by linking against an
> > externally available library libfoo.a (a so-called static library).
> > This step _includes_ the static library into the new shared library
> > foo.so which in turn is loaded on demand by the scripting 
> language via
> > dlopen(3) and friends (like the GNU libtool wrapper around it).
> > 
> > For this to work, the static library libfoo.a in Unix theory 
> > just has to
> > be compiled with Position Independent Code (PIC), but is not 
> > required to
> > be linked into a shared library format itself. And because 
> all modern
> > Unix platforms are smart enough to on-the-fly transform non-PIC into
> > PIC, in practice you can create a scripting language 
> > extension foo.so by
> > linking in an arbitrary static library libfoo.a.
> > 
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
Developer Communication List                   [EMAIL PROTECTED]

Reply via email to