From f170d37479774c6fe15bb2aafff06e2a2a2258dd Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 5 Mar 2013 07:39:32 +0100 Subject: [PATCH] Use cefode's CEF binary. --- Rakefile | 8 +++- script/download_cef | 91 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 2 deletions(-) create mode 100755 script/download_cef diff --git a/Rakefile b/Rakefile index 704999599..fa4acf85a 100644 --- a/Rakefile +++ b/Rakefile @@ -20,7 +20,9 @@ end desc "Update CEF to the latest version specified by the prebuilt-cef submodule" task "update-cef" => "bootstrap" do - exit 1 unless system %{prebuilt-cef/script/download -f cef} + # TODO Use prebuilt-cef's script after https://github.com/github/prebuilt-cef/pull/2 is merged. + # exit 1 unless system %{prebuilt-cef/script/download -b 1410 -r 1107 -d https://gh-contractor-zcbenz.s3.amazonaws.com/cefode/prebuilt-cef -f cef} + exit 1 unless system %{script/download_cef -b 1410 -r 1107 -d https://gh-contractor-zcbenz.s3.amazonaws.com/cefode/prebuilt-cef -f cef} Dir.glob('cef/*.gypi').each do |filename| `sed -i '' -e "s/'include\\//'cef\\/include\\//" -e "s/'libcef_dll\\//'cef\\/libcef_dll\\//" #{filename}` end @@ -28,7 +30,9 @@ end desc "Download debug symbols for CEF" task "download-cef-symbols" => "update-cef" do - sh %{prebuilt-cef/script/download -s cef} + # TODO Use prebuilt-cef's script after https://github.com/github/prebuilt-cef/pull/2 is merged. + # sh %{prebuilt-cef/script/download -b 1410 -r 1107 -d https://gh-contractor-zcbenz.s3.amazonaws.com/cefode/prebuilt-cef -s cef} + sh %{script/download_cef -b 1410 -r 1107 -d https://gh-contractor-zcbenz.s3.amazonaws.com/cefode/prebuilt-cef -s cef} end task "bootstrap" do diff --git a/script/download_cef b/script/download_cef new file mode 100755 index 000000000..5ba36bb92 --- /dev/null +++ b/script/download_cef @@ -0,0 +1,91 @@ +#!/bin/sh +#/ Usage: download [-f] [-s] [-b cef-branch] [-r cef-revision] [-d url/to/prebuilt/cef] path/for/extraction +#/ Download and extract prebuilt CEF. +#/ +#/ Options: +#/ -f Overwrite path/for/extraction if it already exists. +#/ -s Download debugging symbols as well. +#/ -b CEF branch. +#/ -r CEF revision. +#/ -d Where to download binaries. +#/ -h Show this message. + +set -e + +usage() { + grep '^#/' <"$0"| cut -c4- +} + +DISTURL="https://github-janky-artifacts.s3.amazonaws.com/prebuilt-cef" + +while getopts ":fsb:r:d:h" OPTION; do + case ${OPTION} in + f) + FORCE=1 + ;; + s) + SYMBOLS=1 + ;; + b) + CEF_BRANCH=${OPTARG} + ;; + r) + CEF_REVISION=${OPTARG} + ;; + d) + DISTURL=${OPTARG} + ;; + h) + usage + exit 0 + ;; + ?) + echo "Unknown option -${OPTARG}" + usage + exit 1 + ;; + esac +done + +shift $((OPTIND-1)) + +if [ -z "${1}" ]; then + usage + exit 1 +fi + +if [ "$(uname)" = "Darwin" ]; then + OS_TYPE=macosx +else + OS_TYPE=linux +fi +CEF_BASENAME="cef_binary_3.${CEF_BRANCH}.${CEF_REVISION}_${OS_TYPE}" +CEF_SYMBOLS_BASENAME="${CEF_BASENAME}_symbols" + +TEMP_DIR=$(mktemp -d -t prebuilt-cef-download.XXXXXX) +trap "rm -rf \"${TEMP_DIR}\"" EXIT + +# See if we've already downloaded this version. +grep -E "^CEF Version:[[:space:]]+3\.${CEF_BRANCH}\.${CEF_REVISION}$" "${1}/README.txt" >/dev/null 2>&1 || { + if [ -e "${1}" ] && [ "${FORCE}" != "1" ]; then + echo >&2 "Error: ${1} already exists. Pass -f if you want to overwrite it." + exit 1 + fi + + rm -rf "${1}" + mkdir -p "${1}" + + echo "Downloading/extracting CEF3 branch ${CEF_BRANCH} r${CEF_REVISION}..." + curl --progress-bar "${DISTURL}/${CEF_BASENAME}.zip" > "${TEMP_DIR}/cef.zip" + unzip -q "${TEMP_DIR}/cef.zip" -d "${TEMP_DIR}" + mv "${TEMP_DIR}/${CEF_BASENAME}"/* "${1}" +} + +if [ "${SYMBOLS}" != "1" ]; then + exit 0 +fi + +echo "Downloading/extracting symbols for CEF3 branch ${CEF_BRANCH} r${CEF_REVISION}..." +curl --progress-bar "${DISTURL}/${CEF_SYMBOLS_BASENAME}.zip" > "${TEMP_DIR}/symbols.zip" +unzip -q "${TEMP_DIR}/symbols.zip" -d "${TEMP_DIR}" +mv "${TEMP_DIR}/${CEF_SYMBOLS_BASENAME}"/* "${1}/Release"