diff options
Diffstat (limited to 'data/pyobjc')
-rw-r--r-- | data/pyobjc/make.sh | 13 | ||||
-rw-r--r-- | data/pyobjc/mprotect.diff | 177 | ||||
-rw-r--r-- | data/pyobjc/pyobjc-1946.tgz | bin | 12318760 -> 0 bytes |
3 files changed, 6 insertions, 184 deletions
diff --git a/data/pyobjc/make.sh b/data/pyobjc/make.sh index 9ccc2f182..e5c86705c 100644 --- a/data/pyobjc/make.sh +++ b/data/pyobjc/make.sh @@ -3,16 +3,15 @@ shopt -s extglob pkg:setup cd pyobjc-core -$("${PKG_TARG}-gcc" -print-prog-name=cc1obj) -print-objc-runtime-info <(echo) >Modules/objc/objc-runtime-info.h - find Modules/objc/!(test) -name '*.m' -print0 | while read -d $'\0' -r m; do o=${m%.m}.o mi=${m%.m}.mi - ${PKG_TARG}-gcc -O2 -I"$(PKG_DEST_ libxml2)"/usr/include/libxml2 -I"$(PKG_DEST_ python)"/usr/include/python2.5 -ObjC -c -o "$o" "$m" -IModules/objc -fno-common || exit 1 + echo ${PKG_TARG}-gcc -framework Foundation -O2 -I"$(PKG_DEST_ libxml2)"/usr/include/libxml2 -I"$(PKG_DEST_ python)"/usr/include/python2.7 -ObjC -c -o "$o" "$m" -IModules/objc -fno-common || exit 1 + ${PKG_TARG}-gcc -framework Foundation -O2 -I"$(PKG_DEST_ libxml2)"/usr/include/libxml2 -I"$(PKG_DEST_ python)"/usr/include/python2.7 -ObjC -c -o "$o" "$m" -IModules/objc -fno-common || exit 1 done || exit 1 -${PKG_TARG}-gcc -O2 -dynamiclib -lpython2.5 -o _objc.dylib Modules/objc/*.o -lobjc -lffi -lxml2 -framework CoreFoundation -framework Foundation +${PKG_TARG}-gcc -O2 -dynamiclib -lpython2.7 -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 +pkg: mkdir -p /usr/lib/python2.7/lib-dynload +pkg: cp -a _objc.dylib /usr/lib/python2.7/lib-dynload +pkg: cp -a Lib/objc /usr/lib/python2.7 diff --git a/data/pyobjc/mprotect.diff b/data/pyobjc/mprotect.diff deleted file mode 100644 index a5d78785d..000000000 --- a/data/pyobjc/mprotect.diff +++ /dev/null @@ -1,177 +0,0 @@ -diff -ru pyobjc-1946/pyobjc-core/Modules/objc/closure_pool.m pyobjc-1946+iPhone/pyobjc-core/Modules/objc/closure_pool.m ---- pyobjc-1946/pyobjc-core/Modules/objc/closure_pool.m 2007-11-25 10:33:57.000000000 +0000 -+++ pyobjc-1946+iPhone/pyobjc-core/Modules/objc/closure_pool.m 2008-07-24 00:32:15.000000000 +0000 -@@ -1,62 +1,22 @@ --/* -- * A simple allocator for closure. This assumes that most closures are kept -- * alive forever and we therefore don't have to return storage to the OS. -- */ - #include "pyobjc.h" -- - #include <sys/mman.h> -+#include <mach/vm_param.h> - --typedef struct freelist { -- struct freelist* next; --} freelist; -- --static freelist* closure_freelist = NULL; -- -- --static freelist* allocate_block(void) --{ -- -- /* Allocate ffi_closure in groups of 10 VM pages */ --#define BLOCKSIZE ((PAGE_SIZE*10)/sizeof(ffi_closure*)) -- -- freelist* newblock = mmap(NULL, BLOCKSIZE * sizeof(ffi_closure), -- PROT_READ|PROT_WRITE|PROT_EXEC, -- MAP_PRIVATE|MAP_ANON, -1, 0); -- size_t i; -- -- if (newblock == (void*)-1) { -- PyErr_NoMemory(); -- return NULL; -- } -- for (i = 0; i < BLOCKSIZE-1; i++) { -- ((freelist*)(((ffi_closure*)newblock)+i))->next = -- (freelist*)(((ffi_closure*)newblock)+(i+1)); -- } -- -- ((freelist*)(((ffi_closure*)newblock)+(BLOCKSIZE-1)))->next = NULL; -- return newblock; --} -- -- -+ffi_closure *PyObjC_malloc_closure(void) { -+ ffi_closure *closure = (ffi_closure *) mmap( -+ NULL, sizeof(ffi_closure), -+ PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -+ -1, 0 -+ ); -+ -+ if (closure == MAP_FAILED) { -+ PyErr_NoMemory(); -+ return NULL; -+ } - --ffi_closure* --PyObjC_malloc_closure(void) --{ -- if (closure_freelist == NULL) { -- closure_freelist = allocate_block(); -- if (closure_freelist == NULL) { -- return NULL; -- } -- } -- ffi_closure* result = (ffi_closure*)closure_freelist; -- closure_freelist = closure_freelist->next; -- return result; -+ return closure; - } - --int --PyObjC_free_closure(ffi_closure* cl) --{ -- ((freelist*)cl)->next = closure_freelist; -- closure_freelist = (freelist*)cl; -- return 0; -+int PyObjC_free_closure(ffi_closure *closure) { -+ return munmap(closure, sizeof(ffi_closure)); - } -diff -ru pyobjc-1946/pyobjc-core/Modules/objc/libffi_support.m pyobjc-1946+iPhone/pyobjc-core/Modules/objc/libffi_support.m ---- pyobjc-1946/pyobjc-core/Modules/objc/libffi_support.m 2008-07-24 00:37:30.000000000 +0000 -+++ pyobjc-1946+iPhone/pyobjc-core/Modules/objc/libffi_support.m 2008-07-24 00:37:09.000000000 +0000 -@@ -17,6 +17,7 @@ - - #import <Foundation/NSHost.h> - #import <CoreFoundation/CoreFoundation.h> -+#include <sys/mman.h> - - #ifdef __ppc64__ - extern bool ffi64_stret_needs_ptr(const ffi_type* inType, -@@ -3724,11 +3725,20 @@ - rv = ffi_prep_closure(cl, cif, func, userdata); - if (rv != FFI_OK) { - PyObjCFFI_FreeCIF(cif); -+ PyObjC_free_closure(cl); - PyErr_Format(PyExc_RuntimeError, - "Cannot create FFI closure: %d", rv); - return NULL; - } - -+ if (mprotect(cl, sizeof(*cl), PROT_READ | PROT_EXEC) == -1) { -+ PyObjCFFI_FreeCIF(cif); -+ PyObjC_free_closure(cl); -+ PyErr_Format(PyExc_RuntimeError, -+ "Cannot create FFI closure: %d", errno); -+ return NULL; -+ } -+ - return (IMP)cl; - } - -diff -ru pyobjc-1946/pyobjc-core/Modules/objc/opaque-pointer.m pyobjc-1946+iPhone/pyobjc-core/Modules/objc/opaque-pointer.m ---- pyobjc-1946/pyobjc-core/Modules/objc/opaque-pointer.m 2007-11-23 13:29:54.000000000 +0000 -+++ pyobjc-1946+iPhone/pyobjc-core/Modules/objc/opaque-pointer.m 2008-07-24 00:35:43.000000000 +0000 -@@ -2,6 +2,7 @@ - * Generic support for opaque pointer types, such as NSZone* - */ - #include "pyobjc.h" -+#include <sys/mman.h> - - typedef struct { - PyObject_HEAD -@@ -247,6 +248,13 @@ - "Cannot create FFI closure: %d", rv); - goto error_cleanup; - } -+ -+ if (mprotect(cl, sizeof(*cl), PROT_READ | PROT_EXEC) == -1) { -+ PyErr_Format(PyExc_RuntimeError, -+ "Cannot create FFI closure: %d", errno); -+ goto error_cleanup; -+ } -+ - to_c = (PyObjCPointerWrapper_FromPythonFunc)cl; - cl = NULL; - -@@ -261,6 +271,13 @@ - "Cannot create FFI closure: %d", rv); - goto error_cleanup; - } -+ -+ if (mprotect(cl, sizeof(*cl), PROT_READ | PROT_EXEC) == -1) { -+ PyErr_Format(PyExc_RuntimeError, -+ "Cannot create FFI closure: %d", errno); -+ goto error_cleanup; -+ } -+ - from_c = (PyObjCPointerWrapper_ToPythonFunc)cl; - cl = NULL; - -diff -ru pyobjc-1946/pyobjc-core/Modules/objc/struct-wrapper.m pyobjc-1946+iPhone/pyobjc-core/Modules/objc/struct-wrapper.m ---- pyobjc-1946/pyobjc-core/Modules/objc/struct-wrapper.m 2007-11-23 13:29:54.000000000 +0000 -+++ pyobjc-1946+iPhone/pyobjc-core/Modules/objc/struct-wrapper.m 2008-07-24 00:35:46.000000000 +0000 -@@ -12,6 +12,7 @@ - * is only usefull for PyObjC. - */ - #include "pyobjc.h" -+#include <sys/mman.h> - - /* - * First some helpers: easy access to the actual fields -@@ -603,6 +604,13 @@ - return NULL; - } - -+ if (mprotect(cl, sizeof(*cl), PROT_READ | PROT_EXEC) == -1) { -+ PyObjC_free_closure(cl); -+ PyErr_Format(PyExc_RuntimeError, -+ "Cannot create FFI closure: %d", errno); -+ return NULL; -+ } -+ - return (initproc)cl; - } - diff --git a/data/pyobjc/pyobjc-1946.tgz b/data/pyobjc/pyobjc-1946.tgz Binary files differdeleted file mode 100644 index 428bd92fd..000000000 --- a/data/pyobjc/pyobjc-1946.tgz +++ /dev/null |