File: start_megaglest_mapeditor

package info (click to toggle)
megaglest 3.9.1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 18,172 kB
  • ctags: 26,052
  • sloc: cpp: 140,512; ansic: 66,187; python: 3,761; sh: 2,986; perl: 1,899; php: 1,247; objc: 1,111; makefile: 259; sql: 139
file content (123 lines) | stat: -rwxr-xr-x 3,903 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/sh

findMissingSO () {

	LDCONFIG="$1"
	SO_LINKEDLIBNAME="$2"
    SO_LIBLOOKUP1="$3"
	SO_LIBLOOKUP2="$4"

	hasSO=`$LDCONFIG -p | grep -m 1 "$SO_LIBLOOKUP1" | cut "-d>" -f2 | cut "-d " -f2`
	if [ -n "$hasSO" ]; then
	  echo default library [$SO_LINKEDLIBNAME] was found in [$hasSO]
	else
	  echo default library [$SO_LINKEDLIBNAME] is missing, attempting to find and link to a newer version if available...

	  hasSO=`$LDCONFIG -p | grep -m 1 "$SO_LIBLOOKUP2" | cut "-d>" -f2 | cut "-d " -f2`
	  if [ -n "$hasSO" ]; then
		echo new library link [$hasSO] pointed to from [$SO_LINKEDLIBNAME]
		ln -f -s $hasSO $SO_LINKEDLIBNAME
	  fi
	fi

   return 0
}

# Library directory
LIBDIR="lib"

# As a first step to determine the absolute path of the directory the game 
# resides in, dereference symlinks to this script and convert relative to 
# absolute paths along the way.
MYLOCATION="`readlink -f $0`"

# The game directory is the directory the script resides in
GAMEDIR="`dirname $MYLOCATION`"

# export game library directory
test -n "${LIBDIR}" && export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GAMEDIR}/${LIBDIR}"

# ensure ldconfig is found (was an issue on OpenSuSE 11.2)
echo Looking for LDCONFIG [$LDCONFIG]... >&2

if [ "$LDCONFIG"'x' = 'x' ]  # 'LDCONFIG' environment variable, if set, overrides the following detection 
then
  echo 'Looking for LDCONFIG environment var not found...' >&2
  if [ `which ldconfig 2>/dev/null` ]
  then 
    LDCONFIG=`which ldconfig 2>/dev/null`

    echo Found LDCONFIG using which [$LDCONFIG]... >&2
  else
    if [ -x /sbin/ldconfig ]
    then
      LDCONFIG=/sbin/ldconfig
      echo Found LDCONFIG in sbin [$LDCONFIG]... >&2
    # optionally add more custom locations using 'elseif' here
    else
      echo 'ERROR: Could not find the "ldconfig" command.' >&2
      echo 'Try running "LDCONFIG=`which ldconfig` '"$0"' instead.' >&2
      exit 1
    fi
  fi
fi


# now deal with the openal library [libopenal.so.0]
OS_TYPE=`uname -m`

# Suse needs its own openAL
if [ -f /etc/SuSE-release ]; then
	rm lib/libopenal*
fi

OPENAL_LINKEDLIBNAME="libopenal.so.0"
OPENAL_LIBLOOKUP1=${OPENAL_LINKEDLIBNAME}
OPENAL_LIBLOOKUP2="libopenal.so.1"

DIRECTFB_LINKEDLIBNAME="libdirectfb-1.0.so.0"
DIRECTFB_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
DIRECTFB_LIBLOOKUP2="libdirectfb-"

FUSION_LINKEDLIBNAME="libfusion-1.0.so.0"
FUSION_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
FUSION_LIBLOOKUP2="libfusion-"

DIRECT_LINKEDLIBNAME="libdirect-1.0.so.0"
DIRECT_LIBLOOKUP1=${DIRECT_LINKEDLIBNAME}
DIRECT_LIBLOOKUP2="libdirect-"

if [ "$OS_TYPE" = "x86_64" ]; then
	DIRECTFB_LINKEDLIBNAME="libdirectfb-1.2.so.0"
	DIRECTFB_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
	DIRECTFB_LIBLOOKUP2="libdirectfb-"

	FUSION_LINKEDLIBNAME="libfusion-1.2.so.0"
	FUSION_LIBLOOKUP1=${DIRECTFB_LINKEDLIBNAME}
	FUSION_LIBLOOKUP2="libfusion-"

	DIRECT_LINKEDLIBNAME="libdirect-1.2.so.0"
	DIRECT_LIBLOOKUP1=${DIRECT_LINKEDLIBNAME}
	DIRECT_LIBLOOKUP2="libdirect-"
fi

#if [ "$OS_TYPE" = "x86_64" ]; then
#  OPENAL_LIBLOOKUP1="${OPENAL_LIBLOOKUP1} (libc6)"
#  OPENAL_LIBLOOKUP2="${OPENAL_LIBLOOKUP2} (libc6)"

#  DIRECTFB_LIBLOOKUP1="${DIRECTFB_LIBLOOKUP1} (libc6)"
#  DIRECTFB_LIBLOOKUP2="${DIRECTFB_LIBLOOKUP2} (libc6)"

#  FUSION_LIBLOOKUP1="${FUSION_LIBLOOKUP1} (libc6)"
#  FUSION_LIBLOOKUP2="${FUSION_LIBLOOKUP2} (libc6)"

#  DIRECT_LIBLOOKUP1="${DIRECT_LIBLOOKUP1} (libc6)"
#  DIRECT_LIBLOOKUP2="${DIRECT_LIBLOOKUP2} (libc6)"
#fi

findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${OPENAL_LINKEDLIBNAME}" "$OPENAL_LIBLOOKUP1" "$OPENAL_LIBLOOKUP2"
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECTFB_LINKEDLIBNAME}" "$DIRECTFB_LIBLOOKUP1" "$DIRECTFB_LIBLOOKUP2"
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${FUSION_LINKEDLIBNAME}" "$FUSION_LIBLOOKUP1" "$FUSION_LIBLOOKUP2"
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECT_LINKEDLIBNAME}" "$DIRECT_LIBLOOKUP1" "$DIRECT_LIBLOOKUP2"

"$GAMEDIR/megaglest_editor" $@