osx_make_dmg.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/bin/sh
  2. # OS X .dmg maker for distributable builds
  3. # Courtesy of WntrMute
  4. # How to use:
  5. # run scons so that a complete and valid build is made in the normal Binary path
  6. # run this script :)
  7. trap "echo; exit" SIGINT SIGTERM
  8. temp_dir="Dolphin-r`svn info | grep "Revision" | awk '{print $2}'`"
  9. fix_shared_object_depends() {
  10. search_string=$1
  11. # Get list of files to work on
  12. file_list=`find $temp_dir/Dolphin.app -name *.dylib`
  13. # Loop over the files, and update the path
  14. for file in ${file_list}; do
  15. orig_paths=(`otool -L ${file} | grep ${search_string} | awk '{print $1}'`)
  16. for orig_path in ${orig_paths[@]}; do
  17. if test "x${orig_path}" != x; then
  18. new_path=`echo ${orig_path} | xargs basename`
  19. echo "$file\t$orig_path"
  20. cp ${orig_path} $temp_dir/Dolphin.app/Contents/MacOS/${new_path}
  21. install_name_tool -change ${orig_path} @executable_path/${new_path} ${file}
  22. fi
  23. done
  24. done
  25. # wxw shoves all the paths into one string, so the looping is really just for dealing with wxw crap
  26. orig_paths=(`otool -L $temp_dir/Dolphin.app/Contents/MacOS/Dolphin | grep ${search_string} | awk '{print $1}'`)
  27. for orig_path in ${orig_paths[@]}; do
  28. if test "x${orig_path}" != x; then
  29. new_path=`echo ${orig_path} | xargs basename`
  30. cp ${orig_path} $temp_dir/Dolphin.app/Contents/MacOS/${new_path}
  31. install_name_tool -change ${orig_path} @executable_path/${new_path} $temp_dir/Dolphin.app/Contents/MacOS/Dolphin
  32. echo "Fixing $orig_path"
  33. fi
  34. done
  35. }
  36. cd Binary 2>/dev/null
  37. if [ $? != 0 ]; then echo "Did you build dolphin yet?"; exit; fi
  38. rm -rf $temp_dir
  39. mkdir -p $temp_dir/Dolphin.app
  40. cp -r Darwin-i386/Dolphin.app $temp_dir
  41. fix_shared_object_depends libwx
  42. fix_shared_object_depends libSDL
  43. fix_shared_object_depends libGLEW
  44. fix_shared_object_depends libz
  45. mkdir -p $temp_dir/Dolphin.app/Contents/Library/Frameworks/Cg.framework
  46. cp /Library/Frameworks/Cg.framework/Cg $temp_dir/Dolphin.app/Contents/Library/Frameworks/Cg.framework/Cg
  47. find $temp_dir -name .svn -exec rm -fr {} \; 2>/dev/null
  48. rm $temp_dir.dmg 2>/dev/null
  49. echo "Creating dmg"
  50. hdiutil create -srcfolder $temp_dir -format UDBZ $temp_dir.dmg
  51. rm -rf $temp_dir