summaryrefslogtreecommitdiffstats
path: root/Modules/CPack.RuntimeScript.in
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2007-01-10 20:30:26 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2007-01-10 20:30:26 (GMT)
commitde5540f7e5215ea1cce982f5e7357f4999c3f908 (patch)
tree9410e064963651c0b543bdb2941f14fe6b091798 /Modules/CPack.RuntimeScript.in
parentc2780e2c9a83e50b2cdd5225ede341c7de67d862 (diff)
downloadCMake-de5540f7e5215ea1cce982f5e7357f4999c3f908.zip
CMake-de5540f7e5215ea1cce982f5e7357f4999c3f908.tar.gz
CMake-de5540f7e5215ea1cce982f5e7357f4999c3f908.tar.bz2
ENH: First pass at CPack generator for OSX X11 applications. This are applications that require X11 to work. This is not really installed but a bundle packager
Diffstat (limited to 'Modules/CPack.RuntimeScript.in')
-rwxr-xr-xModules/CPack.RuntimeScript.in40
1 files changed, 40 insertions, 0 deletions
diff --git a/Modules/CPack.RuntimeScript.in b/Modules/CPack.RuntimeScript.in
new file mode 100755
index 0000000..9195d52
--- /dev/null
+++ b/Modules/CPack.RuntimeScript.in
@@ -0,0 +1,40 @@
+#!/bin/sh
+#
+# Modified from: Aaron Voisine <aaron@voisine.org>
+
+CWD="`dirname \"$0\"`"
+TMP=/tmp/$UID/TemporaryItems
+
+ps -wx -ocommand | grep -e '[X]11.app' > /dev/null
+if [ "$?" != "0" -a ! -f ~/.xinitrc ]; then
+ echo "rm -f ~/.xinitrc" > ~/.xinitrc
+ sed 's/xterm/# xterm/' /usr/X11R6/lib/X11/xinit/xinitrc >> ~/.xinitrc
+fi
+
+mkdir -p $TMP
+cat << __END_OF_GETDISPLAY_SCRIPT__ > "$TMP/getdisplay.sh"
+#!/bin/sh
+mkdir -p "$TMP"
+
+if [ "\$DISPLAY"x == "x" ]; then
+ echo :0 > "$TMP/display"
+else
+ echo \$DISPLAY > "$TMP/display"
+fi
+__END_OF_GETDISPLAY_SCRIPT__
+rm -f $TMP/display
+open-x11 $TMP/getdisplay.sh || \
+open -a XDarwin $TMP/getdisplay.sh || \
+echo ":0" > $TMP/display
+
+while [ "$?" == "0" -a ! -f $TMP/display ]; do sleep 1; done
+export "DISPLAY=`cat $TMP/display`"
+
+ps -wx -ocommand | grep -e '[X]11' > /dev/null || exit 11
+
+cd ~/
+echo "$@" > /tmp/arguments.log
+if echo $1 | grep -- "^-psn_"; then
+ shift
+fi
+exec "$CWD/bin/@CPACK_EXECUTABLE_NAME@" "$@" > /tmp/slicer.output 2>&1