pitivi-git-environment.sh 20 KB
Newer Older
1
#!/bin/bash -i
2
# Indentation = 4 spaces.
3
#
Alexandru Băluț's avatar
Alexandru Băluț committed
4
# This script sets up the environment to use and develop Pitivi.
5
#
Alexandru Băluț's avatar
Alexandru Băluț committed
6 7 8
# The git projects will be cloned in ~/pitivi-git, unless you specify
# a different directory, for example:
#     MYPITIVI=~/dev/pitivi pitivi-git-environment.sh
9
#
Alexandru Băluț's avatar
Alexandru Băluț committed
10 11 12
# LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, PKG_CONFIG_PATH are set to
# prefer the cloned git projects and to also allow using the installed ones.

13
MYPITIVI=${MYPITIVI:-$HOME/pitivi-git}
Alexandru Băluț's avatar
Alexandru Băluț committed
14

15 16 17
# Change DEFAULT_GST_VERSION to a number greater than the last known release
# if you prefer to work with the "master" branch of everything.
# In that case, the script will automatically "pull --rebase" modules.
18
DEFAULT_GST_VERSION="1.8.0"
19

20 21
GST_RELEASE_TAG=${GST_RELEASE_TAG:-$DEFAULT_GST_VERSION}
GST_MIN_VERSION=${GST_MIN_VERSION:-$DEFAULT_GST_VERSION}
Alexandru Băluț's avatar
Alexandru Băluț committed
22

23 24
# If you care about building the GStreamer/GES developer API documentation:
BUILD_DOCS=false
Alexandru Băluț's avatar
Alexandru Băluț committed
25

26 27 28
# Here are some dependencies for building GStreamer and GES. If they're missing,
# we'll fetch the git repositories at the given version tag and compile.
# If you set those variables to "master", it will grab the latest dev version
29 30
GLIB_RELEASE_TAG="2.34.2" # "gobject-introspection" needs glib > 2.32
PYGOBJECT_RELEASE_TAG="3.8.0"
31 32
GOBJECT_INTROSPECTION_MINIMUM_VERSION="1.34.2"
GOBJECT_INTROSPECTION_RELEASE_TAG="GOBJECT_INTROSPECTION_$(echo $GOBJECT_INTROSPECTION_MINIMUM_VERSION | tr '.' '_')"
33

Dmitrii Petukhov's avatar
Dmitrii Petukhov committed
34 35
# If you want to run the development version of Pitivi:
export PITIVI_DEVELOPMENT=1
Alexandru Băluț's avatar
Alexandru Băluț committed
36

37 38 39 40
#
# Everything below this line shouldn't be edited!
#

41 42
export PITIVI_PYTHON=python3
export PYTHON=${PITIVI_PYTHON}
43

44 45 46 47 48 49 50
# The root of the Pitivi dev environment.
PITIVI=$MYPITIVI

# Some built libraries might be installed here,
# not the normal $MODULES though, see below.
PITIVI_PREFIX=$PITIVI/prefix

51
if ! pkg-config glib-2.0 --atleast-version=$GLIB_RELEASE_TAG; then
52 53
    echo "Using a local build of glib"
    MODULE_GLIB="glib"
54
else
55
    echo "Using system-wide glib"
56
fi
57 58 59

MODULES_CORE=""
if ! pkg-config gobject-introspection-1.0 --atleast-version=$GOBJECT_INTROSPECTION_MINIMUM_VERSION; then
60 61
    echo "Using a local build of gobject-introspection-1.0"
    MODULES_CORE="${MODULE_GLIB} gobject-introspection"
62
else
63
    echo "Using system-wide gobject-introspection-1.0"
64
fi
65

66
if $PYTHON -c "import gi; gi.check_version('${PYGOBJECT_RELEASE_TAG}')" &> /dev/null; then
67 68 69
    echo "Using system-wide pygobject"
    # Hack around PYTHONPATH ordering to support gi overrides
    PYTHONPATH=$($PYTHON -c 'import gi; print(gi._overridesdir)')/../../:$PYTHONPATH
70
else
71 72 73
    echo "Using a local build of pygobject"
    PYTHONPATH=$MYPITIVI/pygobject:$PYTHONPATH
    MODULES_CORE="${MODULES_CORE} pygobject"
74
fi
Alexandru Băluț's avatar
Alexandru Băluț committed
75

76
PYTHONPATH=$MYPITIVI/pitivi:$PYTHONPATH
77 78
GI_TYPELIB_PATH=$MYPITIVI/pitivi/pitivi/libpitivi:$GI_TYPELIB_PATH
LD_LIBRARY_PATH=$MYPITIVI/pitivi/pitivi/libpitivi/.libs:${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
79

80 81 82
EXTRA_PATH="$PITIVI/pitivi/bin"
EXTRA_PATH="$EXTRA_PATH:$PITIVI/gst-editing-services/tools"
EXTRA_PATH="$EXTRA_PATH:$PITIVI/gst-editing-services/tests/tools"
83
EXTRA_PATH="$EXTRA_PATH:$PITIVI/gst-transcoder/build"
84

85 86 87
# The following decision has to be made before we've set any env variables,
# otherwise the script will detect our "gst uninstalled" and think it's the
# system-wide install.
88
if pkg-config gstreamer-1.0 --atleast-version=$GST_MIN_VERSION --print-errors; then
Jeff Fortin Tam's avatar
Jeff Fortin Tam committed
89
    MODULES="gst-editing-services gst-python"
90
else
Thibault Saunier's avatar
Thibault Saunier committed
91
    MODULES="gstreamer gst-plugins-base gst-plugins-good gst-plugins-ugly gst-plugins-bad gst-ffmpeg gst-editing-services gst-python gst-transcoder"
92 93
    EXTRA_PATH="$EXTRA_PATH:$PITIVI/gstreamer/tools"
    EXTRA_PATH="$EXTRA_PATH:$PITIVI/gst-plugins-base/tools"
94
fi
95 96
EXTRA_PATH="$EXTRA_PATH:$PITIVI/gst-devtools/validate/tools"
EXTRA_PATH="$EXTRA_PATH:$PITIVI_PREFIX/bin"
97

98 99
# Make the built tools available.
export PATH="$EXTRA_PATH:$PATH"
100

101
# /some/path: makes the dynamic linker look in . too, so avoid this
102 103 104
LD_LIBRARY_PATH=$PITIVI_PREFIX/lib:${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
DYLD_LIBRARY_PATH=$PITIVI_PREFIX/lib:${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}
GI_TYPELIB_PATH=$PITIVI_PREFIX/share/gir-1.0:${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}
105
export PKG_CONFIG_PATH="$PITIVI_PREFIX/lib/pkgconfig:$PITIVI/pygobject:$PKG_CONFIG_PATH"
106 107


108
if pkg-config gstreamer-1.0 --atleast-version=$GST_MIN_VERSION --print-errors; then
109
    echo "Using system-wide GStreamer 1.0"
110
else
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
    echo "Using a local build of GStreamer 1.0"
    # GStreamer ffmpeg libraries
    for path in libavformat libavutil libavcodec libpostproc libavdevice; do
        LD_LIBRARY_PATH=$PITIVI/gst-ffmpeg/gst-libs/ext/ffmpeg/$path:$LD_LIBRARY_PATH
        DYLD_LIBRARY_PATH=$PITIVI/gst-ffmpeg/gst-libs/ext/ffmpeg/$path:$DYLD_LIBRARY_PATH
    done

    # GStreamer plugins base libraries
    for path in app audio cdda fft interfaces pbutils netbuffer riff rtp rtsp sdp tag utils video; do
        LD_LIBRARY_PATH=$PITIVI/gst-plugins-base/gst-libs/gst/$path/.libs:$LD_LIBRARY_PATH
        DYLD_LIBRARY_PATH=$PITIVI/gst-plugins-base/gst-libs/gst/$path/.libs:$DYLD_LIBRARY_PATH
        GI_TYPELIB_PATH=$PITIVI/gst-plugins-base/gst-libs/gst/$path:$GI_TYPELIB_PATH
    done

    # GStreamer plugins bad libraries
    for path in basecamerabinsrc codecparsers uridownloader egl gl insertbin interfaces mpegts; do
        LD_LIBRARY_PATH=$PITIVI/gst-plugins-bad/gst-libs/gst/$path/.libs:$LD_LIBRARY_PATH
        DYLD_LIBRARY_PATH=$PITIVI/gst-plugins-bad/gst-libs/gst/$path/.libs:$DYLD_LIBRARY_PATH
        GI_TYPELIB_PATH=$PITIVI/gst-plugins-bad/gst-libs/gst/$path:$GI_TYPELIB_PATH
    done

    # GStreamer core libraries
    for path in base net check controller; do
        LD_LIBRARY_PATH=$PITIVI/gstreamer/libs/gst/$path/.libs:$LD_LIBRARY_PATH
        DYLD_LIBRARY_PATH=$PITIVI/gstreamer/libs/gst/$path/.libs:$DYLD_LIBRARY_PATH
        GI_TYPELIB_PATH=$PITIVI/gstreamer/libs/gst/$path:$GI_TYPELIB_PATH
    done

    LD_LIBRARY_PATH=$PITIVI/gstreamer/gst/.libs:$LD_LIBRARY_PATH
    DYLD_LIBRARY_PATH=$PITIVI/gstreamer/gst/.libs:$DYLD_LIBRARY_PATH
    GI_TYPELIB_PATH=$PITIVI/gstreamer/gst:$GI_TYPELIB_PATH

    LD_LIBRARY_PATH=$PITIVI/gst-devtools/validate/gst/validate/.libs:$LD_LIBRARY_PATH
    DYLD_LIBRARY_PATH=$PITIVI/gst-devtools/validate/gst/validate/.libs:$DYLD_LIBRARY_PATH
    GI_TYPELIB_PATH=$PITIVI/gst-devtools/validate/gst/validate/:$GI_TYPELIB_PATH
    export GST_VALIDATE_APPS_DIR=$GST_VALIDATE_APPS_DIR:$PITIVI/gst-editing-services/tests/validate/
    export GST_VALIDATE_SCENARIOS_PATH=$PITIVI/gst-devtools/validate/data/scenarios/:$GST_VALIDATE_SCENARIOS_PATH
148
    export GST_VALIDATE_PLUGIN_PATH=$GST_VALIDATE_PLUGIN_PATH:$PITIVI/gst-devtools/validate/plugins/
Thibault Saunier's avatar
Thibault Saunier committed
149
    export GST_ENCODING_TARGET_PATH=$GST_VALIDATE_PLUGIN_PATH:$PITIVI/pitivi/data/encoding-profiles/
150 151

    export PKG_CONFIG_PATH="$PITIVI/gstreamer/pkgconfig\
152 153 154 155 156
:$PITIVI/gst-plugins-base/pkgconfig\
:$PITIVI/gst-plugins-good/pkgconfig\
:$PITIVI/gst-plugins-ugly/pkgconfig\
:$PITIVI/gst-plugins-bad/pkgconfig\
:$PITIVI/gst-ffmpeg/pkgconfig\
157
:$PITIVI/gst-editing-services/pkgconfig\
158
:$PITIVI/gst-devtools/validate/pkgconfig\
159
:${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
160

161
    export GST_PLUGIN_PATH="\
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
$PITIVI/gstreamer/plugins\
:$PITIVI/gst-plugins-base/ext\
:$PITIVI/gst-plugins-base/gst\
:$PITIVI/gst-plugins-base/sys\
:$PITIVI/gst-plugins-good/ext\
:$PITIVI/gst-plugins-good/gst\
:$PITIVI/gst-plugins-good/sys\
:$PITIVI/gst-plugins-ugly/ext\
:$PITIVI/gst-plugins-ugly/gst\
:$PITIVI/gst-plugins-ugly/sys\
:$PITIVI/gst-plugins-bad/ext\
:$PITIVI/gst-plugins-bad/gst\
:$PITIVI/gst-plugins-bad/sys\
:$PITIVI/gst-ffmpeg/ext/\
:$PITIVI/gst-openmax/omx/.libs\
:$PITIVI/gst-omx/omx/.libs\
:$PITIVI/gst-plugins-gl/gst/.libs\
:$PITIVI/clutter-gst/clutter-gst/.libs\
:$PITIVI/plugins\
:$PITIVI/farsight2/gst\
:$PITIVI/farsight2/transmitters\
:$PITIVI/libnice/gst\
184
:$PITIVI/gst-editing-services/plugins/nle/\
185
:$PITIVI/gst-editing-services/plugins/ges/\
Thibault Saunier's avatar
Thibault Saunier committed
186
:$PITIVI/gst-transcoder/build/\
187
:${GST_PLUGIN_PATH:+:$GST_PLUGIN_PATH}"
188

189 190 191 192 193 194 195 196 197
export GST_PRESET_PATH="\
$PITIVI/gst-plugins-good/gst/equalizer/\
:$PITIVI/gst-plugins-good/gst/equalizer\
:$PITIVI/gst-plugins-good/ext/jpeg\
:$PITIVI/gst-plugins-good/ext/vpx/\
:$PITIVI/gst-plugins-ugly/ext/x264\
:$PITIVI/gst-plugins-ugly/ext/amrnb\
:$PITIVI/gst-plugins-bad/gst/freeverb\
:$PITIVI/gst-plugins-bad/ext/voamrwbenc\
Thibault Saunier's avatar
Thibault Saunier committed
198 199
:$PITIVI/pitivi/data/videopresets/\
:$PITIVI/pitivi/data/audiopresets/\
200 201
${GST_PRESET_PATH:+:$GST_PRESET_PATH}"

202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
    # don't use any system-installed plug-ins at all
    export GST_PLUGIN_SYSTEM_PATH=
    # set our registry somewhere else so we don't mess up the registry generated
    # by an installed copy
    export GST_REGISTRY=$PITIVI/gstreamer/registry.dat
    # Point at the uninstalled plugin scanner
    export GST_PLUGIN_SCANNER=$PITIVI/gstreamer/libs/gst/helpers/gst-plugin-scanner

    # once MANPATH is set, it needs at least an "empty"component to keep pulling
    # in the system-configured man paths from man.config
    # this still doesn't make it work for the uninstalled case, since man goes
    # look for a man directory "nearby" instead of the directory I'm telling it to
    export MANPATH=$PITIVI/gstreamer/tools:$PITIVI_PREFIX/share/man:$PITIVI/gst-editing-services/docs/man/:$MANPATH

    export GST_VALIDATE_SCENARIOS_PATH=$PITIVI/gst-devtools/validate/data/scenarios/
217 218 219 220 221 222 223
fi

# And anyway add GStreamer editing services library
export LD_LIBRARY_PATH=$PITIVI/gst-editing-services/ges/.libs:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$PITIVI/gst-editing-services/ges/.libs:$DYLD_LIBRARY_PATH
export PATH=$PITIVI/gst-editing-services/tools:$PATH
GI_TYPELIB_PATH=$PITIVI/gst-editing-services/ges:$GI_TYPELIB_PATH
224
GI_TYPELIB_PATH=$PITIVI_PREFIX/share/gir-1.0:${GI_TYPELIB_PATH:+:$GI_TYPELIB_PATH}:/usr/lib64/girepository-1.0:/usr/lib/girepository-1.0
225

Thibault Saunier's avatar
Thibault Saunier committed
226 227 228 229 230 231
# And anyway add GstTranscoder
export LD_LIBRARY_PATH=$PITIVI/gst-transcoder/build/:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$PITIVI/gst-transcoder/build/:$DYLD_LIBRARY_PATH
export PATH=$PITIVI/gst-transcoder/build/:$PATH
GI_TYPELIB_PATH=$PITIVI/gst-transcoder/build/:$GI_TYPELIB_PATH

232
# And python
233
PYTHONPATH=$PYTHONPATH:$MYPITIVI/gst-python:$MYPITIVI/gst-editing-services/bindings/python
234 235
export LD_LIBRARY_PATH=$PITIVI/pygobject/gi/.libs:$LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=$PITIVI/pygobject/gi/.libs:$DYLD_LIBRARY_PATH
236

237 238 239
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH
export GI_TYPELIB_PATH
240
export PYTHONPATH
241

242

243
# Force build to happen automatically if the folders are missing
244 245 246
# or if the --build parameter is used, or --force-autogen.
# The difference being --force-autogen forces autogen.sh to be run,
# whereas --build only uses it the first time
247
ready_to_run=1
248
force_autogen=1
249 250
build=false

251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
for i in "$@"; do
    case $i in
        --build)
        force_autogen=0
        ready_to_run=0
        shift
        ;;

        --force-autogen)
        force_autogen=1
        ready_to_run=0
        shift
        ;;

        --devel)
        MODULES="${MODULES} gst-devtools"
        shift
        ;;

        --help)
        cat <<END
272 273 274 275 276 277

--build            - Update and rebuild the needed libraries, if any.
--force-autogen    - Run autogen before building stuff.
--devel            - Also build gst-devtools.

END
278 279 280
        exit
        ;;
    esac
281 282 283 284
done



285

286 287 288 289
if test ! -d $PITIVI; then
    echo "===================================================================="
    echo "Creating initial set of folders in $PITIVI"
    echo "===================================================================="
290

291 292
    echo "New $PITIVI directory"
    mkdir $PITIVI/
293
    if [ $? -ne 0 ]; then
294
        exit 1
295
    fi
296 297
    echo "New $PITIVI_PREFIX directory"
    mkdir $PITIVI_PREFIX
298
    if [ $? -ne 0 ]; then
299
        exit 1
300
    fi
301
    ready_to_run=0
302
fi
303

304
if [ "$ready_to_run" != "1" ]; then
305
    for m in $MODULES_CORE; do
306
        cd $PITIVI
307 308 309 310 311 312 313 314 315 316 317 318
        echo ""
        echo "Building $m"
        # If the folder doesn't exist, check out the module. Later on, we will
        # update it anyway.
        if test ! -d $m; then
            git clone git://git.gnome.org/$m
            if [ $? -ne 0 ]; then
                echo "Could not download the code for $m ; result: $?"
                exit 1
            fi
        fi
        cd $m
319
        git fetch origin  # In case you haven't got the latest release tags...
320
        # Take into account whether the user wants stable releases or "master"
321
        if [ $m = "glib" ]; then
322 323
            # Silly hack for the fact that glib changes the "mkinstalldirs" file
            # when compiling, which prevents git pull --rebase from working
324
            git checkout -- mkinstalldirs
325
            git checkout $GLIB_RELEASE_TAG
326
            if [ $GLIB_RELEASE_TAG = "master" ]; then
327 328 329 330 331
                git pull --rebase
                if [ $? -ne 0 ]; then
                    exit 1
                fi
            fi
332
        elif [ $m = "gobject-introspection" ]; then
333
            git checkout $GOBJECT_INTROSPECTION_RELEASE_TAG
334
            if [ $GOBJECT_INTROSPECTION_RELEASE_TAG = "master" ]; then
335 336 337 338 339
                git pull --rebase
                if [ $? -ne 0 ]; then
                    exit 1
                fi
            fi
340 341
            # Workaround https://bugzilla.gnome.org/show_bug.cgi?id=679438
            export PYTHON=$(which python2)
342
        elif [ $m = "pygobject" ]; then
343
            git checkout $PYGOBJECT_RELEASE_TAG
344
            if [ $PYGOBJECT_RELEASE_TAG = "master" ]; then
345 346 347 348 349 350 351 352 353 354
                git pull --rebase
                if [ $? -ne 0 ]; then
                    exit 1
                fi
            fi
        else
            git pull --rebase
            if [ $? -ne 0 ]; then
                exit 1
            fi
355 356 357 358
        fi


        # Now compile that module
359
        if test ! -f ./configure || [ "$force_autogen" = "1" ]; then
360
            ./autogen.sh --prefix=$PITIVI/prefix --disable-gtk-doc --with-python=$PYTHON
361
            if [ $? -ne 0 ]; then
362 363
                echo "Could not run autogen for $m ; result: $?"
                exit 1
364
            fi
365 366 367
        else
            echo "autogen has already been run for $m, not running it again"
        fi
368 369 370 371 372 373 374 375 376 377 378 379 380 381

        make
        if [ $? -ne 0 ]; then
            echo "Could not run make for $m ; result: $?"
            exit 1
        fi

        if [ "$m" != "pygobject" ]; then
            make install
            if [ $? -ne 0 ]; then
                echo "Could not install $m ; result: $?"
                exit 1
            fi
        fi
382 383

        export PYTHON=${PITIVI_PYTHON}
384 385 386
    done

    # Build all the necessary gstreamer modules.
387
    for m in $MODULES; do
388 389
        cd $PITIVI
        echo
390 391 392 393
        echo "Building $m"
        # If the folder doesn't exist, check out the module. Later on, we will
        # update it anyway.
        if test ! -d $m; then
Thibault Saunier's avatar
Thibault Saunier committed
394
          if [ "$m" == "gst-transcoder" ]; then
395
            git clone https://github.com/pitivi/gst-transcoder.git
Thibault Saunier's avatar
Thibault Saunier committed
396 397 398 399
          else
            git clone git://anongit.freedesktop.org/gstreamer/$m
          fi

400 401 402 403
          if [ $? -ne 0 ]; then
              echo "Could not checkout $m ; result: $?"
              exit 1
          fi
404 405
        fi

406
        if [ $m = "gst-devtools" ]; then
407 408 409 410 411
          cd $m/validate
        else
          cd $m
        fi

412
        git fetch origin  # In case you haven't got the latest release tags...
413 414 415
        git checkout $GST_RELEASE_TAG
        if [ $? -ne 0 ]; then
            echo "Could not run checkout $GST_RELEASE_TAG for $m ; result: $?"
416 417 418 419 420 421
            echo 'Trying "master" instead...'
            git checkout master && git pull --rebase
            if [ $? -ne 0 ]; then
                echo "Checkout and rebase failed, aborting"
                exit 1
            fi
422
        fi
423
        # Silly hack for the fact that the version-controlled po/ files are
424 425
        # changed during compilation of the "gstreamer" and "gst-plugins-base"
        # modules, which prevents git pull --rebase from working
426
        if [ $m = "gstreamer" ] || [ $m = "gst-plugins-base" ]; then
427 428
            git checkout -- po
        fi
429 430
        # Another similar hack because gst-plugins-bad keeps changing
        # common/ and win32/common/:
431
        if [ $m = "gst-plugins-bad" ]; then
432 433 434 435
            git checkout -- common
            git checkout -- win32
        fi
        # Yep, another temporary workaround:
436
        if [ $m = "gst-editing-services" ]; then
437 438 439
            git checkout -- acinclude.m4
        fi

Thibault Saunier's avatar
Thibault Saunier committed
440 441 442 443 444 445 446 447 448 449 450 451 452 453
        needs_configure="0"
        if [ "$force_autogen" = "1" ]; then
            needs_configure="1"
        elif [ "$m" == "gst-transcoder" ]; then
            if test ! -f build/build.ninja; then
                needs_configure='1'
            fi
        elif test ! -f ./configure; then
            needs_configure='1'
        fi

        if [ "$needs_configure" = "1" ]; then
            if [ "$m" == "gst-transcoder" ]; then
                ./configure
454
            else
Thibault Saunier's avatar
Thibault Saunier committed
455 456 457 458 459 460 461 462 463 464
                # Allow passing per-module arguments when running autogen.
                # For example, specify the following environment variable
                # to pass --disable-eglgles to gst-plugins-bad's autogen.sh:
                #   gst_plugins_bad_AUTOGEN_EXTRA="--disable-eglgles"
                EXTRA_VAR="$(echo $m | sed "s/-/_/g")_AUTOGEN_EXTRA"
                if $BUILD_DOCS; then
                    ./autogen.sh ${!EXTRA_VAR}
                else
                    ./autogen.sh --disable-gtk-doc --disable-docbook ${!EXTRA_VAR}
              fi
465 466
            fi
            if [ $? -ne 0 ]; then
467 468
                echo "Could not run autogen for $m ; result: $?"
                exit 1
469
            fi
470 471 472
        else
            echo "autogen has already been run for $m, not running it again"
        fi
473 474 475 476 477 478 479 480

        make
        if [ $? -ne 0 ]; then
            echo "Could not compile $m ; result: $?"
            exit 1
        fi
    done

Jeff Fortin Tam's avatar
Jeff Fortin Tam committed
481
    # And obviously ... Pitivi itself
482
    cd $PITIVI
483 484
    if test ! -d $PITIVI/pitivi; then
        git clone git://git.gnome.org/pitivi
485
    fi
486

487
    cd pitivi
488
    if test ! -f ./configure || [ "$force_autogen" = "1" ]; then
489
        ./autogen.sh
490 491 492 493
        if [ $? -ne 0 ]; then
            echo "Could not run autogen for Pitivi ; result: $?"
            exit 1
        fi
494
    else
495
        echo "autogen has already been run for Pitivi, not running it again"
496 497
    fi
    make
498 499 500 501 502 503 504
    ready_to_run=1
    echo "===================================================================="
    echo "                   BATTLECRUISER OPERATIONAL                        "
    echo "                          >(°)__/                                   "
    echo "                           (_~_/                                    "
    echo "                         ~~~~~~~~~~~~                               "
    echo "===================================================================="
505 506
fi

507

508

509 510 511
if [ "$ready_to_run" = "1" ]; then
    # Change the looks of the prompt, to help us remember we're in the
    # Pitivi dev environment.
512

513
    if [[ "${BASH_SOURCE[0]}" != "${0}" ]]; then
514 515
        echo "pitivi-git environment is being sourced"
        export PS1="[ptv] $PS1"
516
    else
517 518
        if [ -n "$*" ]; then
            /bin/bash -c "$*"
519
        else
520 521
            function generate_path_and_completion_calls {
                echo "export PATH=$EXTRA_PATH:\$PATH"
522 523 524 525 526 527 528
                if [[ -d $MYPITIVI/gstreamer ]]; then
                    echo "source $MYPITIVI/gstreamer/data/completions/gst-launch-1.0"
                    echo "source $MYPITIVI/gstreamer/data/completions/gst-inspect-1.0"
                fi
                if [[ -d $MYPITIVI/gst-editing-services ]]; then
                    echo "source $MYPITIVI/gst-editing-services/data/completions/ges-launch-1.0"
                fi
529 530 531 532 533 534 535 536 537
            }

            cd $PITIVI/pitivi
            if [ $SHELL = "/bin/zsh" ]; then
                export ZDOTDIR=$MYPITIVI/.zdotdir
                mkdir -p $ZDOTDIR
                cp ~/.zshrc $ZDOTDIR
                echo "autoload -Uz bashcompinit; bashcompinit" >> $ZDOTDIR/.zshrc
                generate_path_and_completion_calls >> $ZDOTDIR/.zshrc
538
                echo "PROMPT=[ptv]\ \$PROMPT" >> $ZDOTDIR/.zshrc
539 540 541 542 543 544 545 546 547 548
                zsh
            elif [ $SHELL = "/bin/bash" ]; then
                RCFILE=$MYPITIVI/.bashrc
                cp ~/.bashrc $RCFILE
                echo "export PS1=[ptv]\ \$PS1" >> $RCFILE
                generate_path_and_completion_calls >> $RCFILE
                /bin/bash --rcfile $RCFILE
            else
                PITIVI_ENV="[ptv]" $SHELL
            fi
549
        fi
550
    fi
551
fi