1#!/usr/bin/env bash
2
3#
4# install-cef
5#
6# Copyright (C) 2021 by RStudio, PBC
7#
8# Unless you have received this program directly from RStudio pursuant
9# to the terms of a commercial license agreement with RStudio, then
10# this program is licensed to you under the terms of version 3 of the
11# GNU Affero General Public License. This program is distributed WITHOUT
12# ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
13# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
14# AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
15#
16#
17
18set -e
19
20source "$(dirname "${BASH_SOURCE[0]}")/../tools/rstudio-tools.sh"
21section "Installing Chromium Embedded Framework (CEF)"
22
23# install dir
24INSTALL_DIR=$(pwd)
25
26# determine platform
27PLATFORM=$(uname)
28
29# bail if not mac for now
30if [ "$PLATFORM" != "Darwin" ]; then
31  exit 0
32fi
33
34# download and extract cef if necessary
35# TODO: Linux platform (32 vs. 64 bit)
36CEF_VERSION="3.1547.1412"
37if [ "$PLATFORM" = "Darwin" ]; then
38  CEF_PLATFORM=macosx64
39fi
40
41CEF_DIR=CEF
42if [ -d "$CEF_DIR/$CEF_VERSION" ]; then
43   echo "Chromium Embedded Framework already installed at '${CEF_DIR}/${CEF_VERSION}'"
44   cd "${INSTALL_DIR}"
45   exit 0
46fi
47
48CEF_FILE=cef_binary_${CEF_VERSION}_$CEF_PLATFORM
49CEF_ARCHIVE=$CEF_FILE.zip
50download $CEF_ARCHIVE
51unzip -q $CEF_ARCHIVE
52rm -rf __MACOSX
53mkdir -p $CEF_DIR
54mv $CEF_FILE $CEF_DIR/$CEF_VERSION
55rm $CEF_ARCHIVE
56
57echo "Chromium Embedded Framework installed to '${CEF_DIR}/${CEF_VERSION}'"
58cd "${INSTALL_DIR}"
59