Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--release/Makefile2
-rw-r--r--release/plugins/bmake4
-rw-r--r--source/blender/blenlib/intern/dynlib.c38
3 files changed, 38 insertions, 6 deletions
diff --git a/release/Makefile b/release/Makefile
index 96dd09a208c..265b51316e1 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -81,7 +81,7 @@ all:
NOPLUGINS="true" NOSTRIP="true"
endif
ifeq ($(OS),darwin)
- @$(MAKE) pkg TYPE="" TAR="tar cf" EXT0"=.app" EXT1=".tar" NOPLUGINS="true" \
+ @$(MAKE) pkg TYPE="" TAR="tar cf" EXT0"=.app" EXT1=".tar" \
COMPRESS="gzip -f --best" EXT2=".gz"
endif
diff --git a/release/plugins/bmake b/release/plugins/bmake
index 6d990ad7460..eeee92bc2f2 100644
--- a/release/plugins/bmake
+++ b/release/plugins/bmake
@@ -74,8 +74,8 @@ elif ( test $UNAME = "Darwin" ) then
CC="cc";
CFLAGS="-fPIC -funsigned-char -O2 -fno-common";
LD="cc";
- LDFLAGS=" -dynamiclib -lm";
- EXT="dylib";
+ LDFLAGS=" -bundle -bundle_loader ../../blender.app/Contents/MacOS/blender -lm";
+ EXT="so";
fi
if ( test "$#" = "1" ) then
diff --git a/source/blender/blenlib/intern/dynlib.c b/source/blender/blenlib/intern/dynlib.c
index 89c21a9af55..2dd25505adf 100644
--- a/source/blender/blenlib/intern/dynlib.c
+++ b/source/blender/blenlib/intern/dynlib.c
@@ -36,6 +36,10 @@
#include <config.h>
#endif
+#if !defined(CHAR_MAX)
+#define CHAR_MAX 255
+#endif
+
/*
* XXX, should use mallocN so we can see
* handle's not being released. fixme zr
@@ -100,13 +104,40 @@ void PIL_dynlib_close(PILdynlib *lib) {
#else
#ifdef __APPLE__
+#include <mach-o/dyld.h>
+
+struct PILdynlib {
+ NSModule *handle;
+};
PILdynlib *PIL_dynlib_open(char *name) {
- return NULL;
+ NSObjectFileImage img;
+
+ PILdynlib *lib= malloc(sizeof(*lib));
+ if (NSCreateObjectFileImageFromFile( name, &img) ==
+ NSObjectFileImageSuccess) {
+ lib->handle = NSLinkModule( img, name, NSLINKMODULE_OPTION_BINDNOW);
+ NSDestroyObjectFileImage(img);
+ return lib;
+ }
+ free(lib);
+ return NULL;
}
void *PIL_dynlib_find_symbol(PILdynlib* lib, char *symname) {
- return NULL;
+ char *name;
+ NSSymbol cr;
+ int size;
+
+ size = strlen(symname) + 2 * sizeof(char);
+ if (size < CHAR_MAX) {
+ name = MEM_mallocN(size, "temp string");
+ sprintf(&name, "_%s",symname);
+ cr = NSLookupSymbolInModule(lib->handle, name);
+ free(name);
+ return NSAddressOfSymbol(cr);
+ }
+ return NULL;
}
char *PIL_dynlib_get_error_as_string(PILdynlib* lib) {
@@ -114,7 +145,8 @@ char *PIL_dynlib_get_error_as_string(PILdynlib* lib) {
}
void PIL_dynlib_close(PILdynlib *lib) {
- ;
+ NSUnLinkModule(lib->handle,NSUNLINKMODULE_OPTION_NONE);
+ free(lib);
}
#else /* Unix */