3 # written by Markus Sinner, http://psitronic.de
6 # http://freeorion.psitronic.de/download/nightly/
8 # This is a wrapper-script for starting FreeOrion on
9 # ix86 (and maybe x64) Linux Systems.
10 # This script will CD into application and set some
11 # enviroment variables.
13 # ---- commandline PARAMETERS and ENVIROMENT variables -----
14 # This script supports parameters, that will be evaluated
15 # BEFORE freeorion binary is called and will be removed,
16 # because the binary won't support them.
17 # Currently only one parameter at a time is supported!
18 # Parameters other than these will be appended as command
19 # line parameters to the call of the freeorion binary.
22 # This starts freeorion using the "strace" utility.
23 # Generates a strace logifle /tmp/freeorion.trace.
24 # Make sure it is installed on your system!
26 # Runs freeorion in a gdb instance, passes the original
27 # parameters through the --args parameter of gdb
30 # ENVIROMENT variables
31 # This script supports some enviroment variables. To set them
32 # either use the followin command BEFORE you execute this script.
34 # This permanently set the variable in you current shell script.
35 # Or you prepend the options when running this script, like this:
36 # PARAM1="hello" PARAM2="yo man" /usr/bin/freeorion.elf
40 # Use this to prepend something to calling freorion.
41 # This variables also is used internally, when --gdb or --trace
42 # appear on the command line.
44 # If you use --gbd, you should uses this env to add GDB parameters.
45 # Make sure you end this list of parameters with --args, otherwise
46 # gdb won't start. Example: FO_GDB_ARGS="-q -s fo.symbols --args"
48 # This is a well known env and will be honored by this script.
52 # ---------- STARTS HERE ---------------
53 # Change into application directory
54 # If this is a symlink, then we
55 # need to change into the dir of symlink-target.
57 echo "I am Symlink. Following into my targets basedir"
60 echo "Following into my basedir"
64 # This is important! Script won't work outside its installation dir
65 ROOT
=/usr
/share
/freeorion
72 # Check for python. If freeorionca binary is missing it, use
73 # the shipped version.
74 if ldd
/usr
/bin
/freeorionca |
grep "libpython.*not found"; then
75 #echo "python2.5 missing. Using shipped version."
78 #echo "python2.5 found. Using it."
82 # Set Python library home for loading modules
83 # If no python 2.5 is detected, use shipped python 2.5
84 if [ "$PYTHON_USE_SHIPPED" = "1" ]; then
85 export PYTHONHOME
=/usr
/lib
/freeorion
/python2.5
86 export PYTHONPATH
=${PYTHONHOME}
88 export PYTHONVERBOSE
=1
89 echo "PYTHONHOME=${PYTHONHOME}"
91 export LD_LIBRARY_PATH
=${PYTHONHOME}:${LD_LIBRARY_PATH}
92 export LD_PRELOAD
=${PYTHONHOME}/libutil.so
.1:${PYTHONHOME}/libpython2.5.so
96 # Command line Parameter --gdb forces running in gdb
97 # Setting FO_TRACE to gdb results in other settings, see
99 if [ "$1" = "--gdb" ]; then
102 # Don't forget to remove the param
106 if [ "$1" = "--strace" ]; then
107 TRACEFILE
=/tmp
/freeorion.trace
109 echo "Tracing to ${TRACEFILE}"
111 FO_TRACE
="strace -f -o ${TRACEFILE}"
113 # Don't forget to remove the param
119 # Add a parameter FO_GDB_ARGS to support gdb
120 # Or warn the user, if he changed FO_GDB_ARGS and has
121 # forgotten to end it with --args
122 if [ "$FO_TRACE" = "gdb" ]; then
123 if [ "$FO_GDB_ARGS" = "" ]; then
126 echo "****************************************************"
127 echo "** NOTE NOTE NOTE NOTE **"
128 echo "Running FO in gdb"
129 echo "If you use FO_GDB_ARGS on your command line, make"
130 echo "sure that you END this variabble with --args."
131 echo "Otherwise gdb will not start."
133 echo "Type 'start' when the gdb instance has loaded!"
139 # Support loading libs from application/lib
140 export LD_LIBRARY_PATH
=.
/lib
:${LD_LIBRARY_PATH}
142 # Call with settings-dir to avoid conflicting installations
143 ${FO_TRACE} ${FO_GDB_ARGS} /usr
/bin
/freeorion.elf
--resource-dir .
/default $@