[Pythonmac-SIG] Another build question: ssl?
Ronald Oussoren
oussoren@cistron.nl
Wed, 20 Nov 2002 21:15:04 +0100
On Wednesday, Nov 20, 2002, at 17:53 Europe/Amsterdam, Russell E Owen
wrote:
>> On Tuesday, Nov 19, 2002, at 23:20 Europe/Amsterdam, Russell E Owen
>> wrote:
>>
>>> Anybody know how to build Python for MacOS X with socket.ssl
>>> support? Ideally I'd like to compile the framework build of Python
>>> 2.2.2 under MacOS X 10.2. The default way of doing it (as documented
>>> in /Mac/OSX/README) works but doesn't seem to include ssl support.
>>> If that's not reasonable, then I am willing to go with the normal
>>> unix build instead.
>>
>> Ssl support is automatic is ssl is located in either /usr/local/ssl
>> or /usr/contrib/ssl. If it is elsewhere: edit setup.py in the main
>> python source folder, and look at the lines where ssl_incs and
>> ssl_libs are set and add the place where you've installed ssl.
>>
>> This should enable ssl support for both framework and static builds.
>
> Further research (sorry I posted first before doing it) reveals that
> the libraries are where setup.py is looking for them:
>
> setup.py contains:
> lib_dirs = self.compiler.library_dirs + ['/lib', '/usr/lib']
> inc_dirs = self.compiler.include_dirs + ['/usr/include']
> ...
> ssl_incs = find_file('openssl/ssl.h', inc_dirs,...
> ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs,...
>
> and doing a search, I found these files on my disk:
>
> /usr/include/openssl/ssl.h
> /usr/lib/libssl.dylib
find_library_file seems to search for 'libssl.a' and 'libssl.so', and
therefore doesn't find libssl.dylib.
After playing around a little I now have a Python (2.3 CVS) that can
use '.dylib' for extension modules. See the end of this message for a
CVS diff.
Ronald
The actual patch: I've patched configure to check if this would work at
all, a correct patch would of course patch configure.in.
Index: configure
===================================================================
RCS file: /cvsroot/python/python/dist/src/configure,v
retrieving revision 1.359
diff -c -r1.359 configure
*** configure 13 Nov 2002 08:51:18 -0000 1.359
--- configure 20 Nov 2002 19:34:57 -0000
***************
*** 9225,9230 ****
--- 9225,9231 ----
case $ac_sys_system in
hp*|HP*) SO=.sl;;
CYGWIN*) SO=.dll;;
+ Darwin*) SO=.dylib;;
*) SO=.so;;
esac
fi
Index: Lib/distutils/extension.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/distutils/extension.py,v
retrieving revision 1.15
diff -c -r1.15 extension.py
*** Lib/distutils/extension.py 14 Nov 2002 02:25:41 -0000 1.15
--- Lib/distutils/extension.py 20 Nov 2002 19:34:59 -0000
***************
*** 214,220 ****
ext.extra_link_args.append(word)
if not value:
append_next_word = ext.extra_link_args
! elif suffix in (".a", ".so", ".sl", ".o"):
# NB. a really faithful emulation of makesetup would
# append a .o file to extra_objects only if it
# had a slash in it; otherwise, it would s/.o/.c/
--- 214,220 ----
ext.extra_link_args.append(word)
if not value:
append_next_word = ext.extra_link_args
! elif suffix in (".a", ".so", ".sl", ".o", ".dylib"):
# NB. a really faithful emulation of makesetup would
# append a .o file to extra_objects only if it
# had a slash in it; otherwise, it would s/.o/.c/
Index: Python/dynload_next.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/dynload_next.c,v
retrieving revision 2.13
diff -c -r2.13 dynload_next.c
*** Python/dynload_next.c 11 Feb 2002 16:21:00 -0000 2.13
--- Python/dynload_next.c 20 Nov 2002 19:35:00 -0000
***************
*** 11,16 ****
--- 11,18 ----
const struct filedescr _PyImport_DynLoadFiletab[] = {
{".so", "rb", C_EXTENSION},
{"module.so", "rb", C_EXTENSION},
+ {".dylib", "rb", C_EXTENSION},
+ {"module.dylib", "rb", C_EXTENSION},
{0, 0}
};