6c1ff5c7c7bddfb4d4531e50fd8f24aa6149534f
[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 if [ -z $GST_UNINSTALLED_ROOT ];
31 then
32     # Change this variable to the location of your gstreamer git checkouts
33     MYGST=$HOME/gst
34
35     #
36     # Everything below this line shouldn't be edited!
37     #
38
39     # extract version from $0
40     # if this script is called "gst-head" then version will be "head"
41     VERSION=`echo $0 | sed s/.*gst-//g`
42
43     # base path under which dirs are installed
44     GST=$MYGST/$VERSION
45 else
46     # Alternatively, you can set the GST_UNINSTALLED_ROOT environment variable to the
47     # location of your checkout and call this script directly.
48     #
49     # Ex: GST_UNINSTALLED_ROOT=$HOME/checkout/location gst-uninstalled
50
51     GST=$GST_UNINSTALLED_ROOT
52 fi
53
54 GST_PREFIX=$GST/prefix
55 if test ! -e $GST; then
56   echo "$GST does not exist !"
57   exit
58 fi
59
60 # set up a bunch of paths
61 PATH="\
62 $GST/gstreamer/tools:\
63 $GST/gst-plugins-base/tools:\
64 $GST/gst-player/src:\
65 $GST/gst-editor/src:\
66 $GST/gstreamer-sharp/tools:\
67 $GST/orc/tools:\
68 $GST_PREFIX/bin:\
69 $PATH"
70
71 # /some/path: makes the dynamic linker look in . too, so avoid this
72 LD_LIBRARY_PATH=$GST_PREFIX/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
73 DYLD_LIBRARY_PATH=$GST_PREFIX/lib${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}
74 GI_TYPELIB_PATH=$GST_PREFIX/share/gir-1.0${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}
75
76 # ORC
77 LD_LIBRARY_PATH=$GST/orc/orc/.libs:$GST/orc/orc-test/.libs:$LD_LIBRARY_PATH
78 DYLD_LIBRARY_PATH=$GST/orc/orc/.libs:$GST/orc/orc-test/.libs:$DYLD_LIBRARY_PATH
79
80 # GStreamer rtsp server library
81 LD_LIBRARY_PATH=$GST/gst-rtsp-server/gst/rtsp-server/.libs:$LD_LIBRARY_PATH
82 DYLD_LIBRARY_PATH=$GST/gst-rtsp-server/gst/rtsp-server/.libs:$DYLD_LIBRARY_PATH
83 GI_TYPELIB_PATH=$GST/gst-rtsp-server/gst/rtsp-server:$GI_TYPELIB_PATH
84
85 # GStreamer Editing Services library
86 LD_LIBRARY_PATH=$GST/gst-editing-services/ges/.libs:$LD_LIBRARY_PATH
87 DYLD_LIBRARY_PATH=$GST/gst-editing-services/ges/.libs:$DYLD_LIBRARY_PATH
88 GI_TYPELIB_PATH=$GST/gst-editing-services/ges:$GI_TYPELIB_PATH
89 PATH=$GST/gst-editing-services/tools:$PATH
90
91 # GStreamer plugins vaapi libraries
92 LD_LIBRARY_PATH=$GST/gstreamer-vaapi/gst-libs/gst/vaapi/.libs:$LD_LIBRARY_PATH
93 DYLD_LIBRARY_PATH=$GST/gstreamer-vaapi/gst-libs/gst/vaapi/.libs:$DYLD_LIBRARY_PATH
94
95 # GStreamer plugins base libraries
96 for path in allocators app audio fft pbutils riff rtp rtsp sdp tag utils video
97 do
98   LD_LIBRARY_PATH=$GST/gst-plugins-base/gst-libs/gst/$path/.libs:$LD_LIBRARY_PATH
99   DYLD_LIBRARY_PATH=$GST/gst-plugins-base/gst-libs/gst/$path/.libs:$DYLD_LIBRARY_PATH
100   GI_TYPELIB_PATH=$GST/gst-plugins-base/gst-libs/gst/$path:$GI_TYPELIB_PATH
101 done
102
103 # GStreamer plugins bad libraries
104 for path in adaptivedemux audio base basecamerabinsrc codecparsers gl insertbin interfaces mpegts player uridownloader video wayland
105 do
106   LD_LIBRARY_PATH=$GST/gst-plugins-bad/gst-libs/gst/$path/.libs:$LD_LIBRARY_PATH
107   DYLD_LIBRARY_PATH=$GST/gst-plugins-bad/gst-libs/gst/$path/.libs:$DYLD_LIBRARY_PATH
108   GI_TYPELIB_PATH=$GST/gst-plugins-bad/gst-libs/gst/$path:$GI_TYPELIB_PATH
109 done
110 export GST_HAAR_CASCADES_PATH=$GST/gst-plugins-bad/ext/opencv/
111
112 # GStreamer core libraries
113 for path in base check controller net
114 do
115   LD_LIBRARY_PATH=$GST/gstreamer/libs/gst/$path/.libs:$LD_LIBRARY_PATH
116   DYLD_LIBRARY_PATH=$GST/gstreamer/libs/gst/$path/.libs:$DYLD_LIBRARY_PATH
117   GI_TYPELIB_PATH=$GST/gstreamer/libs/gst/$path:$GI_TYPELIB_PATH
118 done
119 LD_LIBRARY_PATH=$GST/gstreamer/gst/.libs:$LD_LIBRARY_PATH
120 DYLD_LIBRARY_PATH=$GST/gstreamer/gst/.libs:$DYLD_LIBRARY_PATH
121 GI_TYPELIB_PATH=$GST/gstreamer/gst:$GI_TYPELIB_PATH
122 export LD_LIBRARY_PATH
123 export DYLD_LIBRARY_PATH
124 export GI_TYPELIB_PATH
125   
126 export PKG_CONFIG_PATH="\
127 $GST_PREFIX/lib/pkgconfig\
128 :$GST/gstreamer/pkgconfig\
129 :$GST/gst-plugins-base/pkgconfig\
130 :$GST/gst-plugins-good/pkgconfig\
131 :$GST/gst-plugins-ugly/pkgconfig\
132 :$GST/gst-plugins-bad/pkgconfig\
133 :$GST/gst-libav/pkgconfig\
134 :$GST/gst-ffmpeg/pkgconfig\
135 :$GST/gst-python/pkgconfig\
136 :$GST/gst-rtsp-server/pkgconfig\
137 :$GST/gst-editing-services/pkgconfig\
138 :$GST/gstreamer-sharp/pkgconfig\
139 :$GST/gstreamer-vaapi/pkgconfig\
140 :$GST/orc\
141 :$GST/farsight2\
142 :$GST/libnice/nice\
143 ${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
144
145 export GST_PLUGIN_PATH="\
146 $GST/gstreamer/plugins\
147 :$GST/gst-plugins-base/ext\
148 :$GST/gst-plugins-base/gst\
149 :$GST/gst-plugins-base/sys\
150 :$GST/gst-plugins-good/ext\
151 :$GST/gst-plugins-good/gst\
152 :$GST/gst-plugins-good/sys\
153 :$GST/gst-plugins-ugly/ext\
154 :$GST/gst-plugins-ugly/gst\
155 :$GST/gst-plugins-ugly/sys\
156 :$GST/gst-plugins-bad/ext\
157 :$GST/gst-plugins-bad/gst\
158 :$GST/gst-plugins-bad/sys\
159 :$GST/gst-libav/ext/\
160 :$GST/gst-ffmpeg/ext/\
161 :$GST/gst-omx/omx/.libs\
162 :$GST/clutter-gst/clutter-gst/.libs\
163 :$GST/gstreamer-vaapi/gst/vaapi/.libs\
164 :$GST/plugins\
165 :$GST/farsight2/gst\
166 :$GST/farsight2/transmitters\
167 :$GST/libnice/gst\
168 :$GST/gst-rpicamsrc/src/.libs\
169 :$GST/gst-rtsp-server/gst/rtsp-sink/.libs\
170 :$GST/gst-editing-services/plugins/nle/.libs\
171 ${GST_PLUGIN_PATH:+:$GST_PLUGIN_PATH}"
172
173 export GST_PRESET_PATH="\
174 $GST/gst-plugins-good/gst/equalizer/\
175 :$GST/gst-plugins-good/gst/equalizer\
176 :$GST/gst-plugins-good/ext/vpx/\
177 :$GST/gst-plugins-ugly/ext/x264\
178 :$GST/gst-plugins-ugly/ext/amrnb\
179 :$GST/gst-plugins-bad/gst/freeverb\
180 :$GST/gst-plugins-bad/ext/voamrwbenc\
181 ${GST_PRESET_PATH:+:$GST_PRESET_PATH}"
182
183 # don't use any system-installed plug-ins at all
184 export GST_PLUGIN_SYSTEM_PATH=
185 # set our registry somewhere else so we don't mess up the registry generated
186 # by an installed copy
187 rm -f $GST/gstreamer/registry.xml 2>/dev/null
188 export GST_REGISTRY=$GST/gstreamer/registry.dat
189 # Point at the uninstalled plugin scanner
190 export GST_PLUGIN_SCANNER=$GST/gstreamer/libs/gst/helpers/gst-plugin-scanner
191 # Point at the uninstalled PTP helper
192 export GST_PTP_HELPER=$GST/gstreamer/libs/gst/helpers/.libs/gst-ptp-helper
193
194 # once MANPATH is set, it needs at least an "empty"component to keep pulling
195 # in the system-configured man paths from man.config
196 # this still doesn't make it work for the uninstalled case, since man goes
197 # look for a man directory "nearby" instead of the directory I'm telling it to
198 export MANPATH=$GST/gstreamer/tools:$GST_PREFIX/share/man:$GST/gst-editing-services/docs/man/:$MANPATH
199 if [ -z "$PYTHON" ]; then PYTHON="python"; fi
200 pythonver=`$PYTHON -c "import sys; print (sys.version[:3])"`
201 pythonsites=`$PYTHON -c "import site; print(':'.join(site.getsitepackages()))"`
202 export PYTHONPATH="${PYTHONPATH}:${pythonsites}:${GST}/gst-python"
203
204 # clutter-gst
205 export PKG_CONFIG_PATH=$GST/clutter-gst:$PKG_CONFIG_PATH
206 export LD_LIBRARY_PATH=$GST/clutter-gst/clutter-gst/.libs:$LD_LIBRARY_PATH
207 export DYLD_LIBRARY_PATH=$GST/clutter-gst/clutter-gst/.libs:$DYLD_LIBRARY_PATH
208
209 # totem-pl-parser
210 export PKG_CONFIG_PATH=$GST/totem-pl-parser:$PKG_CONFIG_PATH
211 export LD_LIBRARY_PATH=$GST/totem-pl-parser/plparse/.libs:$LD_LIBRARY_PATH
212 export DYLD_LIBRARY_PATH=$GST/totem-pl-parser/plparse/.libs:$DYLD_LIBRARY_PATH
213
214 # totem
215 export PATH=$GST/totem/src:$PATH
216
217 # gstreamer-sharp
218 export MONO_PATH=$GST/gstreamer-sharp/gstreamer-sharp:$MONO_PATH
219 export LD_LIBRARY_PATH=$GST/gstreamer-sharp/gstreamer-sharp/glue/.libs:$LD_LIBRARY_PATH
220 export DYLD_LIBRARY_PATH=$GST/gstreamer-sharp/gstreamer-sharp/glue/.libs:$DYLD_LIBRARY_PATH
221
222 # gst-devtools/validate
223 export PATH=$GST/gst-devtools/validate/tools:$PATH
224 export PKG_CONFIG_PATH=$GST/gst-devtools/validate/pkgconfig:$PKG_CONFIG_PATH
225 export GST_VALIDATE_SCENARIOS_PATH=$GST/gst-devtools/validate/data/scenarios:$GST_VALIDATE_SCENARIOS_PATH
226 export GST_VALIDATE_APPS_DIR=$GST_VALIDATE_APPS_DIR:$GST/gst-editing-services/tests/validate/
227 export GST_VALIDATE_PLUGIN_PATH=$GST_VALIDATE_PLUGIN_PATH:$GST/gst-devtools/validate/plugins/
228 export GIO_EXTRA_MODULES=$GST/prefix/lib/gio/modules:$GIO_EXTRA_MODULES
229
230 if [ -d "$GST/gst-libav" -a -d "$GST/gst-ffmpeg" ]; then
231   echo
232   echo "====================================================================="
233   echo " You have both an uninstalled gst-ffmpeg checkout and a gst-libav"
234   echo " checkout. You need to remove one of those. You should remove"
235   echo
236   echo "   $GST/gst-ffmpeg"
237   echo
238   echo " since gst-libav replaces gst-ffmpeg."
239   echo "====================================================================="
240   echo
241 fi
242
243 # if we got a command, run it, else start a shell
244 if test ! -z "$1";
245 then
246   $@
247   exit $?
248 fi
249
250 # set up prompt to help us remember we're in a subshell, cd to
251 # the gstreamer base dir and start $SHELL
252 cd $GST
253 shell=$SHELL
254 if test "x$SHELL" = "x/bin/bash"
255 then
256   # debian/ubuntu resets our PS1.  bastards.
257   shell="$SHELL --noprofile"
258 fi
259 PS1="[gst-$VERSION] $PS1" $shell
260