#!/bin/sh
# Really simple script to set up libs in psclient + updater + pssetup

cp /sw/lib/libjpeg.62.dylib psclient.app/Contents/Resources/
cp /sw/lib/libpng12.0.dylib psclient.app/Contents/Resources/
cp /sw/lib/libfreetype.6.dylib psclient.app/Contents/Resources/
cp /sw/lib/libmikmod.2.dylib psclient.app/Contents/Resources/
cp /sw/lib/libogg.0.dylib psclient.app/Contents/Resources/
cp /sw/lib/libvorbisfile.3.dylib psclient.app/Contents/Resources/
cp /sw/lib/libvorbis.0.dylib psclient.app/Contents/Resources/
cp /usr/local/lib/libcal3d.11.dylib psclient.app/Contents/Resources/

cp /sw/lib/libpng12.0.dylib updater.app/Contents/Resources/
cp /sw/lib/libfreetype.6.dylib updater.app/Contents/Resources/
cp /sw/lib/libdl.0.dylib updater.app/Contents/Resources/
cp /sw/lib/libcurl.2.dylib updater.app/Contents/Resources/
cp /sw/lib/libcrypto.0.9.7.dylib updater.app/Contents/Resources/
cp /sw/lib/libssl.0.9.7.dylib updater.app/Contents/Resources/

cp /sw/lib/libpng12.0.dylib pssetup.app/Contents/Resources/
cp /sw/lib/libfreetype.6.dylib pssetup.app/Contents/Resources/

install_name_tool -change /sw/lib/libjpeg.62.dylib @executable_path/../Resources/libjpeg.62.dylib psclient.app/Contents/Resources/csjpgimg.csbundle;
install_name_tool -change /sw/lib/libpng12.0.dylib @executable_path/../Resources/libpng12.0.dylib psclient.app/Contents/Resources/cspngimg.csbundle;
install_name_tool -change /sw/lib/libfreetype.6.dylib @executable_path/../Resources/libfreetype.6.dylib psclient.app/Contents/Resources/freefnt2.csbundle;
install_name_tool -change /sw/lib/libogg.0.dylib @executable_path/../Resources/libogg.0.dylib psclient.app/Contents/Resources/sndsysogg.csbundle;
install_name_tool -change /sw/lib/libvorbisfile.3.dylib @executable_path/../Resources/libvorbisfile.3.dylib psclient.app/Contents/Resources/sndsysogg.csbundle;
install_name_tool -change /sw/lib/libvorbis.0.dylib @executable_path/../Resources/libvorbis.0.dylib psclient.app/Contents/Resources/sndsysogg.csbundle;
install_name_tool -change /sw/lib/libogg.0.dylib @executable_path/../Resources/libogg.0.dylib psclient.app/Contents/Resources/libvorbisfile.3.dylib;
install_name_tool -change /sw/lib/libogg.0.dylib @executable_path/../Resources/libogg.0.dylib psclient.app/Contents/Resources/libvorbis.0.dylib;
install_name_tool -change /usr/local/lib/libcal3d.11.dylib @executable_path/../Resources/libcal3d.11.dylib psclient.app/Contents/Resources/sprcal3d.csbundle;
install_name_tool -change /usr/local/lib/libcal3d.11.dylib @executable_path/../Resources/libcal3d.11.dylib psclient.app/Contents/Resources/sprcal3dldr.csbundle;

install_name_tool -change /sw/lib/libpng12.0.dylib @executable_path/../Resources/libpng12.0.dylib updater.app/Contents/Resources/cspngimg.csbundle;
install_name_tool -change /sw/lib/libfreetype.6.dylib @executable_path/../Resources/libfreetype.6.dylib updater.app/Contents/Resources/freefnt2.csbundle;
install_name_tool -change /sw/lib/libcurl.2.dylib @executable_path/../Resources/libcurl.2.dylib updater.app/Contents/MacOS/updater;
install_name_tool -change /sw/lib/libdl.0.dylib @executable_path/../Resources/libdl.0.dylib updater.app/Contents/Resources/libcurl.2.dylib;
install_name_tool -change /sw/lib/libssl.0.9.7.dylib @executable_path/../Resources/libssl.0.9.7.dylib updater.app/Contents/Resources/libcurl.2.dylib;
install_name_tool -change /sw/lib/libcrypto.0.9.7.dylib @executable_path/../Resources/libcrypto.0.9.7.dylib updater.app/Contents/Resources/libcurl.2.dylib;
install_name_tool -change /sw/lib/libcrypto.0.9.7.dylib @executable_path/../Resources/libcrypto.0.9.7.dylib updater.app/Contents/Resources/libssl.0.9.7.dylib;
install_name_tool -change /sw/lib/libdl.0.dylib @executable_path/../Resources/libdl.0.dylib updater.app/Contents/MacOS/updater;
install_name_tool -change /sw/lib/libssl.0.9.7.dylib @executable_path/../Resources/libssl.0.9.7.dylib updater.app/Contents/MacOS/updater;
install_name_tool -change /sw/lib/libcrypto.0.9.7.dylib @executable_path/../Resources/libcrypto.0.9.7.dylib updater.app/Contents/MacOS/updater;

install_name_tool -change /sw/lib/libpng12.0.dylib @executable_path/../Resources/libpng12.0.dylib pssetup.app/Contents/Resources/cspngimg.csbundle;
install_name_tool -change /sw/lib/libfreetype.6.dylib @executable_path/../Resources/libfreetype.6.dylib pssetup.app/Contents/Resources/freefnt2.csbundle;

