SCDoc: Use proper static string constants instead of comparing string literals.
[supercollider.git] / package / package
blob59db92ceb108647957e675088dedc95629456283
1 #!/bin/bash
3 basename=`basename $PWD`
4 if [ $basename != "package" ]; then
5 echo "This script must be ran from within the Packager directory."
6 exit 1
7 fi
9 version=`date "+%Y-%m-%d"`
10 include_optionals=false
11 if [ `uname` = 'Darwin' ]; then
12 package_type="osx"
13 else
14 package_type="source"
17 while getopts ":v:os" Option
19 case $Option in
20 v ) version=$OPTARG
22 o ) include_optionals=true
24 s ) package_type="source"
26 esac
27 done
28 shift $(($OPTIND - 1))
30 revision=`git rev-list HEAD -1 | sed -E 's/([[:alnum:]]{1,10}).*/\1/'`
31 if [ "`git status -s -uno`" != "" ]; then
32 echo "WARNING: The working copy has uncommitted changes which will NOT be included in the package."
35 if [ $package_type == "source" ]; then
36 if [ -d SuperCollider-Source ]; then
37 echo "Please remove the ./SuperCollider-Source directory before running this script."
38 exit 1
40 returndir=`pwd`
41 cd ../
42 bash package/git-archive-all.sh --prefix SuperCollider-Source/ "$returndir/SuperCollider-Source.tmp.tar"
43 cd "$returndir"
44 # NB we only need one instance of boost, so we exclude one of its two appearances as a submodule in the following
45 tar -x --exclude ".gitignore" --exclude ".gitmodules" \
46 --exclude "SuperCollider-Source/external_libraries/nova-tt/boost_lockfree" \
47 -f SuperCollider-Source.tmp.tar
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.bz2"
53 filenamelinux="SuperCollider-$version-Source-With-Extras-linux.tar.bz2"
54 else
55 filename="SuperCollider-$version-Source.tar.bz2"
56 filenamelinux="SuperCollider-$version-Source-linux.tar.bz2"
59 # Here we build a list of (many) files that are useless on linux, so as to build a slimline source.tar.bz2
60 find SuperCollider-Source -iname windows -or -iname osx -or -name "*.xcodeproj" -or -name scide_scapp -or -iname "iPhone*" \
61 | grep -v "external_libraries/boost/boost/asio/windows" > LinuxExclusions.txt
62 echo 'SuperCollider-Source/SuperColliderAU
63 SuperCollider-Source/editors/Psycollider
64 SuperCollider-Source/platform/README OS X
65 SuperCollider-Source/platform/README WINDOWS
66 SuperCollider-Source/platform/README IPHONE
67 SuperCollider-Source/external_libraries/libsndfile
68 SuperCollider-Source/external_libraries/curl
69 SuperCollider-Source/external_libraries/icu
70 SuperCollider-Source/platform/mac
71 SuperCollider-Source/platform/iphone
72 SuperCollider-Source/lang/LangPrimSource/HID_Utilities
73 SuperCollider-Source/lang/LangPrimSource/HID_Utilities_10_4
74 SuperCollider-Source/lang/LangPrimSource/WiiMote_OSX
75 SuperCollider-Source/editors/scapp' >> LinuxExclusions.txt
77 tar cfj "$filename" SuperCollider-Source
78 tar cfjX "$filenamelinux" LinuxExclusions.txt SuperCollider-Source
79 rm -rf SuperCollider-Source SuperCollider-Source.tmp.tar
80 exit
81 else
82 if [ -d SuperCollider ]; then
83 echo "Please remove the ./SuperCollider directory before running this script."
84 exit 1
86 if $include_optionals; then
87 opt_options='--copy dmg_with_optionals.ds_store:/.DS_Store --copy optional/:/Optional\ Installs --copy OPTIONALS_README_OSX.rtf:/Optional\ Installs/README.rtf'
88 filename="SuperCollider-$version-With-Extras.dmg"
89 else
90 opt_options='--copy dmg_without_optionals.ds_store:/.DS_Store'
91 filename="SuperCollider-$version.dmg"
94 about_version="$version (Revision $revision)"
95 echo "About box version string:" $about_version
97 mkdir -p SuperCollider/plugins
98 returndir=`pwd`
99 cd ../platform/mac/build
100 git archive $revision | tar -x -C "$returndir/SuperCollider"
101 cp -R SuperCollider.app scsynth sclang "$returndir/SuperCollider/"
102 cp plugins/* "$returndir/SuperCollider/plugins/"
103 cd $returndir
104 cd ../
105 cp -R ChangeLog COPYING examples Help SCClassLibrary README sounds "$returndir/SuperCollider/"
106 cd $returndir
107 find SuperCollider/Help/ \( -name "*.htm" -or -name "*.html" \) -exec /Developer/Tools/SetFile -c SCjm {} \;
108 defaults write $PWD/SuperCollider/SuperCollider.app/Contents/Info CFBundleVersion -string "$about_version"
109 defaults write $PWD/SuperCollider/SuperCollider.app/Contents/Info CFBundleGetInfoString -string "$version"
110 plutil -convert xml1 $PWD/SuperCollider/SuperCollider.app/Contents/Info.plist
112 # use eval to force any escapes or quotes in $opt_options to be evaluated
113 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
115 rm -rf ./SuperCollider