This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: --enable-universalsdk on Mac OS X
Type: Stage:
Components: Build Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: ronaldoussoren Nosy List: loewis, ronaldoussoren
Priority: normal Keywords: patch

Created on 2006-04-17 18:19 by ronaldoussoren, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python-universal.patch ronaldoussoren, 2006-04-17 18:19
osxconfig.h ronaldoussoren, 2006-04-17 18:24 File: Modules/expat/osxconfig.h
python-universal-2.patch ronaldoussoren, 2006-04-18 20:22
python-universal-3.patch ronaldoussoren, 2006-04-25 11:26
Messages (12)
msg50036 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2006-04-17 18:19
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.

msg50037 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2006-04-17 18:24
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.
msg50038 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-17 21:52
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?
msg50039 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2006-04-18 19:05
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.
msg50040 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2006-04-18 20:22
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. 
msg50041 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2006-04-25 06:20
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.
msg50042 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-25 06:38
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
msg50043 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2006-04-25 11:26
Logged In: YES 
user_id=580910

It may well be that SF just dropped your message. I'm pretty sure I had already 
uploaded a new version of the patch.

Version 3 incorporates your suggestions: AH_VERBATIM to do the edit in 
pyconfig.h.in and introduce a expat_config.h that contains expat configuration. 
That file is used on all platforms.
msg50044 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2006-04-28 13:25
Logged In: YES 
user_id=580910

It's me again. Could you have a look at the patch again? 
msg50045 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-28 15:14
Logged In: YES 
user_id=21627

The patch is fine; please apply. Don't forget to update
Misc/NEWS.
msg50046 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2006-04-29 11:32
Logged In: YES 
user_id=580910

Applied in revision 45800
msg50047 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2006-04-29 12:37
Logged In: YES 
user_id=21627

I just added expat_config.h and edited Misc/NEWS in 45808.
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43229
2006-04-17 18:19:41ronaldoussorencreate