1#!/bin/bash
2# This is a script template to run Avidemux Jobs on Linux without installation.
3# Adjust variables appropriately, copy it to a location included in $PATH
4# and make it executable.
5
6# TOPSRCDIR must match the location of the Avidemux source tree,
7# default: ${HOME}/avidemux2
8TOPSRCDIR="${HOME}/avidemux2"
9
10# PREFIX must match the prefix passed to bootStrap.bash when compiling Avidemux,
11# default when no prefix specified: /usr
12PREFIX="/usr"
13
14# Avidemux version
15MAJOR="2"
16MINOR="7"
17
18fail()
19{
20    echo "$1. Aborting."
21    exit 1
22}
23HERE="${TOPSRCDIR}/install${PREFIX}"
24CORECONFIG="${HERE}/include/avidemux/${MAJOR}.${MINOR}/ADM_coreConfig.h"
25if ! [ -e "${CORECONFIG}" ]; then
26    fail "${CORECONFIG} not found, can't determine the relative library directory"
27fi
28LIBDIR=$(grep ADM_RELATIVE_LIB_DIR "${CORECONFIG}" | cut -f 3 -d " " | sed -e 's/^"//' -e 's/"$//')
29if [ -z "${LIBDIR}" ]; then
30    fail "ADM_RELATIVE_LIB_DIR empty or not set in ${CORECONFIG}"
31fi
32
33if ! [ -e "${HERE}/lib" ]; then
34    ln -s "${HERE}/${LIBDIR}" "${HERE}/lib"
35fi
36
37export LD_LIBRARY_PATH="${HERE}/${LIBDIR}:${LD_LIBRARY_PATH}"
38"${HERE}/bin/avidemux3_jobs_qt5" --portable
39
40