Skip to content
Permalink
Browse files

Applied Grzegorz Mac OS X patch. Should compile Canorus and included …

…Qt along the package.
  • Loading branch information...
matevz committed Mar 14, 2009
1 parent 8dcbb1f commit faa5f98e2fa6d25c4464098709c26d9b94d6bf8f
Showing with 6 additions and 80 deletions.
  1. +6 −17 macosx/Makefile
  2. +0 −63 macosx/change-libraries.sh
@@ -25,13 +25,6 @@ README_FILE = README-OSX.txt
# Path to the PackageMaker executable
PACKAGEMAKER = /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker

# This file lists the libraries that the canorus executable links to;
# we need to look for these names in the executable and change them
# to point to the the .app's private copies.
INSTALLED_LIBS_FILE = OSX_installed_libs.txt



all: files permissions pkg dmg

# append Canorus version with SVN revision to README-OSX, e.g. "Version 0.3svn R509"
@@ -46,16 +39,13 @@ readme:
cat $(RESOURCES_DIR)/$(README_FILE) >> $(DMG_DIR)/$(README_FILE)


# Test for prerequisites:
# change-libraries.sh uses the INSTALLED_LIBS_FILE to determine the libraries to change
test:
test -f $(INSTALLED_LIBS_FILE)


# Change the link info for the libraries installed inside the .app
# not working presently 2007-06-09
# Include dynamically linked Qt Frameworks inside the app bundle for
# redistribution. This is done using the macdeployqt program provided
# since 4.5.0. However, version 4.5.0 incorrectly binds svg libraries.
# You either have to use 4.5.1 or apply the svg correction included in
# http://www.mail-archive.com/qt4-preview-feedback@trolltech.com/msg00849.html
links:
./change-libraries.sh $(APP_DIR)/Canorus.app/Contents `cat $(INSTALLED_LIBS_FILE)`
(cd package-contents && macdeployqt Canorus.app)


# Copy files from the resources dir to the right place
@@ -95,7 +85,6 @@ pkgclean:
# see also "make uninstall" by cmake
instclean:
sudo rm -rf $(PACKAGE_ROOT)/*
rm -f $(INSTALLED_LIBS_FILE)


allclean: instclean pkgclean
@@ -1,63 +0,0 @@
#!/bin/sh
#
# change-libraries.sh
#
# USAGE
# change-libraries.sh /path/to/Canorus.app/Contents LIST_OF_INSTALLED_LIBS
#
# DESCRIPTION
#
# This script changes the link informaton in the libraries and the executable
# in an .app bundle. It looks inside the binaries for the given paths and changes
# those paths to refer to the libraries installed in the .app
#
# The LIST_OF_INSTALLED_LIBS should be automatically generated by the cmake build script
# and used like this: change-libraries.sh /path/to/Canorus.app/Contents/ `cat OSX_installed_libs.txt`


# Path to the 'Contents' dir inside the .app e.g "/Applications/Canorus.app/Contents"
appContents="$1"

shift

# Paths stored in the libraries that need to be replaced
oldPaths="$*"

# echo
# echo changing libnames...
# echo
# echo appcontents $appContents
# echo oldpaths $oldPaths
# echo
# echo

# Path inside the .app bundle where the libraries are installed
libDir="Resources/lib"

# Will prepend this path to the name inside the library
newLibPrefix="@executable_path/../$libDir"

# Name of the executable
exeName="canorus"

# Path to the executable
exe="$appContents/MacOS/$exeName"

for oldLibPath in $oldPaths
do
libName=`basename $oldLibPath` # The actual name of the binary
oldLibSymbol=`otool -D $oldLibPath | tail -1` # The symbol already in the binary
newLibSymbol="$newLibPrefix/$libName" # The symbol to insert into the binary

# Change names in the executable to link to the library in the .app bundle
install_name_tool -change $oldLibSymbol $newLibSymbol $exe

# Change this name in the other libraries in the bundle
for otherLib in `ls $appContents/$libDir`
do
install_name_tool -change $oldLibSymbol $newLibSymbol $appContents/$libDir/$otherLib
done

# Change the ID name of the library so it knows where it is
install_name_tool -id $newLibSymbol $appContents/$libDir/$libName
done

0 comments on commit faa5f98

Please sign in to comment.
You can’t perform that action at this time.