/
pitivi-env
executable file
·79 lines (62 loc) · 2.97 KB
/
pitivi-env
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
#!/bin/bash
# Script which must be sourced to setup the development environment.
# This has to be the first command because BASH_SOURCE[0] gets changed.
SCRIPT=${BASH_SOURCE[0]:-$0}
[[ "${BASH_SOURCE[0]}" == "$0" ]] \
&& echo "This script should not be executed but sourced like:" \
&& echo " $ . $0" \
&& echo \
&& exit 1
SCRIPT_DIR=$(dirname $(realpath $SCRIPT))
export PITIVI_REPO_DIR=$(realpath $SCRIPT_DIR/..)
export FLATPAK_ENVPATH=$(realpath $PITIVI_REPO_DIR/..)
export CURRENT_GST=$FLATPAK_ENVPATH
export PATH="$FLATPAK_ENVPATH/bin/:$PATH"
# Use ptvenv for entering or running commands in the sandbox.
alias ptvenv="$PITIVI_REPO_DIR/build/flatpak/pitivi-flatpak"
echo "Setting up the build dir of the sandbox in $FLATPAK_ENVPATH/pitivi-prefix"
ptvenv --init
if [ "$?" = "0" ]
then
echo "Sandbox ready."
echo "Setting up aliases so configuring, building takes place in the sandbox..."
# Meson sets up the build directory where ninja works.
# Consider using `setup` instead of `meson`, see below.
alias meson="ptvenv meson"
# Normally, Pitivi's mesonbuild/ directory is created when
# initializing or updating (recreating) the Flatpak sandbox.
# The initialization happens above, look for `ptvenv --init`.
# The updating happens when you run `ptvenv --update`.
# You can also create it manually if you deleted it by mistake.
# This should also be used when building dependent projects
# such as GES, etc.
alias setup="mkdir mesonbuild; ptvenv meson mesonbuild/ --prefix=/app --libdir=lib"
# Ninja builds the buildable parts of the project.
alias ninja="ptvenv ninja"
# We could get rid of these, but some devs like them.
alias build="ptvenv ninja -C mesonbuild/"
alias binstall="ptvenv ninja -C mesonbuild/ install"
alias ptvtests="ptvenv gst-validate-launcher $PITIVI_REPO_DIR/tests/ptv_testsuite.py --dump-on-failure"
# Prefer to run some binaries in the sandbox.
for i in `$PITIVI_REPO_DIR/build/flatpak/pitivi-flatpak -q ls /app/bin/`
do
alias $i="ptvenv $i"
done
alias pitivi="ptvenv $PITIVI_REPO_DIR/bin/pitivi"
echo "Installing our pre-commit git hook, for doing clean commits..."
rm -f .git/hooks/pre-commit
ln -s ../../pre-commit.hook .git/hooks/pre-commit
# Update the prompt to indicate this is the Pitivi dev env,
# unless PS1 has already been modified.
PS1_PREFIX="(ptv-flatpak)"
if [[ $PS1 != *"$PS1_PREFIX"* ]]
then
export PS1="$PS1_PREFIX $PS1"
fi
echo "===================================================================="
echo " BATTLECRUISER OPERATIONAL "
echo " >(°)__/ "
echo " (_~_/ "
echo " ~~~~~~~~~~~~ "
echo "===================================================================="
fi