Advertisement
Guest User

Untitled

a guest
Aug 21st, 2018
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.07 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. if test "x$IGE_DEBUG_LAUNCHER" != x; then
  4.     set -x
  5. fi
  6.  
  7. if test "x$IGE_DEBUG_GDB" != x; then
  8.     EXEC="gdb --args"
  9. else
  10.     EXEC=exec
  11. fi
  12.  
  13. name="`basename $0`"
  14. tmp="`pwd`/$0"
  15. tmp=`dirname "$tmp"`
  16. tmp=`dirname "$tmp"`
  17. bundle=`dirname "$tmp"`
  18. bundle_contents="$bundle"/Contents
  19. bundle_res="$bundle_contents"/Resources
  20. bundle_lib="$bundle_res"/lib
  21. bundle_bin="$bundle_res"/bin
  22. bundle_data="$bundle_res"/share
  23. bundle_etc="$bundle_res"/etc
  24.  
  25. export DYLD_LIBRARY_PATH="$bundle_lib"
  26. export XDG_CONFIG_DIRS="$bundle_etc"/xdg
  27. export XDG_DATA_DIRS="$bundle_data"
  28. export GTK_DATA_PREFIX="$bundle_res"
  29. export GTK_EXE_PREFIX="$bundle_res"
  30. export GTK_PATH="$bundle_res"
  31.  
  32. export GTK2_RC_FILES="$bundle_etc/gtk-2.0/gtkrc"
  33. export GTK_IM_MODULE_FILE="$bundle_etc/gtk-2.0/gtk.immodules"
  34. export GDK_PIXBUF_MODULE_FILE="$bundle_etc/gtk-2.0/gdk-pixbuf.loaders"
  35. export PANGO_RC_FILE="$bundle_etc/pango/pangorc"
  36.  
  37. APP=name
  38. I18NDIR="$bundle_data/locale"
  39. # Set the locale-related variables appropriately:
  40. unset LANG LC_MESSAGES LC_MONETARY LC_COLLATE
  41.  
  42. # Has a language ordering been set?
  43. # If so, set LC_MESSAGES and LANG accordingly; otherwise skip it.
  44. # First step uses sed to clean off the quotes and commas, to change - to _, and change the names for the chinese scripts from "Hans" to CN and "Hant" to TW.
  45. APPLELANGUAGES=`defaults read .GlobalPreferences AppleLanguages | sed -En   -e 's/\-/_/' -e 's/Hant/TW/' -e 's/Hans/CN/' -e 's/[[:space:]]*\"?([[:alnum:]_]+)\"?,?/\1/p' `
  46. if test "$APPLELANGUAGES"; then
  47.     # A language ordering exists.
  48.     # Test, item per item, to see whether there is an corresponding locale.
  49.     for L in $APPLELANGUAGES; do
  50.     #test for exact matches:
  51.        if test -f "$I18NDIR/${L}/LC_MESSAGES/$APP.mo"; then
  52.         export LANG=$L
  53.             break
  54.         fi
  55.     #This is a special case, because often the original strings are in US
  56.     #English and there is no translation file.
  57.     if test "x$L" == "xen_US"; then
  58.         export LANG=$L
  59.         break
  60.     fi
  61.     #OK, now test for just the first two letters:
  62.         if test -f "$I18NDIR/${L:0:2}/LC_MESSAGES/$APP.mo"; then
  63.         export LANG=${L:0:2}
  64.         break
  65.     fi
  66.     #Same thing, but checking for any english variant.
  67.     if test "x${L:0:2}" == "xen"; then
  68.         export LANG=$L
  69.         break
  70.     fi;
  71.     done  
  72. fi
  73. unset APPLELANGUAGES L
  74.  
  75. # If we didn't get a language from the language list, try the Collation preference, in case it's the only setting that exists.
  76. APPLECOLLATION=`defaults read .GlobalPreferences AppleCollationOrder`
  77. if test -z ${LANG} -a -n $APPLECOLLATION; then
  78.     if test -f "$I18NDIR/${APPLECOLLATION:0:2}/LC_MESSAGES/$APP.mo"; then
  79.     export LANG=${APPLECOLLATION:0:2}
  80.     fi
  81. fi
  82. if test ! -z $APPLECOLLATION; then
  83.     export LC_COLLATE=$APPLECOLLATION
  84. fi
  85. unset APPLECOLLATION
  86.  
  87. # Continue by attempting to find the Locale preference.
  88. APPLELOCALE=`defaults read .GlobalPreferences AppleLocale`
  89.  
  90. if test -f "$I18NDIR/${APPLELOCALE:0:5}/LC_MESSAGES/$APP.mo"; then
  91.     if test -z $LANG; then
  92.         export LANG="${APPLELOCALE:0:5}"
  93.     fi
  94.  
  95. elif test -z $LANG -a -f "$I18NDIR/${APPLELOCALE:0:2}/LC_MESSAGES/$APP.mo"; then
  96.     export LANG="${APPLELOCALE:0:2}"
  97. fi
  98.  
  99. #Next we need to set LC_MESSAGES. If at all possilbe, we want a full
  100. #5-character locale to avoid the "Locale not supported by C library"
  101. #warning from Gtk -- even though Gtk will translate with a
  102. #two-character code.
  103. if test -n $LANG; then
  104. #If the language code matches the applelocale, then that's the message
  105. #locale; otherwise, if it's longer than two characters, then it's
  106. #probably a good message locale and we'll go with it.
  107.     if test $LANG == ${APPLELOCALE:0:5} -o $LANG != ${LANG:0:2}; then
  108.     export LC_MESSAGES=$LANG
  109. #Next try if the Applelocale is longer than 2 chars and the language
  110. #bit matches $LANG
  111.     elif test $LANG == ${APPLELOCALE:0:2} -a $APPLELOCALE > ${APPLELOCALE:0:2}; then
  112.     export LC_MESSAGES=${APPLELOCALE:0:5}
  113. #Fail. Get a list of the locales in $PREFIX/share/locale that match
  114. #our two letter language code and pick the first one, special casing
  115. #english to set en_US
  116.     elif test $LANG == "en"; then
  117.     export LC_MESSAGES="en_US"
  118.     else
  119.     LOC=`find $PREFIX/share/locale -name $LANG???`
  120.     for L in $LOC; do
  121.         export LC_MESSAGES=$L
  122.     done
  123.     fi
  124. else
  125. #All efforts have failed, so default to US english
  126.     export LANG="en_US"
  127.     export LC_MESSAGES="en_US"
  128. fi
  129. CURRENCY=`echo $APPLELOCALE |  sed -En 's/.*currency=([[:alpha:]]+).*/\1/p'`
  130. if test "x$CURRENCY" != "x"; then
  131. #The user has set a special currency. Gtk doesn't install LC_MONETARY files, but Apple does in /usr/share/locale, so we're going to look there for a locale to set LC_CURRENCY to.
  132.     if test -f /usr/local/share/$LC_MESSAGES/LC_MONETARY; then
  133.     if test -a `cat /usr/local/share/$LC_MESSAGES/LC_MONETARY` == $CURRENCY; then
  134.         export LC_MONETARY=$LC_MESSAGES
  135.     fi
  136.     fi
  137.     if test -z "$LC_MONETARY"; then
  138.     FILES=`find /usr/share/locale -name LC_MONETARY -exec grep -H $CURRENCY {} \;`
  139.     if test -n "$FILES"; then
  140.         export LC_MONETARY=`echo $FILES | sed -En 's%/usr/share/locale/([[:alpha:]_]+)/LC_MONETARY.*%\1%p'`
  141.     fi
  142.     fi
  143. fi
  144. #No currency value means that the AppleLocale governs:
  145. if test -z "$LC_MONETARY"; then
  146.     LC_MONETARY=${APPLELOCALE:0:5}
  147. fi
  148. #For Gtk, which only looks at LC_ALL:
  149. export LC_ALL=$LC_MESSAGES
  150.  
  151. unset APPLELOCALE FILES LOC
  152.  
  153. if test -f "$bundle_lib/charset.alias"; then
  154.     export CHARSETALIASDIR="$bundle_lib"
  155. fi
  156.  
  157. # Extra arguments can be added in environment.sh.
  158. EXTRA_ARGS=
  159. if test -f "$bundle_res/environment.sh"; then
  160.   source "$bundle_res/environment.sh"
  161. fi
  162.  
  163. # Strip out the argument added by the OS.
  164. if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then
  165.     shift 1
  166. fi
  167.  
  168. # export DLYD_INSERT_LIBRARIES=/usr/lib/libMallocDebug.A.dylib
  169. # export MallocScribble=YES
  170. # export MallocPreScribble=YES
  171. # export MallocGuardEdges=YES
  172. # export MallocStackLogging=YES
  173. # export MallocStackLoggingNoCompact=YES
  174. # export NSZombieEnabled=YES
  175. # export MallocErrorAbort=YES
  176. # export MallocCheckHeapEach=100
  177. # export MallocCheckHeapStart=100
  178.  
  179. $EXEC "$bundle_contents/MacOS/$name-bin" $* $EXTRA_ARGS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement