Introduce "generator expressions" to add_test()
[cmake.git] / Modules / CPack.RuntimeScript.in
blobeaecdd8fad37184262779b201571ab0856abe2ad
1 #!/bin/sh
3 # Modified from: Aaron Voisine <aaron@voisine.org>
5 CWD="`dirname \"$0\"`"
6 TMP=/tmp/$UID/TemporaryItems
8 version=`sw_vers -productVersion`
9 if [ "$?" == "0" ]; then
10 major=${version%%\.*}
11 rest=${version#*\.}
12 minor=${rest%%\.*}
13 build=${rest#*\.}
14 else
15 major=10
16 minor=4
17 build=0
20 echo $version
21 echo "Major = $major"
22 echo "Minor = $minor"
23 echo "Build = $build"
26 # if 10.5 or greater, then all the open-x11 stuff need not occur
27 if ((( $major < 10 )) || ((( $major == 10)) && (( $minor < 5 )))); then
28 version=`sw_vers -productVersion`
29 if [ "$?" = "0" ]; then
30 major=${version%%\.*}
31 rest=${version#*\.}
32 minor=${rest%%\.*}
33 build=${rest#*\.}
34 else
35 major=10
36 minor=4
37 build=0
40 echo $version
41 echo "Major = $major"
42 echo "Minor = $minor"
43 echo "Build = $build"
46 # if 10.5 or greater, then all the open-x11 stuff need not occur
47 if ((( $major < 10 )) || ((( $major == 10)) && (( $minor < 5 )))); then
48 ps -wx -ocommand | grep -e '[X]11.app' > /dev/null
49 if [ "$?" != "0" -a ! -f ~/.xinitrc ]; then
50 echo "rm -f ~/.xinitrc" > ~/.xinitrc
51 sed 's/xterm/# xterm/' /usr/X11R6/lib/X11/xinit/xinitrc >> ~/.xinitrc
54 mkdir -p $TMP
55 cat << __END_OF_GETDISPLAY_SCRIPT__ > "$TMP/getdisplay.sh"
56 #!/bin/sh
57 mkdir -p "$TMP"
59 if [ "\$DISPLAY"x = "x" ]; then
60 echo :0 > "$TMP/display"
61 else
62 echo \$DISPLAY > "$TMP/display"
64 __END_OF_GETDISPLAY_SCRIPT__
66 chmod +x "$TMP/getdisplay.sh"
67 rm -f $TMP/display
68 open-x11 $TMP/getdisplay.sh || \
69 open -a XDarwin $TMP/getdisplay.sh || \
70 echo ":0" > $TMP/display
72 while [ "$?" = "0" -a ! -f $TMP/display ];
74 #echo "Waiting for display $TMP/display"
75 sleep 1;
76 done
77 export "DISPLAY=`cat $TMP/display`"
79 ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
81 cd ~/
82 echo "$@" > /tmp/arguments.log
83 if echo $1 | grep -- "^-psn_"; then
84 shift
87 exec "$CWD/bin/@CPACK_EXECUTABLE_NAME@" "$@" > /tmp/slicer.output 2>&1