configure, gst-uninstalled: remove a few bashism
[platform/upstream/gstreamer.git] / scripts / gst-uninstalled
1 #!/bin/bash -i
2 #
3 # this script is in git as gstreamer/scripts/gst-uninstalled
4 #
5 # It will set up the environment to use and develop gstreamer and projects
6 # that use gstreamer with an uninstalled git checkout of gstreamer and the
7 # plugin modules.
8 #
9 # It will set up LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, PKG_CONFIG_PATH,
10 # GST_PLUGIN_PATH, GST_PLUGIN_SYSTEM_PATH, GST_REGISTRY, MANPATH, PYTHONPATH
11 # to prefer the uninstalled versions but also contain the installed ones.
12 # The only exception to this is, that no system installed plugins will be
13 # used but only the uninstalled ones.
14 #
15 # This script assumes that the relevant modules are checked out one by one
16 # under a given tree specified below in MYGST.
17 #
18 # Symlink this script in a directory in your path (for example $HOME/bin). You
19 # must name the symlink gst-something, where something is the subdirectory
20 # of MYGST that contains your gstreamer module checkouts.
21 #
22 # e.g.:
23 # - mkdir $HOME/gst/head
24 # - ln -sf gst-uninstalled $HOME/bin/gst-head
25 # - checkout copies of gstreamer modules in $HOME/gst/head
26 # - gst-head
27
28 # This script is run -i so that PS1 doesn't get cleared
29
30 # Change this variable to the location of your gstreamer git checkouts
31 MYGST=$HOME/gst
32
33 #
34 # Everything below this line shouldn't be edited!
35 #
36
37 # extract version from $0
38 # if this script is called "gst-head" then version will be "head"
39 VERSION=`echo $0 | sed s/.*gst-//g`
40
41 # base path under which dirs are installed
42 GST=$MYGST/$VERSION
43 if test ! -e $GST; then
44   echo "$GST does not exist !"
45   exit
46 fi
47
48 # set up a bunch of paths
49 PATH="\
50 $GST/gstreamer/tools:\
51 $GST/gst-plugins-base/tools:\
52 $GST/gst-player/src:\
53 $GST/gst-editor/src:\
54 $GST/gstreamer-sharp/tools:\
55 $GST/prefix/bin:\
56 $PATH"
57
58 # /some/path: makes the dynamic linker look in . too, so avoid this
59 LD_LIBRARY_PATH=$GST/prefix/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
60 DYLD_LIBRARY_PATH=$GST/prefix/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}
61
62 # GStreamer rtsp server library
63 LD_LIBRARY_PATH=$GST/gst-rtsp-server/gst/rtsp-server/.libs:$LD_LIBRARY_PATH
64 DYLD_LIBRARY_PATH=$GST/gst-rtsp-server/gst/rtsp-server/.libs:$DYLD_LIBRARY_PATH
65
66 # GStreamer ffmpeg libraries
67 for path in libavformat libavutil libavcodec libpostproc libavdevice
68 do
69    LD_LIBRARY_PATH=$GST/gst-ffmpeg/gst-libs/ext/ffmpeg/$path:$LD_LIBRARY_PATH
70    DYLD_LIBRARY_PATH=$GST/gst-ffmpeg/gst-libs/ext/ffmpeg/$path:$DYLD_LIBRARY_PATH
71 done
72
73 # GStreamer plugins base libraries
74 for path in app audio cdda fft interfaces pbutils netbuffer riff rtp rtsp sdp tag utils video 
75 do
76   LD_LIBRARY_PATH=$GST/gst-plugins-base/gst-libs/gst/$path/.libs:$LD_LIBRARY_PATH
77   DYLD_LIBRARY_PATH=$GST/gst-plugins-base/gst-libs/gst/$path/.libs:$DYLD_LIBRARY_PATH
78 done
79
80 # GStreamer core libraries
81 for path in base net check controller dataprotocol
82 do
83   LD_LIBRARY_PATH=$GST/gstreamer/libs/gst/$path/.libs:$LD_LIBRARY_PATH
84   DYLD_LIBRARY_PATH=$GST/gstreamer/libs/gst/$path/.libs:$DYLD_LIBRARY_PATH
85 done
86 LD_LIBRARY_PATH=$GST/gstreamer/gst/.libs:$LD_LIBRARY_PATH
87 DYLD_LIBRARY_PATH=$GST/gstreamer/gst/.libs:$DYLD_LIBRARY_PATH
88 export LD_LIBRARY_PATH
89 export DYLD_LIBRARY_PATH
90   
91 export PKG_CONFIG_PATH="\
92 $GST/prefix/lib/pkgconfig\
93 :$GST/gstreamer/pkgconfig\
94 :$GST/gst-plugins-base/pkgconfig\
95 :$GST/gst-plugins-good/pkgconfig\
96 :$GST/gst-plugins-ugly/pkgconfig\
97 :$GST/gst-plugins-bad/pkgconfig\
98 :$GST/gst-ffmpeg/pkgconfig\
99 :$GST/gst-python/pkgconfig\
100 :$GST/gst-rtsp-server/pkgconfig\
101 :$GST/gstreamer-sharp/pkgconfig\
102 ${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
103
104 export GST_PLUGIN_PATH="\
105 $GST/gstreamer/plugins\
106 :$GST/gst-plugins-base/ext\
107 :$GST/gst-plugins-base/gst\
108 :$GST/gst-plugins-base/sys\
109 :$GST/gst-plugins-good/ext\
110 :$GST/gst-plugins-good/gst\
111 :$GST/gst-plugins-good/sys\
112 :$GST/gst-plugins-ugly/ext\
113 :$GST/gst-plugins-ugly/gst\
114 :$GST/gst-plugins-ugly/sys\
115 :$GST/gst-plugins-bad/ext\
116 :$GST/gst-plugins-bad/gst\
117 :$GST/gst-plugins-bad/sys\
118 :$GST/gst-ffmpeg/ext\
119 :$GST/gnonlin/gnl\
120 :$GST/gst-openmax\
121 :$GST/gst-plugins-gl/gst\
122 :$GST/plugins\
123 ${GST_PLUGIN_PATH:+:$GST_PLUGIN_PATH}"
124
125 # don't use any system-installed plug-ins at all
126 export GST_PLUGIN_SYSTEM_PATH=
127 # set our registry somewhere else so we don't mess up the registry generated
128 # by an installed copy
129 rm -f $GST/gstreamer/registry.xml 2>/dev/null
130 export GST_REGISTRY=$GST/gstreamer/registry.dat
131 # Point at the uninstalled plugin scanner
132 export GST_PLUGIN_SCANNER=$GST/gstreamer/libs/gst/helpers/gst-plugin-scanner
133
134 # once MANPATH is set, it needs at least an "empty"component to keep pulling
135 # in the system-configured man paths from man.config
136 # this still doesn't make it work for the uninstalled case, since man goes
137 # look for a man directory "nearby" instead of the directory I'm telling it to
138 export MANPATH=$GST/gstreamer/tools:$GST/prefix/share/man:$MANPATH
139 pythonver=`python -c "import sys; print sys.version[:3]"`
140 export PYTHONPATH=$GST/gst-python:$GST/prefix/lib/python$pythonver/site-packages${PYTHONPATH:+:$PYTHONPATH}
141
142 # totem-pl-parser
143 export PKG_CONFIG_PATH=$GST/totem-pl-parser:$PKG_CONFIG_PATH
144 export LD_LIBRARY_PATH=$GST/totem-pl-parser/plparse/.libs:$LD_LIBRARY_PATH
145 export DYLD_LIBRARY_PATH=$GST/totem-pl-parser/plparse/.libs:$DYLD_LIBRARY_PATH
146
147 # totem
148 export PATH=$GST/totem/src:$PATH
149
150 # gstreamer-sharp
151 export MONO_PATH=$GST/gstreamer-sharp/gstreamer-sharp:$MONO_PATH
152 export LD_LIBRARY_PATH=$GST/gstreamer-sharp/gstreamer-sharp/glue/.libs:$LD_LIBRARY_PATH
153 export DYLD_LIBRARY_PATH=$GST/gstreamer-sharp/gstreamer-sharp/glue/.libs:$DYLD_LIBRARY_PATH
154
155 # gst-qa-system
156 export PYTHONPATH=$GST/gst-qa-system:$PYTHONPATH
157 export PATH=$GST/gst-qa-system/bin:$PATH
158
159 # if we got a command, run it, else start a shell
160 if test ! -z "$1";
161 then
162   $@
163   exit $?
164 fi
165
166 # set up prompt to help us remember we're in a subshell, cd to
167 # the gstreamer base dir and start $SHELL
168 cd $GST
169 shell=$SHELL
170 if test "x$SHELL" = "x/bin/bash"
171 then
172   # debian/ubuntu resets our PS1.  bastards.
173   shell="$SHELL --noprofile"
174 fi
175 PS1="[gst-$VERSION] $PS1" $shell
176