diff options
author | Jay Freeman <saurik@saurik.com> | 2008-02-14 11:04:20 +0000 |
---|---|---|
committer | Jay Freeman <saurik@saurik.com> | 2008-02-14 11:04:20 +0000 |
commit | 62882fc0471895bc1a47c13e22daf35dcaafecd0 (patch) | |
tree | c5fb76fc3f64e729fdabeb9c35774e722000fd4e /data/pyobjc | |
parent | 8e60af7ad00762fb8a89ae39c771287f3c5efed4 (diff) |
Got PyObjC working.
git-svn-id: http://svn.telesphoreo.org/trunk@74 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'data/pyobjc')
-rw-r--r-- | data/pyobjc/_metadata/description | 1 | ||||
-rw-r--r-- | data/pyobjc/_metadata/license | 9 | ||||
l--------- | data/pyobjc/_metadata/maintainer | 1 | ||||
-rw-r--r-- | data/pyobjc/_metadata/name | 1 | ||||
-rw-r--r-- | data/pyobjc/_metadata/priority | 1 | ||||
-rw-r--r-- | data/pyobjc/_metadata/section | 1 | ||||
-rw-r--r-- | data/pyobjc/_metadata/version | 1 | ||||
-rw-r--r-- | data/pyobjc/make.sh | 18 | ||||
-rw-r--r-- | data/pyobjc/port.diff | 234 | ||||
-rw-r--r-- | data/pyobjc/pyobjc-1946.tgz | bin | 0 -> 12318760 bytes |
10 files changed, 267 insertions, 0 deletions
diff --git a/data/pyobjc/_metadata/description b/data/pyobjc/_metadata/description new file mode 100644 index 000000000..59b35c863 --- /dev/null +++ b/data/pyobjc/_metadata/description @@ -0,0 +1 @@ +Python/Objective-C connection library diff --git a/data/pyobjc/_metadata/license b/data/pyobjc/_metadata/license new file mode 100644 index 000000000..b550eba6c --- /dev/null +++ b/data/pyobjc/_metadata/license @@ -0,0 +1,9 @@ +(This is the MIT license) + +Copyright 2002, 2003 - Bill Bumgarner, Ronald Oussoren, Steve Majewski, Lele Gaifax, et.al. + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/data/pyobjc/_metadata/maintainer b/data/pyobjc/_metadata/maintainer new file mode 120000 index 000000000..0fa66e077 --- /dev/null +++ b/data/pyobjc/_metadata/maintainer @@ -0,0 +1 @@ +../../../people/saurik
\ No newline at end of file diff --git a/data/pyobjc/_metadata/name b/data/pyobjc/_metadata/name new file mode 100644 index 000000000..64145f73a --- /dev/null +++ b/data/pyobjc/_metadata/name @@ -0,0 +1 @@ +PyObjC diff --git a/data/pyobjc/_metadata/priority b/data/pyobjc/_metadata/priority new file mode 100644 index 000000000..134d9bc32 --- /dev/null +++ b/data/pyobjc/_metadata/priority @@ -0,0 +1 @@ +optional diff --git a/data/pyobjc/_metadata/section b/data/pyobjc/_metadata/section new file mode 100644 index 000000000..46c5d2cde --- /dev/null +++ b/data/pyobjc/_metadata/section @@ -0,0 +1 @@ +Python diff --git a/data/pyobjc/_metadata/version b/data/pyobjc/_metadata/version new file mode 100644 index 000000000..8114c7796 --- /dev/null +++ b/data/pyobjc/_metadata/version @@ -0,0 +1 @@ +1946 diff --git a/data/pyobjc/make.sh b/data/pyobjc/make.sh new file mode 100644 index 000000000..8342d7232 --- /dev/null +++ b/data/pyobjc/make.sh @@ -0,0 +1,18 @@ +pkg:extract +cd * +pkg:patch +cd pyobjc-core + +$(arm-apple-darwin-gcc -print-prog-name=cc1obj) -print-objc-runtime-info <(echo) >Modules/objc/objc-runtime-info.h + +find Modules/objc -name '*.m' -print0 | while read -d $'\0' -r m; do + o=${m%.m}.o + mi=${m%.m}.mi + arm-apple-darwin-gcc -O0 -g3 -I"${PKG_ROOT}"/usr/include/{libxml2,python2.5} -ObjC -c -o "$o" "$m" -DNO_OBJC2_RUNTIME -IModules/objc -fno-common +done + +arm-apple-darwin-gcc -O0 -g3 -dynamiclib -lpython2.5 -o _objc.dylib Modules/objc/*.o -lobjc -lffi -lxml2 -framework CoreFoundation -framework Foundation + +pkg: mkdir -p /usr/lib/python2.5/lib-dynload +pkg: cp -a _objc.dylib /usr/lib/python2.5/lib-dynload +pkg: cp -a Lib/objc /usr/lib/python2.5 diff --git a/data/pyobjc/port.diff b/data/pyobjc/port.diff new file mode 100644 index 000000000..53880d5fe --- /dev/null +++ b/data/pyobjc/port.diff @@ -0,0 +1,234 @@ +Index: pyobjc/pyobjc-core/Modules/objc/closure_pool.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/closure_pool.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/closure_pool.m (working copy) +@@ -5,6 +5,7 @@ + #include "pyobjc.h" + + #include <sys/mman.h> ++#include <mach/vm_param.h> + + typedef struct freelist { + struct freelist* next; +Index: pyobjc/pyobjc-core/Modules/objc/libffi_support.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/libffi_support.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/libffi_support.m (working copy) +@@ -13,6 +13,7 @@ + * FIXME: There's way to much duplicated code in here, please refactor me. + */ + #include "pyobjc.h" ++#include "objc-runtime-info.h" + + #import <Foundation/NSHost.h> + #import <CoreFoundation/CoreFoundation.h> +@@ -22,37 +23,9 @@ + unsigned short*, unsigned short*); + #endif; + +-/* +- * Define SMALL_STRUCT_LIMIT as the largest struct that will be returned +- * in registers instead of with a hidden pointer argument. +- */ +- + static const char gCharEncoding[] = { _C_CHR, 0 }; + static const char gCFRangeEncoding[1024] = { 0 }; + +-#if defined(__ppc__) +- +-# define SMALL_STRUCT_LIMIT 4 +- +-#elif defined(__ppc64__) +- +-# define SMALL_STRUCT_LIMIT 8 +- +-#elif defined(__i386__) +- +-# define SMALL_STRUCT_LIMIT 8 +- +-#elif defined(__x86_64__) +- +-# define SMALL_STRUCT_LIMIT 16 +- +-#else +- +-# error "Unsupported MACOSX platform" +- +-#endif +- +- + #ifndef FFI_CLOSURES + # error "Need FFI_CLOSURES!" + #endif +@@ -3527,24 +3500,8 @@ + ffi64_stret_needs_ptr(signature_to_ffi_return_type(rettype), NULL, NULL) + + #else /* !__ppc64__ */ +- (resultSize > SMALL_STRUCT_LIMIT +-#ifdef __i386__ +- /* darwin/x86 ABI is slightly odd ;-) */ +- || (resultSize != 1 +- && resultSize != 2 +- && resultSize != 4 +- && resultSize != 8) +-#endif +-#ifdef __x86_64__ +- /* darwin/x86-64 ABI is slightly odd ;-) */ +- || (resultSize != 1 +- && resultSize != 2 +- && resultSize != 4 +- && resultSize != 8 +- && resultSize != 16 +- ) +-#endif +- ) ++ (resultSize > OBJC_MAX_STRUCT_BY_VALUE || ++ struct_forward_array[resultSize] != 0) + #endif /* !__ppc64__ */ + ) { + +Index: pyobjc/pyobjc-core/Modules/objc/class-builder.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/class-builder.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/class-builder.m (working copy) +@@ -1860,7 +1860,7 @@ + /* Parent doesn't know the key, try to create in the + * python side, just like for plain python objects. + */ +- if (([[localException name] isEqual:@"NSUnknownKeyException"] ++ if (([[localException name] isEqual:@"NSUndefinedKeyException"] + ) && [[self class] accessInstanceVariablesDirectly]) { + + PyGILState_STATE state = PyGILState_Ensure(); +@@ -1972,7 +1972,7 @@ + /* Parent doesn't know the key, try to create in the + * python side, just like for plain python objects. + */ +- if (([[localException name] isEqual:@"NSUnknownKeyException"] ++ if (([[localException name] isEqual:@"NSUndefinedKeyException"] + ) && [[self class] accessInstanceVariablesDirectly]) { + + PyGILState_STATE state = PyGILState_Ensure(); +Index: pyobjc/pyobjc-core/Modules/objc/objc-runtime-compat.h +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/objc-runtime-compat.h (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/objc-runtime-compat.h (working copy) +@@ -44,7 +44,7 @@ + #define objc_superSetReceiver(super, val) (super).receiver = (val) + #define objc_superGetReceiver(super) ((super).receiver) + +-#ifdef __OBJC2__ ++#ifdef __cplusplus + + #define objc_superSetClass(super, cls) (super).super_class = (cls) + #define objc_superGetClass(super) ((super).super_class) +Index: pyobjc/pyobjc-core/Modules/objc/toll-free-bridging.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/toll-free-bridging.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/toll-free-bridging.m (working copy) +@@ -10,7 +10,7 @@ + + #import <Foundation/NSURL.h> + +-#ifndef __OBJC2__ ++#if 0 + #include "pymactoolbox.h" + #endif + +@@ -26,7 +26,7 @@ + + } + +-#ifndef __OBJC2__ ++#if 0 + int r; + + /* Fall back to MacPython CFType support: */ +@@ -47,7 +47,7 @@ + PyObject* + PyObjC_IDToCFType(id argument) + { +-#ifndef __OBJC2__ ++#if 0 + CFTypeRef typeRef = (CFTypeRef)argument; + CFTypeID typeID = CFGetTypeID(argument); + +Index: pyobjc/pyobjc-core/Modules/objc/objc-runtime-compat.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/objc-runtime-compat.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/objc-runtime-compat.m (working copy) +@@ -821,7 +821,7 @@ + */ + PyObjC_class_addMethodList = compat_class_addMethodList; + PyObjC_methodlist_magic = compat_methodlist_magic; +- PyObjC_objc_disposeClassPair = compat_objc_freeClassPair; ++ PyObjC_objc_disposeClassPair = compat_objc_disposeClassPair; + PyObjC_preclass_addMethod = compat_preclass_addMethod; + PyObjC_preclass_addIvar = compat_preclass_addIvar; + PyObjC_preclass_addProtocol = compat_preclass_addProtocol; +Index: pyobjc/pyobjc-core/Modules/objc/test/structargs.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/test/structargs.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/test/structargs.m (working copy) +@@ -3,7 +3,7 @@ + #include "Python.h" + #include "pyobjc-api.h" + +-#import <Cocoa/Cocoa.h> ++#import <Foundation/Foundation.h> + + @interface StructArgClass : NSObject + { +Index: pyobjc/pyobjc-core/Modules/objc/OC_PythonObject.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/OC_PythonObject.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/OC_PythonObject.m (working copy) +@@ -35,7 +35,7 @@ + #import "OC_PythonUnicode.h" + #import "OC_PythonString.h" + +-extern NSString * const NSUnknownKeyException; /* Radar #3336042 */ ++extern NSString * const NSUndefinedKeyException; /* Radar #3336042 */ + + PyObject *OC_PythonObject_DepythonifyTable = NULL; + PyObject *OC_PythonObject_PythonifyStructTable = NULL; +@@ -938,7 +938,7 @@ + - (void)unableToSetNilForKey: (NSString*) key; + { + [NSException +- raise: NSUnknownKeyException ++ raise: NSUndefinedKeyException + format: @"cannot set Nil for key: %@", key]; + } + +@@ -950,7 +950,7 @@ + - (void)valueForUndefinedKey: (NSString*)key; + { + [NSException +- raise: NSUnknownKeyException ++ raise: NSUndefinedKeyException + format: @"query for unknown key: %@", key]; + } + +@@ -962,7 +962,7 @@ + - (void)setValue: value forUndefinedKey: (NSString*) key; + { + [NSException +- raise: NSUnknownKeyException ++ raise: NSUndefinedKeyException + format: @"setting unknown key: %@ to <%@>", key, value]; + } + +Index: pyobjc/pyobjc-core/Modules/objc/objc_util.m +=================================================================== +--- pyobjc/pyobjc-core/Modules/objc/objc_util.m (revision 1946) ++++ pyobjc/pyobjc-core/Modules/objc/objc_util.m (working copy) +@@ -45,7 +45,7 @@ + return PyExc_ValueError; + } else if (strcmp(value, "NSMallocException") == 0) { + return PyExc_MemoryError; +- } else if (strcmp(value, "NSUnknownKeyException") == 0) { ++ } else if (strcmp(value, "NSUndefinedKeyException") == 0) { + return PyExc_KeyError; + } + diff --git a/data/pyobjc/pyobjc-1946.tgz b/data/pyobjc/pyobjc-1946.tgz Binary files differnew file mode 100644 index 000000000..428bd92fd --- /dev/null +++ b/data/pyobjc/pyobjc-1946.tgz |