scripts: check for git in create-uninstalled-setup.sh as well
[platform/upstream/gstreamer.git] / scripts / create-uninstalled-setup.sh
1 #!/bin/sh
2 # ----------------------------------------------------------------------------
3 #
4 # create-uninstalled-setup.sh
5 #
6 # Little shell script that creates a fresh GStreamer uninstalled setup in
7 # your home directory.
8 #
9 # ----------------------------------------------------------------------------
10 #
11 # Copyright (C) 2011-2015 Tim-Philipp Müller <tim centricular net>
12 #
13 # This script is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU Library General Public
15 # License as published by the Free Software Foundation; either
16 # version 2 of the License, or (at your option) any later version.
17 #
18 # This library is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 # Library General Public License for more details.
22 #
23 # You should have received a copy of the GNU Library General Public
24 # License along with this library; if not, write to the
25 # Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
26 # Boston, MA 02110-1301, USA.
27 #
28 # ----------------------------------------------------------------------------
29
30 set -e
31
32 # set BRANCH to e.g. "1.2" to track the stable 1.2 branch instead of master
33 BRANCH="master"
34
35 # set to "ssh" if you have a developer account and ssh access
36 GIT_ACCESS="anongit"
37
38 # re-use and reference local master branch checkout if one already exists
39 # (saves network bandwidth)
40 REUSE_EXISTING_MASTER_CHECKOUT="true"
41
42 # git modules to clone
43 MODULES="gstreamer gst-plugins-base gst-plugins-good gst-plugins-ugly gst-plugins-bad gst-libav"
44
45 # note: we use ~/gst because that's what the gst-uninstalled script
46 # uses by default, so don't just change that to something else
47 UNINSTALLED_ROOT=~/gst
48
49 echo "==========================================================================================="
50 echo "Creating new GStreamer uninstalled environment for branch $BRANCH in $UNINSTALLED_ROOT ... "
51 echo "==========================================================================================="
52
53 mkdir -p $UNINSTALLED_ROOT
54 mkdir -p $UNINSTALLED_ROOT/$BRANCH
55
56 mkdir -p $UNINSTALLED_ROOT/$BRANCH/prefix
57
58
59 echo ""
60 echo "Checking basic build tools and dependencies are installed..."
61 echo ""
62
63 if ! pkg-config --version 2>/dev/null >/dev/null; then
64   DEPS_OK="no"
65 elif ! pkg-config --exists glib-2.0 orc-0.4 2>/dev/null >/dev/null; then
66   DEPS_OK="no"
67 elif ! bison --version 2>/dev/null >/dev/null; then
68   DEPS_OK="no"
69 elif ! flex --version 2>/dev/null >/dev/null; then
70   DEPS_OK="no"
71 elif ! git --version 2>/dev/null >/dev/null; then
72   DEPS_OK="no"
73 else
74   DEPS_OK="yes"
75 fi
76
77 if test "$DEPS_OK" != "yes"; then
78 echo "==========================================================================================="
79 echo ""
80 echo "  Some very basic build tools or dependencies are missing."
81 echo ""
82 echo "  Please install the following tools: pkg-config, bison, flex, git"
83 echo ""
84 echo "  and the following libraries: GLib (libglib2.0-dev or glib2-devel)"
85 echo "                           and Orc  (liborc-0.4-dev or orc-devel)"
86 #echo "  Please visit"
87 #echo ""
88 #echo "      http://gstreamer.freedesktop.org/wiki/BuildDependenciesDebianUbuntu"
89 #echo ""
90 #echo "         or"
91 #echo ""
92 #echo "      http://gstreamer.freedesktop.org/wiki/Fedora"
93 #echo ""
94 #echo "  for instructions how to install them on Debian/Ubuntu-based systems."
95 echo ""
96 echo "==========================================================================================="
97 exit 1
98 fi
99
100
101 cd $UNINSTALLED_ROOT/$BRANCH
102
103 for m in $MODULES
104 do
105   REF=""
106   if test "$BRANCH" != "master" \
107     -a "x$REUSE_EXISTING_MASTER_CHECKOUT" = "xtrue" \
108     -a -d ../master/$m; then
109       REF="--reference=../master/$m"
110   fi
111
112   if test "$GIT_ACCESS" = "ssh"; then
113     git clone $REF ssh://git.freedesktop.org/git/gstreamer/$m
114   else
115     git clone $REF git://anongit.freedesktop.org/gstreamer/$m
116   fi
117
118   cd $m
119   if test "$BRANCH" != "master"; then
120     git checkout -b $BRANCH origin/$BRANCH
121   fi
122   git submodule init && git submodule update
123   cd ..
124 done
125
126 cd $UNINSTALLED_ROOT
127 ln -s $BRANCH/gstreamer/scripts/gst-uninstalled gst-$BRANCH
128 chmod +x gst-$BRANCH
129
130 cd ~
131
132 echo "==========================================================================================="
133 echo
134 echo "Done. Created new GStreamer uninstalled environment for branch $BRANCH in $UNINSTALLED_ROOT"
135 echo
136 echo "To enter the uninstalled environment do: cd $UNINSTALLED_ROOT; ./gst-$BRANCH"
137 echo
138 echo "To leave the uninstalled environment do: exit"
139 echo
140 echo "To check the uninstalled environment do: printenv | grep GST"
141 echo "    (loads of output = you're in the uninstalled environment)"
142 echo
143 echo "==========================================================================================="
144 echo
145 echo "Now compile all GStreamer modules one by one by first switching into"
146 echo "the uninstalled environment and then doing:"
147 echo
148 echo "    cd <MODULE>; ./autogen.sh; make"
149 echo
150 echo "First gstreamer, then gst-plugins-base, then the other modules."
151 echo "You do not need to do 'make install'"
152 echo
153 echo "==========================================================================================="
154 echo
155 echo "If your system GLib is too old, you can install a newer version"
156 echo "into --prefix=$UNINSTALLED_ROOT/$BRANCH/prefix and it should be picked up"
157 echo "by autogen.sh/configure"
158 echo
159 echo "==========================================================================================="
160 #echo
161 #echo "Also see http://gstreamer.freedesktop.org/wiki/UninstalledSetup"
162 #echo
163 #echo "==========================================================================================="
164