aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-06-11 07:50:25 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2010-06-11 07:50:25 +0000
commit9c7b3f021b4b58dcb283a0fe7fe896d6d3821176 (patch)
treec985c48473efa3512caddf293131ad1f10edec45
parentc6977960a37aac90a4ed10164c47d7f5adc5f334 (diff)
downloadusdx-9c7b3f021b4b58dcb283a0fe7fe896d6d3821176.tar.gz
usdx-9c7b3f021b4b58dcb283a0fe7fe896d6d3821176.tar.xz
usdx-9c7b3f021b4b58dcb283a0fe7fe896d6d3821176.zip
Mac OS X: fix installation and loading of libpcre.dylib in standalone and fink based app.
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2483 b956fd51-792f-4845-bead-9b4dfca2ff2c
-rw-r--r--Makefile.in11
-rw-r--r--src/lib/pcre/pcre.pas15
2 files changed, 19 insertions, 7 deletions
diff --git a/Makefile.in b/Makefile.in
index 1f36c8e7..237565f5 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -358,6 +358,8 @@ OTOOL := /usr/bin/otool
INSTALL_NAME_TOOL := /usr/bin/install_name_tool
# hdiutil: Mac OS X disk image tool
HDIUTIL := /usr/bin/hdiutil
+# finkLibDir := path for libraries installed using fink
+finkLibDir := /sw/lib
#################################################
# Mac OS X app-bundle
@@ -425,16 +427,19 @@ endef
# work on the secondary dylibs from ffmpeg
# libavcodec references all tertiary libraries of the ffmpeg libs
- $(foreach dylib,$(shell $(OTOOL) -L /sw/lib/libavcodec.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries))
+ $(foreach dylib,$(shell $(OTOOL) -L $(finkLibDir)/libavcodec.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries))
# same procedure in libfaac. it gets libgnugetopt
- $(foreach dylib,$(shell $(OTOOL) -L /sw/lib/libfaac.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries))
+ $(foreach dylib,$(shell $(OTOOL) -L $(finkLibDir)/libfaac.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries))
# same procedure for tertiary libs in SDL_image
- $(foreach dylib,$(shell $(OTOOL) -L /sw/lib/libSDL_image.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries))
+ $(foreach dylib,$(shell $(OTOOL) -L $(finkLibDir)/libSDL_image.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries))
# X11 libs as well, because users may not have installed it on 10.4
$(foreach dylib,$(shell $(OTOOL) -L /usr/X11R6/lib/libX11.dylib | grep version | cut -f 1 -d ' ' | grep -v \/System\/Library | grep -v \/usr\/lib),$(install_osx_libraries))
+# libpcre.dylib must be installed extra, since it is not linked to the executable but opened using dlopen
+ $(shell $(INSTALL) -m 755 $(finkLibDir)/libpcre.dylib $(macosx_bundle_path)/MacOS)
+
# final messages
@echo "Standalone Mac OS X application created."
@echo ""
diff --git a/src/lib/pcre/pcre.pas b/src/lib/pcre/pcre.pas
index 075fd417..ab04a9d0 100644
--- a/src/lib/pcre/pcre.pas
+++ b/src/lib/pcre/pcre.pas
@@ -539,8 +539,11 @@ const
libpcremodulename = 'libpcre.so.0';
{$ENDIF LINUX}
{$IFDEF DARWIN}
- libpcremodulename = 'libpcre.dylib';
- libpcremodulenamefromfink = LIBPCRE_LIBDIR + '/libpcre.dylib';
+ libpcremodulename = 'libpcre.dylib'; // this is a symlink for example to libpcre.0.0.1.dylib
+ // the system resolves the symlink
+ libpcremodulenamefromfink = LIBPCRE_LIBDIR + '/' + libpcremodulename;
+ // the install command in the Makefile resolves the symlink, when installing libpcre.dylib in the app bundle
+ libpcremodulenamefromexecutable = '@executable_path/' + libpcremodulename;
{$ENDIF DARWIN}
PCRECompileExportName = 'pcre_compile';
PCRECompile2ExportName = 'pcre_compile2';
@@ -784,10 +787,14 @@ begin
{$IFDEF UNIX}
PCRELib := dlopen(PAnsiChar(libpcremodulename), RTLD_NOW);
{$ENDIF UNIX}
- {$IFDEF DARWIN} // if not found, do another try from the fink path
+
+ {$IFDEF DARWIN} // if libpcre.dylib is not found, first try from the executable path and finally from the fink path
+ if PCRELib = INVALID_MODULEHANDLE_VALUE then
+ PCRELib := dlopen(PAnsiChar(libpcremodulenamefromexecutable), RTLD_NOW);
if PCRELib = INVALID_MODULEHANDLE_VALUE then
PCRELib := dlopen(PAnsiChar(libpcremodulenamefromfink), RTLD_NOW);
- {$ENDIF DARWIN}
+ {$ENDIF DARWIN}
+
Result := PCRELib <> INVALID_MODULEHANDLE_VALUE;
if Result then
begin