Skip to content

Commit c33c1f2

Browse files
committed
Export FFmpeg path and then echo to SHELLRC
1 parent 9c7547a commit c33c1f2

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

opencvDirectInstall.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ execute () {
2424
fi
2525
}
2626

27+
# Executes first command passed &
28+
# echo's it to the file passed as second argument
29+
run_and_echo () {
30+
eval $1
31+
echo "$1" >> $2
32+
}
33+
34+
2735
if [[ -n $(echo $SHELL | grep "zsh") ]] ; then
2836
SHELLRC=~/.zshrc
2937
elif [[ -n $(echo $SHELL | grep "bash") ]] ; then
@@ -90,17 +98,17 @@ if [[ ! -n $(cat $SHELLRC | grep '# ffmpeg-build-script') ]]; then
9098
sed -i 's/execute cmake -DCMAKE_INSTALL_PREFIX:PATH=${WORKSPACE} ./execute cmake -DCMAKE_INSTALL_PREFIX:PATH=${WORKSPACE} -DBUILD_SHARED_LIBS=1 ./g' build-ffmpeg
9199

92100
AUTOINSTALL=yes ./build-ffmpeg --build
101+
93102
echo "Adding ffmpeg's libraries to LD_LIBRARY_PATH"
94103
{
95104
echo ""
96105
echo "# ffmpeg-build-script"
97-
echo "export LD_LIBRARY_PATH=$(pwd)/workspace/lib:\$LD_LIBRARY_PATH"
98-
echo "export PKG_CONFIG_PATH=$(pwd)/workspace/lib/pkgconfig:\$(pkg-config --variable pc_path pkg-config)"
99-
echo "export PKG_CONFIG_LIBDIR=$(pwd)/workspace/lib/:\$PKG_CONFIG_LIBDIR"
100-
101106
} >> $SHELLRC
107+
108+
run_and_echo "export LD_LIBRARY_PATH=$(pwd)/workspace/lib:\$LD_LIBRARY_PATH" $SHELLRC
109+
run_and_echo "export PKG_CONFIG_PATH=$(pwd)/workspace/lib/pkgconfig:\$(pkg-config --variable pc_path pkg-config)" $SHELLRC
110+
run_and_echo "export PKG_CONFIG_LIBDIR=$(pwd)/workspace/lib/:\$PKG_CONFIG_LIBDIR" $SHELLRC
102111
)
103-
source $SHELLRC
104112
fi
105113

106114
spatialPrint "GUI and openGL extensions"

0 commit comments

Comments
 (0)