Merging various recent changes from trunk into 34 - inc sc.app menu tweak, synthdef...
[supercollider.git] / common / Packager / package
blob712b700d291fbdcc2028b8f29932fd859d77c240
1 #!/bin/bash
3 basename=`basename $PWD`
4 if [ $basename != "Packager" ]; then
5 echo "This script must be ran from within the Packager directory."
6 exit 1
7 fi
9 if [ -d SuperCollider ]; then
10 echo "Please remove the ./SuperCollider directory before running this script."
11 exit 1
14 version=`date "+%Y-%m-%d"`
15 include_optionals=false
16 if [ `uname` = 'Darwin' ]; then
17 package_type="osx"
18 else
19 package_type="source"
22 while getopts ":v:os" Option
24 case $Option in
25 v ) version=$OPTARG
27 o ) include_optionals=true
29 s ) package_type="source"
31 esac
32 done
33 shift $(($OPTIND - 1))
35 revision=`svnversion -n ../../`
36 if ( echo $revision | grep "M" > /dev/null 2>&1 ); then
37 echo "WARNING: The working copy has uncommitted changes which will be included in the package."
40 if ( echo $revision | grep ":" > /dev/null 2>&1 ); then
41 echo "WARNING: The working copy has mixed revision numbers (some folders had 'svn update' ran more recently than others)."
43 revision=`echo $revision | sed -e 's/^[^:]*://;s/[A-Za-z]//'`
45 if [ $package_type == "source" ]; then
46 mkdir SuperCollider-Source
47 svn export -q --force ../../ SuperCollider-Source
49 if $include_optionals; then
50 cp -Rp optional SuperCollider-Source/optional_installs
51 cp OPTIONALS_README_SOURCE.txt SuperCollider-Source/optional_installs/README.txt
52 filename="SuperCollider-$version-Source-With-Extras.tar.gz"
53 filenamelinux="SuperCollider-$version-Source-With-Extras-linux.tar.gz"
54 else
55 filename="SuperCollider-$version-Source.tar.gz"
56 filenamelinux="SuperCollider-$version-Source-linux.tar.gz"
59 # Here we build a list of (many) files that are useless on linux, so as to build a slimline source.tar.gz
60 find SuperCollider-Source -iname windows -or -iname osx -or -name "*.xcodeproj" -or -name scide_scapp -or -name "iPhone*" > LinuxExclusions.txt
61 echo 'SuperCollider-Source/SuperColliderAU
62 SuperCollider-Source/Psycollider
63 SuperCollider-Source/README OS X
64 SuperCollider-Source/README WINDOWS
65 SuperCollider-Source/README IPHONE
66 SuperCollider-Source/common/include/libsndfile
67 SuperCollider-Source/common/include/curl
68 SuperCollider-Source/common/include/icu
69 SuperCollider-Source/mac
70 SuperCollider-Source/iphone
71 SuperCollider-Source/common/Headers/app
72 SuperCollider-Source/common/Source/app' >> LinuxExclusions.txt
74 tar cfz "$filename" SuperCollider-Source
75 tar cfzX "$filenamelinux" LinuxExclusions.txt SuperCollider-Source
76 rm -rf SuperCollider-Source
77 exit
78 else
79 if $include_optionals; then
80 opt_options='--copy dmg_with_optionals.ds_store:/.DS_Store --copy optional/:/Optional\ Installs --copy OPTIONALS_README_OSX.rtf:/Optional\ Installs/README.rtf'
81 filename="SuperCollider-$version-With-Extras.dmg"
82 else
83 opt_options='--copy dmg_without_optionals.ds_store:/.DS_Store'
84 filename="SuperCollider-$version.dmg"
87 about_version="$version (Revision $revision)"
88 echo "About box version string:" $about_version
90 svn export -q --force ../../common/build SuperCollider
91 cp -R ../../common/build/SuperCollider.app ../../common/build/scsynth ../../common/build/sclang SuperCollider
92 cp ../../common/build/plugins/* SuperCollider/plugins/
93 cp ../../COPYING SuperCollider/COPYING
94 find SuperCollider/help/ \( -name "*.htm" -or -name "*.html" \) -exec /Developer/Tools/SetFile -c SCjm {} \;
95 defaults write $PWD/SuperCollider/SuperCollider.app/Contents/Info CFBundleVersion -string "$about_version"
96 defaults write $PWD/SuperCollider/SuperCollider.app/Contents/Info CFBundleGetInfoString -string "$version"
97 plutil -convert xml1 $PWD/SuperCollider/SuperCollider.app/Contents/Info.plist
99 # use eval to force any escapes or quotes in $opt_options to be evaluated
100 eval './pkg-dmg --verbosity 0 --source ./SuperCollider --target "$filename" --sourcefile --volname SuperCollider --mkdir /.background --copy background.png:/.background/background.png --symlink /Applications:/Applications '$opt_options
102 rm -rf ./SuperCollider