From: mjwybrow Date: Tue, 8 Sep 2009 01:59:06 +0000 (+0000) Subject: - Fix bug #390024: "raster image extensions fail on osx: missing ImageMagick X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=26be7006ec608b83cad0b17aa569d6d420b2b6b9;p=inkscape.git - Fix bug #390024: "raster image extensions fail on osx: missing ImageMagick config files/resources" Include the ImageMagick resources in the bundle. Note that this only works when the user does not have a version installed in the same prefix as the one originally built for the bundle. This should be okay since the official package is built with a long obscure prefix. - Fix bug #392693: "Conflict between bundled and system libxml dylib" The official package no longer uses the DYLD_LIBRARY_PATH magic. Instead all paths within the dylibs, executable and shared objects get rewritten to be relative to the executable. Note: Packagers will need to install Macports into a PREFIX of 50 characters in length to allow enough space within all the libraries for path rewriting. --- diff --git a/packaging/macosx/Resources/bin/inkscape b/packaging/macosx/Resources/bin/inkscape index a085ca498..f36865117 100755 --- a/packaging/macosx/Resources/bin/inkscape +++ b/packaging/macosx/Resources/bin/inkscape @@ -29,7 +29,8 @@ PYTHON_VERS=`python -V 2>&1 | cut -c 8-10` export PYTHONPATH="$TOP/python/site-packages/$ARCH/$PYTHON_VERS" # NB: we are only preprending some stuff to the default python path so if the directory does not exist it should not harm the rest -export DYLD_LIBRARY_PATH="$TOP/lib" +# No longer required if path rewriting has been conducted. +# export DYLD_LIBRARY_PATH="$TOP/lib" export FONTCONFIG_PATH="$TOP/etc/fonts" @@ -43,6 +44,16 @@ export GNOME_VFS_MODULE_PATH="$TOP/lib/gnome-vfs-2.0/modules" export XDG_DATA_DIRS="$TOP/share" export ASPELL_CONF="prefix $TOP;" +# Note: This requires the path with the exact ImageMagic version number. +# FIXME: Make the osx-app.sh script write the version into this file when +# building the package. Note, that ImageMagick will only work if +# it does not find a version installed into the same PREFIX as it +# was originally installed. Luckily, this is very unlikely given +# the extra long and strangely named install prefix we use. +export MAGICK_CONFIGURE_PATH="$TOP/lib/ImageMagick-6.5.5/config:$TOP/share/ImageMagick-6.5.5/config" +export MAGICK_CODER_FILTER_PATH="$TOP/lib/ImageMagick-6.5.5/modules-Q16/filters" +export MAGICK_CODER_MODULE_PATH="$TOP/lib/ImageMagick-6.5.5/modules-Q16/coders" + export INKSCAPE_SHAREDIR="$TOP" # TODO: move the share directory to a its own folder to make things a bit cleaner in the app bundle export INKSCAPE_PLUGINDIR="$TOP/lib/inkscape" diff --git a/packaging/macosx/Resources/script b/packaging/macosx/Resources/script index c58361d86..f0fe88efe 100755 --- a/packaging/macosx/Resources/script +++ b/packaging/macosx/Resources/script @@ -37,15 +37,10 @@ if [[ $VERSION -le 4 ]]; then export DISPLAY=`cat /tmp/display.$UID` ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11 - - # Warn the user about time-consuming generation of fontconfig caches. - test -f "${HOME}/.inkscape/.fccache-new" || exit 12 -else - # Leopard onwards... - - # Warn the user about time-consuming generation of fontconfig caches. - test -d "${HOME}/.fontconfig" || exit 12 fi + +# Warn the user about time-consuming generation of fontconfig caches. +test -f "${HOME}/.inkscape/.fccache-new" || exit 12 diff --git a/packaging/macosx/osx-app.sh b/packaging/macosx/osx-app.sh index b8d608a80..251fc1289 100755 --- a/packaging/macosx/osx-app.sh +++ b/packaging/macosx/osx-app.sh @@ -163,6 +163,11 @@ if [ ! -e "$LIBPREFIX/lib/gnome-vfs-2.0" ]; then exit 1 fi +if ! pkg-config --modversion ImageMagick >/dev/null 2>&1; then + echo "Missing ImageMagick -- please install ImageMagick and try again." >&2 + exit 1 +fi + if [ ! -e "$LIBPREFIX/lib/aspell-0.60/en.dat" ]; then echo "Missing aspell en dictionary -- please install at least 'aspell-dict-en', but" >&2 echo "preferably all dictionaries ('aspell-dict-*') and try again." >&2 @@ -311,6 +316,10 @@ cp -r $LIBPREFIX/lib/gtk-2.0/$gtk_version/* $pkglib/gtk-2.0/$gtk_version/ mkdir -p $pkglib/gnome-vfs-2.0/modules cp $LIBPREFIX/lib/gnome-vfs-2.0/modules/*.so $pkglib/gnome-vfs-2.0/modules/ +imagemagick_version=`pkg-config --modversion ImageMagick` +cp -r "$LIBPREFIX/lib/ImageMagick-$imagemagick_version" "$pkglib/" +cp -r "$LIBPREFIX/share/ImageMagick-$imagemagick_version" "$pkgresources/share/" + # Copy aspell dictionary files: cp -r "$LIBPREFIX/lib/aspell-0.60" "$pkglib/" cp -r "$LIBPREFIX/share/aspell" "$pkgresources/share/" @@ -322,7 +331,7 @@ nfiles=0 endl=true while $endl; do echo -e "\033[1mLooking for dependencies.\033[0m Round" $a - libs="`otool -L $pkglib/gtk-2.0/$gtk_version/{engines,immodules,loaders,printbackends}/*.{dylib,so} $pkglib/pango/$pango_version/modules/* $pkglib/gnome-vfs-2.0/modules/* $package/Contents/Resources/lib/* $binary 2>/dev/null | fgrep compatibility | cut -d\( -f1 | grep $LIBPREFIX | sort | uniq`" + libs="`otool -L $pkglib/gtk-2.0/$gtk_version/{engines,immodules,loaders,printbackends}/*.{dylib,so} $pkglib/pango/$pango_version/modules/* $pkglib/gnome-vfs-2.0/modules/* $package/Contents/Resources/lib/* $pkglib/ImageMagick/modules-Q16/{filters,coders}/*.so $binary 2>/dev/null | fgrep compatibility | cut -d\( -f1 | grep $LIBPREFIX | sort | uniq`" cp -f $libs $package/Contents/Resources/lib let "a+=1" nnfiles=`ls $package/Contents/Resources/lib | wc -l` @@ -383,42 +392,85 @@ fixlib () { done fi } -# -# Fix package deps -# (cd "$package/Contents/Resources/lib/gtk-2.0/2.10.0/loaders" -# for file in *.so; do -# echo "Rewriting dylib paths for $file..." -# fixlib "$file" "`pwd`" -# done -# ) -# (cd "$package/Contents/Resources/lib/gtk-2.0/2.10.0/engines" -# for file in *.so; do -# echo "Rewriting dylib paths for $file..." -# fixlib "$file" "`pwd`" -# done -# ) -# (cd "$package/Contents/Resources/lib/gtk-2.0/2.10.0/immodules" -# for file in *.so; do -# echo "Rewriting dylib paths for $file..." -# fixlib "$file" "`pwd`" -# done -# ) -# (cd "$package/Contents/Resources/lib/gtk-2.0/2.10.0/printbackends" -# for file in *.so; do -# echo "Rewriting dylib paths for $file..." -# fixlib "$file" "`pwd`" -# done -# ) -# (cd "$package/Contents/Resources/bin" -# for file in *; do -# echo "Rewriting dylib paths for $file..." -# fixlib "$file" "`pwd`" -# done -# cd ../lib -# for file in *.dylib; do -# echo "Rewriting dylib paths for $file..." -# fixlib "$file" "`pwd`" -# done -# ) + +rewritelibpaths () { + # + # Fix package deps + (cd "$package/Contents/Resources/lib/gtk-2.0/2.10.0/loaders" + for file in *.so; do + echo "Rewriting dylib paths for $file..." + fixlib "$file" "`pwd`" + done + ) + (cd "$package/Contents/Resources/lib/gtk-2.0/2.10.0/engines" + for file in *.so; do + echo "Rewriting dylib paths for $file..." + fixlib "$file" "`pwd`" + done + ) + (cd "$package/Contents/Resources/lib/gtk-2.0/2.10.0/immodules" + for file in *.so; do + echo "Rewriting dylib paths for $file..." + fixlib "$file" "`pwd`" + done + ) + (cd "$package/Contents/Resources/lib/gtk-2.0/2.10.0/printbackends" + for file in *.so; do + echo "Rewriting dylib paths for $file..." + fixlib "$file" "`pwd`" + done + ) + (cd "$package/Contents/Resources/lib/gnome-vfs-2.0/modules" + for file in *.so; do + echo "Rewriting dylib paths for $file..." + fixlib "$file" "`pwd`" + done + ) + (cd "$package/Contents/Resources/lib/pango/1.6.0/modules" + for file in *.so; do + echo "Rewriting dylib paths for $file..." + fixlib "$file" "`pwd`" + done + ) + (cd "$package/Contents/Resources/lib/ImageMagick/modules-Q16/filters" + for file in *.so; do + echo "Rewriting dylib paths for $file..." + fixlib "$file" "`pwd`" + done + ) + (cd "$package/Contents/Resources/lib/ImageMagick/modules-Q16/coders" + for file in *.so; do + echo "Rewriting dylib paths for $file..." + fixlib "$file" "`pwd`" + done + ) + (cd "$package/Contents/Resources/bin" + for file in *; do + echo "Rewriting dylib paths for $file..." + fixlib "$file" "`pwd`" + done + cd ../lib + for file in *.dylib; do + echo "Rewriting dylib paths for $file..." + fixlib "$file" "`pwd`" + done + ) +} + +PATHLENGTH=`echo $LIBPREFIX | wc -c` +if [ "$PATHLENGTH" -ge "50" ]; then + # If the LIBPREFIX path is long enough to allow + # path rewriting, then do this. + rewritelibpaths +else + echo "Could not rewrite dylb paths for bundled libraries. This requires" >&2 + echo "Macports to be installed in a PREFIX of at least 50 characters in length." >&2 + echo "" >&2 + echo "The package will still work if the following line is uncommented in" >&2 + echo "Inkscape.app/Contents/Resources/bin/inkscape:" >&2 + echo ' export DYLD_LIBRARY_PATH="$TOP/lib"' >&2 + exit 1 + +fi exit 0