Skip to content

Instantly share code, notes, and snippets.

@tobylane
Created March 24, 2016 09:43
Show Gist options
  • Save tobylane/6e0ab517747a55f71bc5 to your computer and use it in GitHub Desktop.
Save tobylane/6e0ab517747a55f71bc5 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -ea
[ -n "$CTH_VERBOSE" ] && set -x
# Script to copy dylibs into the folder and use them.
cd AnimView.app/Contents/MacOS
core=$(otool -L AnimView | grep core | cut -f1 -d' ' | tr -d '[[:space:]]')
cat "$core" > libwx_osx_cocoau_core.dylib
base=$(otool -L AnimView | grep base | cut -f1 -d' ' | tr -d '[[:space:]]')
cat "$base" > libwx_baseu.dylib
png=$( otool -L "$core" | grep png | cut -f1 -d' ' | tr -d '[[:space:]]')
cat "$png" > libpng.dylib
jpeg=$(otool -L "$core" | grep jpeg | cut -f1 -d' ' | tr -d '[[:space:]]')
cat "$jpeg" > libjpeg.dylib
tiff=$(otool -L "$core" | grep tiff | cut -f1 -d' ' | tr -d '[[:space:]]')
cat "$tiff" > libtiff.dylib
install_name_tool -change "$core" @executable_path/libwx_osx_cocoau_core.dylib AnimView
install_name_tool -change "$base" @executable_path/libwx_baseu.dylib AnimView
install_name_tool -change "$png" @executable_path/libpng.dylib libwx_osx_cocoau_core.dylib
install_name_tool -change "$jpeg" @executable_path/libjpeg.dylib libwx_osx_cocoau_core.dylib
install_name_tool -change "$tiff" @executable_path/libtiff.dylib libwx_osx_cocoau_core.dylib
install_name_tool -change $(otool -L "$core" | grep Cellar | cut -f1 -d' ' | tr -d '[[:space:]]') @executable_path/libwx_baseu.dylib libwx_osx_cocoau_core.dylib
install_name_tool -change $(otool -L "$tiff" | grep jpeg | cut -f1 -d' ' | tr -d '[[:space:]]') @executable_path/libjpeg.dylib libtiff.dylib
otool -L AnimView | grep -v System | grep -v /usr/lib | grep -v @executable_path
otool -L *.dylib | grep -v System | grep -v /usr/lib | grep -v @executable_path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment