summaryrefslogtreecommitdiff
path: root/scripts/get-and-build-libndpi.sh
blob: 945dcf7b37da11cb0d2e3729d7c5cc75fd223b77 (plain)
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
#!/usr/bin/env bash

set -e

LOCKFILE="$(realpath "${0}").lock"
touch "${LOCKFILE}"
exec 42< "${LOCKFILE}"
flock -x -n 42 || {
    printf '%s\n' "Could not aquire file lock for ${0}. Already running instance?" >&2;
    exit 1;
}

set -x

cd "$(dirname "${0}")/.."
if [ -d ./.git ]; then
    git submodule update --init ./libnDPI
fi

cd ./libnDPI
DEST_INSTALL="${DEST_INSTALL:-$(realpath ./install)}"
MAKE_PROGRAM="${MAKE_PROGRAM:-make -j4}"
./autogen.sh --prefix="${DEST_INSTALL}" --with-only-libndpi
${MAKE_PROGRAM} install

rm -f "${LOCKFILE}"