[Patches] [ python-Patches-1471883 ] --enable-universalsdk on Mac OS X

SourceForge.net noreply at sourceforge.net
Tue Apr 25 08:38:18 CEST 2006


Patches item #1471883, was opened at 2006-04-17 20:19
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1471883&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Build
Group: Python 2.5
Status: Open
Resolution: None
Priority: 5
Submitted By: Ronald Oussoren (ronaldoussoren)
Assigned to: Martin v. Löwis (loewis)
Summary: --enable-universalsdk on Mac OS X

Initial Comment:
This patch adds an --enable-universalsdk flag to configure. When this is 
used on a MacOS X system with Xcode 2.1 or later this can be used to 
create universal (aka "fat") binaries for python and its extensions.

This patches updates configure.in, which means autoconf should be used 
before checking in the patch.

I've tested the patch on Linux as well, it seems to have no bad effects 
there.

This patch is a cleaned up version of the code behind the --enable-
universal-sdk flag in the python24-fat tree at http://svn.pythonmac.org/
python24/python24-fat.



----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2006-04-25 08:38

Message:
Logged In: YES 
user_id=21627

Somehow, my last message got lost (I think SF was down, and
I never got back to retype it), sorry.

I disagree that the pyconfig.h.in change has no effect on
other platforms: it will affect any system that either
defines __BIG_ENDIAN__ or __LITTLE_ENDIAN__, e.g. gcc on
Itanium. Not a big problem, since it should be conceptually
correct on all systems where it is defined.

However, the real problem is that you are editing
pyconfig.h.in. This is a generated file, and your change is
lost the next time somebody runs autoheader. Please use
AH_VERBATIM to define the block to be generated for
WORDS_BIGENDIAN.

I can understand that you cannot use sys.byteorder. That
doesn't mean osxconfig.h is required, though: If pyconfig.h
already solves the problem, we should use that, instead of
duplicating it. For example, you could write a
expat_config.h which has

#include <pyconfig.h>
#ifdef WORDS_BIGENDIAN
#define BYTEORDER 4321
#else
#define BYTEORDER 1234
#endif
#define XML_NS 1
#define XML_DTD 1
#define XML_CONTEXT_BYTES 1024

and then just define HAVE_EXPAT_CONFIG_H in setup.py


----------------------------------------------------------------------

Comment By: Ronald Oussoren (ronaldoussoren)
Date: 2006-04-25 08:20

Message:
Logged In: YES 
user_id=580910

Martin,

Do you have time to look at this patch again? I'd like to get this patch in before 
2.5a2.

----------------------------------------------------------------------

Comment By: Ronald Oussoren (ronaldoussoren)
Date: 2006-04-18 22:22

Message:
Logged In: YES 
user_id=580910

I don't know how I managed to do that, but my initial patch misses an 
essential bit in pyconfig.h.in:

#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN 1
#else
#ifndef __LITTLE_ENDIAN__
#undef WORDS_BIGENDIAN
#endif
#endif

On non-universal builds or builds for other platforms this is equivalent to the 
current version, on the universal build this ensures that pyconfig.h only sets 
WORDS_BIGENDIAN during the creation of PPC binaries.

python-universal-2.patch avoids the empty if-statement in configure.in and 
includes the pyconfig.h.in change I mentioned above. It also adds a test to 
test_capi that checks if sys.byteorder is consistent with WORDS_BIGENDIAN 
(the former isn't derived from the latter).

I haven't changed -current-version because I haven't had time to fully check 
if that would be safe. 

I did verify that --enable-framework and --enable-universalsdk are fully 
indepedent. 

----------------------------------------------------------------------

Comment By: Ronald Oussoren (ronaldoussoren)
Date: 2006-04-18 21:05

Message:
Logged In: YES 
user_id=580910

osxconfig.h is there because this patch compiles all sources with 'cc -arch 
i386 -arch ppc' as the compiler. This means we can't use sys.byteorder to 
determine the right value for BYTORDER because that will be wrong for one of 
the architectures. 

The value of BYTORDER is used during the compilation of the expat sources, 
which don't include Python.h and that's probably because it is 3th-party 
software.

There is no dependency between --enable-framework and --with-universal-
sdk. I've tested this patch both with and without --enable-framework.  
Writing this I notice that I haven't checked if --enable-framework without --
with-universal-sdk still works. I'll check that and remove the empty 
statement.

-current-version doesn't include the micro release because the current build 
also doesn't do that.  It seems to be safe to change this, but I'd have to test to 
be sure.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2006-04-17 23:52

Message:
Logged In: YES 
user_id=21627

I don't understand the rationale for
Modules/expat/osxconfig.h. I thought there was some magic to
make Python.h's WORDS_BIGENDIAN always correct. If so,
BYTEORDER wouldn't be needed at all anymore.

In Makefile.pre.in, the -install-name option seems to imply
-enable-framework. If this is indeed a hard dependency,
configuring with universal-sdk, yet without framework should
make configure abort. If it's not a hard dependency, the
linker command line should be corrected for the case of
--disable-framework.

Minor issues:
- avoid empty statements; reverse the if test
"${enable_universalsdk}"; test
- shouldn't the -current-version include the micro release?


----------------------------------------------------------------------

Comment By: Ronald Oussoren (ronaldoussoren)
Date: 2006-04-17 20:24

Message:
Logged In: YES 
user_id=580910

My patch refers to osxconfig.h, but that file isn't in the patch :-(. I've uploaded it 
seperately, it should be saved as Modules/expat/osconfig.h.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1471883&group_id=5470


More information about the Patches mailing list