summarylogtreecommitdiffstats
path: root/setup_cef.sh
blob: 27d917295e534b5a608970efc7c1c629ab6880d4 (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
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
#!/bin/bash

set -e

if [ -z "${1}" ] || ! [ -z "${2}" ]
then
    echo "ERROR: Invalid arguments"
    echo "Usage: setup_cef.sh PATCHED_CEF_TARBALL"
    exit 1
fi

CEFTARBALL="${1}"

if [ -e ./cef ]
then
    echo "./cef already exists!"
    exit 1
fi

if ! [ -f "${CEFTARBALL}" ]
then
    echo "ERROR: Given CEF tarball path '${CEFTARBALL}' is not a file"
    exit 1
fi

ARCH=`uname -m`

if [ "$ARCH" == "x86_64" ] || [[ "$ARCH" =~ ^i[3-7]86$ ]]
then
    CMAKEFLAGS=""
elif [ "$ARCH" == "armv7l" ]
then
    CMAKEFLAGS="-DPROJECT_ARCH=arm"
elif [ "$ARCH" == "aarch64" ]
then
    CMAKEFLAGS="-DPROJECT_ARCH=arm64"
else
    echo "ERROR: Unsupported architecture"
    exit 1
fi

echo "Extracting CEF"
mkdir cef
tar xf "${CEFTARBALL}" -C cef --strip-components 1

echo "Building CEF DLL wrapper"

mkdir cef/releasebuild
pushd cef/releasebuild
cmake -DCMAKE_BUILD_TYPE=Release $CMAKEFLAGS ..
make -j2 libcef_dll_wrapper
popd

echo "CEF DLL wrapper successfully built"